diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-04-28 20:13:35 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-04-28 20:13:35 +1000 |
| commit | 97b4b78d7e3224d24b56863a9eb304a56a44d819 (patch) | |
| tree | 6b5ead876ea03d3f84508f5835294af7a27aa285 /config/Appearance.qml | |
| parent | refactor: bar workspaces move workspace into file (diff) | |
| download | caelestia-shell-97b4b78d7e3224d24b56863a9eb304a56a44d819.tar.gz caelestia-shell-97b4b78d7e3224d24b56863a9eb304a56a44d819.tar.bz2 caelestia-shell-97b4b78d7e3224d24b56863a9eb304a56a44d819.zip | |
refactor: appearance fix typing
Diffstat (limited to 'config/Appearance.qml')
| -rw-r--r-- | config/Appearance.qml | 119 |
1 files changed, 66 insertions, 53 deletions
diff --git a/config/Appearance.qml b/config/Appearance.qml index aef3d63..82ee846 100644 --- a/config/Appearance.qml +++ b/config/Appearance.qml @@ -9,20 +9,45 @@ Singleton { id: root property bool borders: true + readonly property Transparency transparency: Transparency {} + readonly property Rounding rounding: Rounding {} + readonly property Spacing spacing: Spacing {} + readonly property Padding padding: Padding {} + readonly property Font font: Font {} + readonly property Anim anim: Anim {} + readonly property Colours colours: Colours {} - readonly property QtObject transparency: QtObject { - property real base: 0.78 - property real layers: 0.5 + function alpha(c: color, layer: bool): color { + return Qt.rgba(c.r, c.g, c.b, layer ? transparency.layers : transparency.base); + } + + FileView { + path: `${StandardPaths.standardLocations(StandardPaths.GenericStateLocation)[0]}/caelestia/scheme/current.txt` + watchChanges: true + onFileChanged: this.reload() + onLoaded: { + const contents = this.text(); + + for (const line of contents.split("\n")) { + const [name, colour] = line.split(" "); + root.colours[name.trim()] = `#${colour.trim()}`; + } + } + } + + component Transparency: QtObject { + readonly property real base: 0.78 + readonly property real layers: 0.5 } - readonly property QtObject rounding: QtObject { + component Rounding: QtObject { readonly property int small: 12 readonly property int normal: 17 readonly property int large: 25 readonly property int full: 1000 } - readonly property QtObject spacing: QtObject { + component Spacing: QtObject { readonly property int small: 7 readonly property int smaller: 10 readonly property int normal: 12 @@ -30,7 +55,7 @@ Singleton { readonly property int large: 20 } - readonly property QtObject padding: QtObject { + component Padding: QtObject { readonly property int small: 5 readonly property int smaller: 7 readonly property int normal: 10 @@ -38,41 +63,47 @@ Singleton { readonly property int large: 15 } - readonly property QtObject font: QtObject { - readonly property QtObject family: QtObject { - readonly property string sans: "IBM Plex Sans" - readonly property string mono: "JetBrains Mono NF" - readonly property string material: "Material Symbols Rounded" - } + component FontFamily: QtObject { + readonly property string sans: "IBM Plex Sans" + readonly property string mono: "JetBrains Mono NF" + readonly property string material: "Material Symbols Rounded" + } - readonly property QtObject size: QtObject { - readonly property int small: 11 - readonly property int smaller: 12 - readonly property int normal: 13 - readonly property int larger: 15 - readonly property int large: 18 - } + component FontSize: QtObject { + readonly property int small: 11 + readonly property int smaller: 12 + readonly property int normal: 13 + readonly property int larger: 15 + readonly property int large: 18 } - readonly property QtObject anim: QtObject { - readonly property QtObject curves: QtObject { - readonly property list<real> emphasized: [0.05, 0, 2 / 15, 0.06, 1 / 6, 0.4, 5 / 24, 0.82, 0.25, 1, 1, 1] - readonly property list<real> emphasizedAccel: [0.3, 0, 0.8, 0.15, 1, 1] - readonly property list<real> emphasizedDecel: [0.05, 0.7, 0.1, 1, 1, 1] - readonly property list<real> standard: [0.2, 0, 0, 1, 1, 1] - readonly property list<real> standardAccel: [0.3, 0, 1, 1, 1, 1] - readonly property list<real> standardDecel: [0, 0, 0, 1, 1, 1] - } + component Font: QtObject { + readonly property FontFamily family: FontFamily {} + readonly property FontSize size: FontSize {} + } - readonly property QtObject durations: QtObject { - readonly property int small: 200 - readonly property int normal: 400 - readonly property int large: 600 - readonly property int extraLarge: 1000 - } + component AnimCurves: QtObject { + readonly property list<real> emphasized: [0.05, 0, 2 / 15, 0.06, 1 / 6, 0.4, 5 / 24, 0.82, 0.25, 1, 1, 1] + readonly property list<real> emphasizedAccel: [0.3, 0, 0.8, 0.15, 1, 1] + readonly property list<real> emphasizedDecel: [0.05, 0.7, 0.1, 1, 1, 1] + readonly property list<real> standard: [0.2, 0, 0, 1, 1, 1] + readonly property list<real> standardAccel: [0.3, 0, 1, 1, 1, 1] + readonly property list<real> standardDecel: [0, 0, 0, 1, 1, 1] + } + + component AnimDurations: QtObject { + readonly property int small: 200 + readonly property int normal: 400 + readonly property int large: 600 + readonly property int extraLarge: 1000 } - readonly property QtObject colours: QtObject { + component Anim: QtObject { + readonly property AnimCurves curves: AnimCurves {} + readonly property AnimDurations durations: AnimDurations {} + } + + component Colours: QtObject { property color primary: "#85D2E7" property color secondary: "#B2CBD3" property color tertiary: "#BFC4EB" @@ -105,22 +136,4 @@ Singleton { property color blue: "#9CCBFA" property color lavender: "#86D1EB" } - - function alpha(c: color, layer: bool): color { - return Qt.rgba(c.r, c.g, c.b, layer ? transparency.layers : transparency.base); - } - - FileView { - path: `${StandardPaths.standardLocations(StandardPaths.GenericStateLocation)[0]}/caelestia/scheme/current.txt` - watchChanges: true - onFileChanged: this.reload() - onLoaded: { - const contents = this.text(); - - for (const line of contents.split("\n")) { - const [name, colour] = line.split(" "); - root.colours[name.trim()] = `#${colour.trim()}`; - } - } - } } |