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
@@ -10,9 +10,36 @@ Singleton {
|
||||
readonly property var source: backend.defaultAudioSource
|
||||
readonly property var outputs: backend.nodes.values.filter(n => n.audio && n.isSink && !n.isStream)
|
||||
readonly property var inputs: backend.nodes.values.filter(n => n.audio && !n.isSink && !n.isStream)
|
||||
// App playback streams, e.g. the players EasyEffects processes.
|
||||
readonly property var streams: backend.nodes.values.filter(n => n.audio && n.isStream && !n.isSink)
|
||||
readonly property bool available: backend.ready
|
||||
// Views listing streams hold a Demand on this, so their volumes are only
|
||||
// tracked while shown.
|
||||
property int streamConsumers: 0
|
||||
PwObjectTracker {
|
||||
objects: root.backend === Pipewire ? [root.sink, root.source].filter(n => n !== null) : []
|
||||
objects: root.backend === Pipewire ? [root.sink, root.source].filter(n => n !== null).concat(root.streamConsumers > 0 ? root.streams : []) : []
|
||||
}
|
||||
function streamName(node) {
|
||||
const p = node && node.properties || {};
|
||||
return p["application.name"] || node.description || p["media.name"] || node.name || "Unknown";
|
||||
}
|
||||
// Icon path: the stream's own icon name, else its app's desktop entry.
|
||||
function streamIcon(node) {
|
||||
const p = node && node.properties || {};
|
||||
const named = p["application.icon-name"] ? Quickshell.iconPath(p["application.icon-name"], true) : "";
|
||||
return named || ApplicationsService.icon(ApplicationsService.byId(p["application.process.binary"] || "") || ApplicationsService.byId(p["application.name"] || ""));
|
||||
}
|
||||
function streamVolume(node, value) {
|
||||
if (!node || !node.audio || !Number.isFinite(value))
|
||||
return false;
|
||||
node.audio.volume = Math.max(0, Math.min(1, value));
|
||||
return true;
|
||||
}
|
||||
function streamMute(node) {
|
||||
if (!node || !node.audio)
|
||||
return false;
|
||||
node.audio.muted = !node.audio.muted;
|
||||
return true;
|
||||
}
|
||||
function volume(input, value) {
|
||||
const node = input ? source : sink;
|
||||
|
||||
Reference in new issue
Block a user