Krolyxon
Commit ff7bd95

Branches

Refs →

aurora.configquickshellauroraSettings.qml

111 lines · 5.2 KB · QML

1pragma Singleton
2import QtQuick
3import Quickshell
4import Quickshell.Io
5
6// User knobs persisted to ~/.config/aurora/settings.json (outside the shell dir, so syncing the
7// config never clobbers it). Written on every change, re-read when edited by hand.
8Singleton {
9 id: root
10 readonly property string file: Quickshell.env("HOME") + "/.config/aurora/settings.json"
11
12 // defaults live here; reset() puts them back
13 readonly property var defaults: ({
14 fontSize: 12, wsFontSize: 11, barHeight: 22, barAlpha: 1.0, panelAlpha: 0.88, matuScheme: "scheme-content", matuContrast: 0.0,
15 osdTimeout: 1500, desktopClock: true, desktopViz: true, vizBars: 64,
16 dock: true, dockPinned: ["foot", "librewolf", "pcmanfm", "obsidian"], wallFolder: "dusky-dark",
17 notifSound: true, notifVolume: 0.7,
18 idleDim: 150, idleOff: 330, idleLock: 600, idleSuspend: 0, charTone: 0, portalAutoOpen: true,
19 chargeMode: "off", batLow: 15, batCritical: 5, batCriticalAction: "none",
20 privacyIndicators: true, powerAuto: false, powerAc: "balanced", powerBat: "saver"
21 })
22
23 property alias fontSize: a.fontSize
24 property alias wsFontSize: a.wsFontSize
25 property alias barHeight: a.barHeight
26 property alias barAlpha: a.barAlpha
27 property alias panelAlpha: a.panelAlpha
28 property alias matuScheme: a.matuScheme
29 property alias matuContrast: a.matuContrast
30 property alias osdTimeout: a.osdTimeout
31 property alias desktopClock: a.desktopClock
32 property alias desktopViz: a.desktopViz
33 property alias vizBars: a.vizBars
34 property alias dock: a.dock
35 property alias dockPinned: a.dockPinned
36 property alias wallFolder: a.wallFolder
37 property alias notifSound: a.notifSound
38 property alias notifVolume: a.notifVolume
39 property alias idleDim: a.idleDim
40 property alias idleOff: a.idleOff
41 property alias idleLock: a.idleLock
42 property alias idleSuspend: a.idleSuspend
43 property alias charTone: a.charTone
44 property alias portalAutoOpen: a.portalAutoOpen
45 property alias chargeMode: a.chargeMode
46 property alias batLow: a.batLow
47 property alias batCritical: a.batCritical
48 property alias batCriticalAction: a.batCriticalAction
49 property alias privacyIndicators: a.privacyIndicators
50 property alias powerAuto: a.powerAuto
51 property alias powerAc: a.powerAc
52 property alias powerBat: a.powerBat
53
54 function reset() {
55 for (var k in defaults) a[k] = defaults[k]
56 }
57 function togglePin(id) {
58 var l = dockPinned.slice(), i = l.indexOf(id)
59 if (i >= 0) l.splice(i, 1); else l.push(id)
60 dockPinned = l
61 }
62
63 FileView {
64 id: fv
65 path: root.file
66 blockLoading: true // loaded before first use (e.g. Wall.random() right after startup)
67 watchChanges: true
68 onFileChanged: reload()
69 onAdapterUpdated: writeAdapter()
70 onLoadFailed: err => {
71 if (err === FileViewError.FileNotFound)
72 Quickshell.execDetached(["sh", "-c", 'mkdir -p "${1%/*}"', "sh", root.file])
73 writeLater.start()
74 }
75 adapter: JsonAdapter {
76 id: a
77 property int fontSize: 12
78 property int wsFontSize: 11
79 property int barHeight: 22
80 property real barAlpha: 1.0
81 property real panelAlpha: 0.88
82 property string matuScheme: "scheme-content" // matugen -t (Wall.qml), accent = its primary_container (= wallpaper colour)
83 property real matuContrast: 0.0 // matugen --contrast, -1..1
84 property int osdTimeout: 1500
85 property bool desktopClock: true
86 property bool desktopViz: true
87 property int vizBars: 64
88 property bool dock: true
89 property list<string> dockPinned: ["foot", "librewolf", "pcmanfm", "obsidian"]
90 property string wallFolder: "dusky-dark"
91 property bool notifSound: true
92 property real notifVolume: 0.7
93 property int idleDim: 150 // hypridle timeouts in seconds, 0 = never (Idle.qml)
94 property int idleOff: 330
95 property int idleLock: 600
96 property int idleSuspend: 0
97 property int charTone: 0 // glyph picker emoji skin tone, 0 = none, 1-5 light..dark
98 property bool portalAutoOpen: true // open captive portal login pages in $BROWSER (Net.qml)
99 property string chargeMode: "off" // off | conservation (Battery.qml)
100 property int batLow: 15 // low battery warning, %
101 property int batCritical: 5
102 property string batCriticalAction: "none" // none | suspend | poweroff
103 property bool privacyIndicators: true // mic/camera/screen-share icons in the bar (Privacy.qml)
104 property bool powerAuto: false // power profile follows AC/battery (Battery.qml), off = whatever ppd has
105 property string powerAc: "balanced" // saver | balanced | performance
106 property string powerBat: "saver"
107 }
108 }
109 // first run: create the file once the directory exists
110 Timer { id: writeLater; interval: 300; onTriggered: fv.writeAdapter() }
111}