-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshell.qml
More file actions
148 lines (129 loc) · 4.92 KB
/
shell.qml
File metadata and controls
148 lines (129 loc) · 4.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
//@ pragma Env QSG_RENDER_LOOP=threaded
//@ pragma Env QT_WAYLAND_DISABLE_WINDOWDECORATION=1
import QtQuick
import Quickshell
import Quickshell.Wayland
import Quickshell.Io
import "lock"
import "popups"
ShellRoot {
// Bar on every screen
Variants {
model: Quickshell.screens
delegate: PulpBar {}
}
// Lock screen
LockScreen { id: lockScreen }
// App launcher
Launcher { id: launcher }
// Keybind cheatsheet
KeybindSheet { id: keybindSheet }
// Polkit authentication dialog
PolkitDialog {}
// WiFi password dialog
WifiPasswordDialog { id: wifiPasswordDialog }
// Screenshot toolbar
ScreenshotBar { id: screenshotBar }
Process {
id: _screenshotWatch
command: ["sh", "-c", "touch /tmp/pulp-screenshot-toggle; inotifywait -m -e attrib,create /tmp/pulp-screenshot-toggle"]
running: true
stdout: SplitParser { onRead: data => screenshotBar.show() }
onExited: () => Qt.callLater(() => { _screenshotWatch.running = true; })
}
// IPC handler for keybind toggles
IpcHandler {
target: "pulp"
function onMessage(data: string) {
if (data === "launcher") launcher.toggle();
else if (data === "keybinds") keybindSheet.toggle();
}
}
// File-based triggers for keybinds
Process {
id: _launcherWatch
command: ["inotifywait", "-m", "-e", "attrib,create", "/tmp/pulp-launcher-toggle"]
running: true
stdout: SplitParser { onRead: data => launcher.toggle() }
onExited: () => Qt.callLater(() => { _launcherWatch.running = true; })
}
Process {
id: _keybindWatch
command: ["sh", "-c", "touch /tmp/pulp-keybinds-toggle; inotifywait -m -e attrib,create /tmp/pulp-keybinds-toggle"]
running: true
stdout: SplitParser { onRead: data => keybindSheet.toggle() }
onExited: () => Qt.callLater(() => { _keybindWatch.running = true; })
}
// OSD overlay
OSD { id: osd }
// Volume/brightness watcher — triggers OSD
Process {
id: _volWatch
command: ["sh", "-c", "pactl subscribe | grep --line-buffered 'sink'"]
running: true
stdout: SplitParser {
onRead: data => {
if (data.includes("change")) _osdVolPoll.running = true;
}
}
onExited: () => Qt.callLater(() => { _volWatch.running = true; })
}
Process {
id: _osdVolPoll
command: ["sh", "-c", "pactl get-sink-volume @DEFAULT_SINK@ | grep -oP '\\d+%' | head -1 | tr -d '%'"]
running: false
stdout: StdioCollector {
onStreamFinished: {
const v = parseInt(text.trim());
if (!isNaN(v)) {
let icon = "";
if (v === 0) icon = "";
else if (v < 33) icon = "";
else if (v < 66) icon = "";
osd.show(icon, "Volume " + v + "%", v / 100);
}
}
}
}
// Brightness watcher — poll on change
Process {
id: _brightWatch
command: ["sh", "-c", "inotifywait -m -e modify /sys/class/backlight/*/brightness 2>/dev/null"]
running: true
stdout: SplitParser {
onRead: data => _osdBrightPoll.running = true
}
onExited: () => Qt.callLater(() => { _brightWatch.running = true; })
}
Process {
id: _osdBrightPoll
command: ["sh", "-c", "brightnessctl -m 2>/dev/null | cut -d, -f4 | tr -d '%'"]
running: false
stdout: StdioCollector {
onStreamFinished: {
const v = parseInt(text.trim());
if (!isNaN(v)) {
let icon = v > 70 ? "" : v > 30 ? "" : "";
osd.show(icon, "Brightness " + v + "%", v / 100);
}
}
}
}
// Listen for lock-session signal
Process {
id: _lockListener
command: ["sh", "-c", "gdbus monitor -y -d org.freedesktop.login1 -o /org/freedesktop/login1/session/auto -p org.freedesktop.login1.Session.Lock 2>/dev/null || gdbus monitor -y -d org.freedesktop.login1"]
running: true
stdout: SplitParser {
onRead: data => { if (data.includes("Lock")) lockScreen.locked = true; }
}
onExited: () => Qt.callLater(() => { _lockListener.running = true; })
}
// Idle monitoring
IdleMonitor { enabled: true; timeout: 300000
onIsIdleChanged: { if (isIdle) Quickshell.execDetached(["brightnessctl", "set", "10%"]); else Quickshell.execDetached(["brightnessctl", "set", "100%"]); } }
IdleMonitor { enabled: true; timeout: 600000
onIsIdleChanged: { if (isIdle && !lockScreen.locked) lockScreen.locked = true; } }
IdleMonitor { enabled: true; timeout: 900000
onIsIdleChanged: { if (isIdle) Quickshell.execDetached(["wlr-randr", "--output", "*", "--off"]); } }
}