Krolyxon
Commit eec80fe

Branches

Refs →

aurora.configquickshellaurorashell.qml

62 lines · 1.8 KB · QML

1import QtQuick
2import Quickshell
3import Quickshell.Io
4import Quickshell.Services.Pipewire
5
6// aurora: bar + control panel + notifications, themed from pywal16.
7ShellRoot {
8 id: root
9
10 property bool opened: false
11 property int tab: 0
12 property double closedAt: 0
13 property string lastTab: ""
14 readonly property var tabNames: ["home", "audio", "net", "bt", "sys", "notif"]
15
16 function close() {
17 if (!opened) return
18 opened = false
19 closedAt = Date.now()
20 lastTab = tabNames[tab]
21 }
22 function openTab(name) {
23 var i = tabNames.indexOf(name)
24 if (i >= 0) tab = i
25 opened = true
26 }
27 // bar buttons: click once to open that tab, again to close.
28 // (the focus grab already closed the panel on the press, so guard against instant re-open)
29 function togglePanel(name) {
30 var i = tabNames.indexOf(name)
31 if (opened && tab === i) { close(); return }
32 if (!opened && lastTab === name && Date.now() - closedAt < 250) return
33 tab = i
34 opened = true
35 }
36
37 // keep every pipewire node bound so volume / mute / properties are readable
38 PwObjectTracker { objects: Pipewire.nodes.values }
39
40 Variants {
41 model: Quickshell.screens
42 Bar { onTogglePanel: name => root.togglePanel(name) }
43 }
44
45 ControlPanel {
46 opened: root.opened
47 tab: root.tab
48 onTabRequested: i => root.tab = i
49 onCloseRequested: root.close()
50 }
51
52 NotifPopups { suppressed: root.opened }
53
54 IpcHandler {
55 target: "shell"
56 function toggle(): void { if (root.opened) root.close(); else root.opened = true }
57 function open(): void { root.opened = true }
58 function close(): void { root.close() }
59 function show(name: string): void { root.openTab(name) }
60 function dnd(): void { Notifs.dnd = !Notifs.dnd }
61 }
62}