config: add apps config

Closes #318 and #305
This commit is contained in:
2 * r + 2 * t 2025-08-02 17:09:55 +10:00
parent c2b2627b88
commit 6fe2903d75
7 changed files with 21 additions and 5 deletions

View file

@ -151,12 +151,17 @@ All configuration options are in `~/.config/caelestia/shell.json`.
```json
{
"general": {
"apps": {
"terminal": ["foot"],
"audio": ["pavucontrol"]
}
},
"background": {
"enabled": true
},
"bar": {
"dragThreshold": 20,
"externalAudioProgram": ["pavucontrol"],
"persistent": true,
"showOnHover": true,
"status": {

View file

@ -4,7 +4,6 @@ JsonObject {
property bool persistent: true
property bool showOnHover: true
property int dragThreshold: 20
property list<string> externalAudioProgram: ["pavucontrol"]
property Workspaces workspaces: Workspaces {}
property Status status: Status {}
property Sizes sizes: Sizes {}

View file

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

10
config/GeneralConfig.qml Normal file
View file

@ -0,0 +1,10 @@
import Quickshell.Io
JsonObject {
property Apps apps: Apps {}
component Apps: JsonObject {
property list<string> terminal: ["foot"]
property list<string> audio: ["pavucontrol"]
}
}

View file

@ -43,7 +43,7 @@ ColumnLayout {
StateLayer {
function onClicked(): void {
root.wrapper.hasCurrent = false;
Quickshell.execDetached(["app2unit", "--", ...Config.bar.externalAudioProgram]);
Quickshell.execDetached(["app2unit", "--", ...Config.general.apps.audio]);
}
}

View file

@ -111,7 +111,7 @@ Item {
color: Colours.palette.m3onTertiary
function onClicked(): void {
Quickshell.execDetached(["app2unit", "--", "foot", "fish", "-C", `exec qalc -i '${root.math}'`]);
Quickshell.execDetached(["app2unit", "--", ...Config.general.apps.terminal, "fish", "-C", `exec qalc -i '${root.math}'`]);
root.list.visibilities.launcher = false;
}
}

View file

@ -13,7 +13,7 @@ Searcher {
function launch(entry: DesktopEntry): void {
if (entry.runInTerminal)
Quickshell.execDetached({
command: ["app2unit", "--", "foot", `${Quickshell.shellDir}/assets/wrap_term_launch.sh`, ...entry.command],
command: ["app2unit", "--", ...Config.general.apps.terminal, `${Quickshell.shellDir}/assets/wrap_term_launch.sh`, ...entry.command],
workingDirectory: entry.workingDirectory
});
else