initial commit
This commit is contained in:
commit
9fde6d4fc6
27 changed files with 1110 additions and 0 deletions
53
modules/Theme.qml
Normal file
53
modules/Theme.qml
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
pragma Singleton
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
|
||||
QtObject {
|
||||
id: root
|
||||
|
||||
// base16 palette, overwritten from ~/.config/nova-shell/theme.json
|
||||
property color base00: "#1e1e2e"
|
||||
property color base01: "#181825"
|
||||
property color base02: "#313244"
|
||||
property color base03: "#45475a"
|
||||
property color base04: "#585b70"
|
||||
property color base05: "#cdd6f4"
|
||||
property color base06: "#f5e0dc"
|
||||
property color base07: "#b4befe"
|
||||
property color base08: "#f38ba8"
|
||||
property color base09: "#fab387"
|
||||
property color base0A: "#f9e2af"
|
||||
property color base0B: "#a6e3a1"
|
||||
property color base0C: "#94e2d5"
|
||||
property color base0D: "#89b4fa"
|
||||
property color base0E: "#cba6f7"
|
||||
property color base0F: "#f2cdcd"
|
||||
|
||||
property string fontFamily: "sans-serif"
|
||||
property int fontSize: 12
|
||||
property real barOpacity: 0.9
|
||||
property int barHeight: 32
|
||||
|
||||
property FileView _themeFile: FileView {
|
||||
path: (Quickshell.env("XDG_CONFIG_HOME") || (Quickshell.env("HOME") + "/.config"))
|
||||
+ "/nova-shell/theme.json"
|
||||
watchChanges: true
|
||||
onFileChanged: reload()
|
||||
onLoaded: root._apply(text())
|
||||
}
|
||||
|
||||
function _apply(raw) {
|
||||
let data;
|
||||
try { data = JSON.parse(raw); } catch (e) { return; }
|
||||
const c = data.colors || {};
|
||||
for (const k of Object.keys(c)) {
|
||||
if (k in root) root[k] = c[k];
|
||||
}
|
||||
if (data.fontFamily) root.fontFamily = data.fontFamily;
|
||||
if (data.fontSize) root.fontSize = data.fontSize;
|
||||
if (data.barOpacity !== undefined) root.barOpacity = data.barOpacity;
|
||||
if (data.barHeight !== undefined) root.barHeight = data.barHeight;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue