Krolyxon
Commit 4b1d495

Branches

Refs →

aurora.configquickshellauroraSettings.qml

128 lines · 6.4 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 barAlpha: 1.0, panelAlpha: 1.0, 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 motion: true, clock24: true, appIcons: "dots", barSize: 40,
22 wallLook: "dots", wallPitch: 10, wallBright: 85, dotGrid: true,
23 blink: true, weatherLoc: ""
24 })
25
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 property alias motion: a.motion
54 property alias clock24: a.clock24
55 property alias appIcons: a.appIcons
56 property alias barSize: a.barSize
57 property alias wallLook: a.wallLook
58 property alias wallPitch: a.wallPitch
59 property alias wallBright: a.wallBright
60 property alias dotGrid: a.dotGrid
61 property alias blink: a.blink
62 property alias weatherLoc: a.weatherLoc
63
64 function reset() {
65 for (var k in defaults) a[k] = defaults[k]
66 }
67 function togglePin(id) {
68 var l = dockPinned.slice(), i = l.indexOf(id)
69 if (i >= 0) l.splice(i, 1); else l.push(id)
70 dockPinned = l
71 }
72
73 FileView {
74 id: fv
75 path: root.file
76 blockLoading: true // loaded before first use (e.g. Wall.random() right after startup)
77 watchChanges: true
78 onFileChanged: reload()
79 onAdapterUpdated: writeAdapter()
80 onLoadFailed: err => {
81 if (err === FileViewError.FileNotFound)
82 Quickshell.execDetached(["sh", "-c", 'mkdir -p "${1%/*}"', "sh", root.file])
83 writeLater.start()
84 }
85 adapter: JsonAdapter {
86 id: a
87 property real barAlpha: 1.0
88 property real panelAlpha: 1.0 // control panel / popup opacity (settings > appearance)
89 property string matuScheme: "scheme-content" // matugen -t (Wall.qml), accent = its primary_container (= wallpaper colour)
90 property real matuContrast: 0.0 // matugen --contrast, -1..1
91 property int osdTimeout: 1500
92 property bool desktopClock: true
93 property bool desktopViz: true
94 property int vizBars: 64
95 property bool dock: true
96 property list<string> dockPinned: ["foot", "librewolf", "pcmanfm", "obsidian"]
97 property string wallFolder: "dusky-dark"
98 property bool notifSound: true
99 property real notifVolume: 0.7
100 property int idleDim: 150 // hypridle timeouts in seconds, 0 = never (Idle.qml)
101 property int idleOff: 330
102 property int idleLock: 600
103 property int idleSuspend: 0
104 property int charTone: 0 // glyph picker emoji skin tone, 0 = none, 1-5 light..dark
105 property bool portalAutoOpen: true // open captive portal login pages in $BROWSER (Net.qml)
106 property string chargeMode: "off" // off | conservation (Battery.qml)
107 property int batLow: 15 // low battery warning, %
108 property int batCritical: 5
109 property string batCriticalAction: "none" // none | suspend | poweroff
110 property bool privacyIndicators: true // mic/camera/screen-share icons in the bar (Privacy.qml)
111 property bool powerAuto: false // power profile follows AC/battery (Battery.qml), off = whatever ppd has
112 property string powerAc: "balanced" // saver | balanced | performance
113 property string powerBat: "saver"
114 property bool motion: true // shell animations (Theme.t)
115 property bool clock24: true
116 property string appIcons: "dots" // dots | mono | colour: how app icons are drawn
117 property int barSize: 40 // height of the bar (Doto clock from 40 up)
118 property string wallLook: "dots" // dots | colour | photo: how aurora draws the wallpaper (WallView)
119 property int wallPitch: 10 // dot step, px
120 property int wallBright: 85 // %, from the background to the full image
121 property bool dotGrid: true // dot grid on an empty desktop
122 property bool blink: true // the desktop clock's colon blinks
123 property string weatherLoc: "" // Weather.qml: "" = by IP, "lat,lon" or a place name
124 }
125 }
126 // first run: create the file once the directory exists
127 Timer { id: writeLater; interval: 300; onTriggered: fv.writeAdapter() }
128}