config: make appearance configurable

This commit is contained in:
2 * r + 2 * t 2025-08-09 00:13:48 +10:00
parent 66c012300a
commit 88a3f09de5
6 changed files with 147 additions and 85 deletions

View file

@ -147,10 +147,46 @@ git pull
All configuration options are in `~/.config/caelestia/shell.json`. All configuration options are in `~/.config/caelestia/shell.json`.
> [!NOTE]
> The example configuration only includes recommended configuration options. For more advanced customisation
> such as modifying the size of individual items or changing constants in the code, there are some other
> options which can be found in the source files in the `config` directory.
<details><summary>Example configuration</summary> <details><summary>Example configuration</summary>
```json ```json
{ {
"appearance": {
"anim": {
"durations": {
"scale": 1
}
},
"font": {
"family": {
"material": "Material Symbols Rounded",
"mono": "JetBrains Mono NF",
"sans": "IBM Plex Sans"
},
"size": {
"scale": 1
}
},
"padding": {
"scale": 1
},
"rounding": {
"scale": 1
},
"spacing": {
"scale": 1
},
"transparency": {
"enabled": false,
"base": 0.85,
"layers": 0.4
}
},
"general": { "general": {
"apps": { "apps": {
"terminal": ["foot"], "terminal": ["foot"],

View file

@ -1,84 +1,14 @@
pragma Singleton pragma Singleton
import Quickshell import Quickshell
import QtQuick
Singleton { Singleton {
id: root // Literally just here to shorten accessing stuff :woe:
// Also kinda so I can keep accessing it with `Appearance.xxx` instead of `Config.appearance.xxx`
readonly property Rounding rounding: Rounding {} readonly property AppearanceConfig.Rounding rounding: Config.appearance.rounding
readonly property Spacing spacing: Spacing {} readonly property AppearanceConfig.Spacing spacing: Config.appearance.spacing
readonly property Padding padding: Padding {} readonly property AppearanceConfig.Padding padding: Config.appearance.padding
readonly property FontStuff font: FontStuff {} readonly property AppearanceConfig.FontStuff font: Config.appearance.font
readonly property Anim anim: Anim {} readonly property AppearanceConfig.Anim anim: Config.appearance.anim
readonly property AppearanceConfig.Transparency transparency: Config.appearance.transparency
component Rounding: QtObject {
readonly property int small: 12
readonly property int normal: 17
readonly property int large: 25
readonly property int full: 1000
}
component Spacing: QtObject {
readonly property int small: 7
readonly property int smaller: 10
readonly property int normal: 12
readonly property int larger: 15
readonly property int large: 20
}
component Padding: QtObject {
readonly property int small: 5
readonly property int smaller: 7
readonly property int normal: 10
readonly property int larger: 12
readonly property int large: 15
}
component FontFamily: QtObject {
readonly property string sans: "IBM Plex Sans"
readonly property string mono: "JetBrains Mono NF"
readonly property string material: "Material Symbols Rounded"
}
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 int extraLarge: 28
}
component FontStuff: QtObject {
readonly property FontFamily family: FontFamily {}
readonly property FontSize size: FontSize {}
}
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]
readonly property list<real> expressiveFastSpatial: [0.42, 1.67, 0.21, 0.9, 1, 1]
readonly property list<real> expressiveDefaultSpatial: [0.38, 1.21, 0.22, 1, 1, 1]
readonly property list<real> expressiveEffects: [0.34, 0.8, 0.34, 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 int expressiveFastSpatial: 350
readonly property int expressiveDefaultSpatial: 500
readonly property int expressiveEffects: 200
}
component Anim: QtObject {
readonly property AnimCurves curves: AnimCurves {}
readonly property AnimDurations durations: AnimDurations {}
}
} }

View file

@ -0,0 +1,91 @@
import Quickshell.Io
JsonObject {
property Rounding rounding: Rounding {}
property Spacing spacing: Spacing {}
property Padding padding: Padding {}
property FontStuff font: FontStuff {}
property Anim anim: Anim {}
property Transparency transparency: Transparency {}
component Rounding: JsonObject {
property real scale: 1
property int small: 12 * scale
property int normal: 17 * scale
property int large: 25 * scale
property int full: 1000 * scale
}
component Spacing: JsonObject {
property real scale: 1
property int small: 7 * scale
property int smaller: 10 * scale
property int normal: 12 * scale
property int larger: 15 * scale
property int large: 20 * scale
}
component Padding: JsonObject {
property real scale: 1
property int small: 5 * scale
property int smaller: 7 * scale
property int normal: 10 * scale
property int larger: 12 * scale
property int large: 15 * scale
}
component FontFamily: JsonObject {
property string sans: "IBM Plex Sans"
property string mono: "JetBrains Mono NF"
property string material: "Material Symbols Rounded"
}
component FontSize: JsonObject {
property real scale: 1
property int small: 11 * scale
property int smaller: 12 * scale
property int normal: 13 * scale
property int larger: 15 * scale
property int large: 18 * scale
property int extraLarge: 28 * scale
}
component FontStuff: JsonObject {
property FontFamily family: FontFamily {}
property FontSize size: FontSize {}
}
component AnimCurves: JsonObject {
property list<real> emphasized: [0.05, 0, 2 / 15, 0.06, 1 / 6, 0.4, 5 / 24, 0.82, 0.25, 1, 1, 1]
property list<real> emphasizedAccel: [0.3, 0, 0.8, 0.15, 1, 1]
property list<real> emphasizedDecel: [0.05, 0.7, 0.1, 1, 1, 1]
property list<real> standard: [0.2, 0, 0, 1, 1, 1]
property list<real> standardAccel: [0.3, 0, 1, 1, 1, 1]
property list<real> standardDecel: [0, 0, 0, 1, 1, 1]
property list<real> expressiveFastSpatial: [0.42, 1.67, 0.21, 0.9, 1, 1]
property list<real> expressiveDefaultSpatial: [0.38, 1.21, 0.22, 1, 1, 1]
property list<real> expressiveEffects: [0.34, 0.8, 0.34, 1, 1, 1]
}
component AnimDurations: JsonObject {
property real scale: 1
property int small: 200 * scale
property int normal: 400 * scale
property int large: 600 * scale
property int extraLarge: 1000 * scale
property int expressiveFastSpatial: 350 * scale
property int expressiveDefaultSpatial: 500 * scale
property int expressiveEffects: 200 * scale
}
component Anim: JsonObject {
property AnimCurves curves: AnimCurves {}
property AnimDurations durations: AnimDurations {}
}
component Transparency: JsonObject {
property bool enabled: false
property real base: 0.85
property real layers: 0.4
}
}

View file

@ -7,6 +7,7 @@ import Quickshell.Io
Singleton { Singleton {
id: root id: root
property alias appearance: adapter.appearance
property alias general: adapter.general property alias general: adapter.general
property alias background: adapter.background property alias background: adapter.background
property alias bar: adapter.bar property alias bar: adapter.bar
@ -31,6 +32,7 @@ Singleton {
JsonAdapter { JsonAdapter {
id: adapter id: adapter
property AppearanceConfig appearance: AppearanceConfig {}
property GeneralConfig general: GeneralConfig {} property GeneralConfig general: GeneralConfig {}
property BackgroundConfig background: BackgroundConfig {} property BackgroundConfig background: BackgroundConfig {}
property BarConfig bar: BarConfig {} property BarConfig bar: BarConfig {}

View file

@ -1,3 +1,5 @@
pragma ComponentBehavior: Bound
import "items" import "items"
import qs.services import qs.services
import qs.config import qs.config
@ -18,11 +20,11 @@ PathView {
const max = Config.launcher.maxWallpapers; const max = Config.launcher.maxWallpapers;
const maxItemsOnScreen = Math.floor(screenWidth / itemWidth); const maxItemsOnScreen = Math.floor(screenWidth / itemWidth);
const visible = Math.min(maxItemsOnScreen, max, scriptModel.values.length) const visible = Math.min(maxItemsOnScreen, max, scriptModel.values.length);
if (visible === 2) if (visible === 2)
return 1 return 1;
else if (visible > 1 && visible % 2 === 0) else if (visible > 1 && visible % 2 === 0)
return visible - 1 return visible - 1;
return visible; return visible;
} }

View file

@ -1,6 +1,7 @@
pragma Singleton pragma Singleton
pragma ComponentBehavior: Bound pragma ComponentBehavior: Bound
import qs.config
import qs.utils import qs.utils
import Quickshell import Quickshell
import Quickshell.Io import Quickshell.Io
@ -93,9 +94,9 @@ Singleton {
} }
component Transparency: QtObject { component Transparency: QtObject {
property bool enabled: false readonly property bool enabled: Appearance.transparency.enabled
property real base: 0.8 readonly property real base: Appearance.transparency.base - (root.light ? 0.1 : 0)
property real layers: 0.4 readonly property real layers: Appearance.transparency.layers
} }
component M3TPalette: QtObject { component M3TPalette: QtObject {