move Theme, SystemStats, Modules to shell/services/
This commit is contained in:
parent
197f6976e0
commit
989182d603
59 changed files with 432 additions and 388 deletions
86
shell/services/Theme.qml
Normal file
86
shell/services/Theme.qml
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
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 string iconFontFamily: "Symbols Nerd Font"
|
||||
property int fontSize: 12
|
||||
property real barOpacity: 0.9
|
||||
property int barHeight: 32
|
||||
property int barPadding: 8
|
||||
property int moduleSpacing: 4
|
||||
property int groupSpacing: 6
|
||||
property int groupPadding: 8
|
||||
property int radius: 4
|
||||
property int screenRadius: 15
|
||||
property bool _reducedMotionConfig: false
|
||||
readonly property bool reducedMotion: _reducedMotionConfig || PowerProfileService.powerSaver
|
||||
|
||||
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.iconFontFamily)
|
||||
root.iconFontFamily = data.iconFontFamily;
|
||||
if (data.fontSize)
|
||||
root.fontSize = data.fontSize;
|
||||
if (data.barOpacity !== undefined)
|
||||
root.barOpacity = data.barOpacity;
|
||||
if (data.barHeight !== undefined)
|
||||
root.barHeight = data.barHeight;
|
||||
if (data.barPadding !== undefined)
|
||||
root.barPadding = data.barPadding;
|
||||
if (data.moduleSpacing !== undefined)
|
||||
root.moduleSpacing = data.moduleSpacing;
|
||||
if (data.groupSpacing !== undefined)
|
||||
root.groupSpacing = data.groupSpacing;
|
||||
if (data.groupPadding !== undefined)
|
||||
root.groupPadding = data.groupPadding;
|
||||
if (data.radius !== undefined)
|
||||
root.radius = data.radius;
|
||||
if (data.screenRadius !== undefined)
|
||||
root.screenRadius = data.screenRadius;
|
||||
if (data.reducedMotion !== undefined)
|
||||
root._reducedMotionConfig = data.reducedMotion;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue