Add a Caffeine inhibitor, app stream volumes and vertical bar sliders
CaffeineService holds a systemd-inhibit idle/sleep lock while active. AudioService lists app playback streams and tracks their volume only while a view holds a Demand on it. GlassBarSlider fills from the bottom when vertical. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d6a6cf69f4
commit
0dcf37346c
4 files changed
+94
-18
No files matched your search
@@ -0,0 +1,37 @@
|
||||
pragma Singleton
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
|
||||
// Keeps the session awake while on: holds a systemd idle and sleep inhibitor,
|
||||
// which hypridle and logind both honour. Off again after a shell restart.
|
||||
Singleton {
|
||||
id: root
|
||||
property bool active: false
|
||||
property var command: ["systemd-inhibit", "--what=idle:sleep", "--who=glassMxrph", "--why=Caffeine", "--mode=block", "sleep", "infinity"]
|
||||
readonly property bool running: inhibitor.running
|
||||
function toggle() {
|
||||
active = !active;
|
||||
return true;
|
||||
}
|
||||
Process {
|
||||
id: inhibitor
|
||||
command: root.command
|
||||
running: root.active
|
||||
// The inhibitor exiting on its own (logind refused it) turns the tile off.
|
||||
onRunningChanged: if (!running && root.active)
|
||||
root.active = false
|
||||
}
|
||||
IpcHandler {
|
||||
target: "caffeine"
|
||||
function toggle(): bool {
|
||||
return root.toggle();
|
||||
}
|
||||
function status(): string {
|
||||
return JSON.stringify({
|
||||
active: root.active,
|
||||
running: inhibitor.running
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user