Initial commit of the Quickshell desktop suite: bar, dock, launcher, settings, Control Center, dashboard, OSD, lock screen, desktop widgets, plugin host with the vendored Noctalia/Omarchy compatibility layer, helpers, packaging, tests and phase documentation. Includes the optimization work so far: usage widgets and dashboard gauges no longer animate continuously, desktop widgets pause while covered, system controls stop flickering on background polls, dock app matching uses an indexed catalog, and workspace ghosts are created only for occupied slots. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
42 lines
1.4 KiB
QML
42 lines
1.4 KiB
QML
pragma Singleton
|
|
import QtQuick
|
|
import Quickshell
|
|
import Quickshell.Services.Pipewire
|
|
|
|
Singleton {
|
|
id: root
|
|
property var backend: Pipewire
|
|
readonly property var sink: backend.defaultAudioSink
|
|
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)
|
|
readonly property bool available: backend.ready
|
|
PwObjectTracker {
|
|
objects: root.backend === Pipewire ? [root.sink, root.source].filter(n => n !== null) : []
|
|
}
|
|
function volume(input, value) {
|
|
const node = input ? source : sink;
|
|
if (!node || !node.audio || !Number.isFinite(value))
|
|
return false;
|
|
node.audio.volume = Math.max(0, Math.min(1, value));
|
|
return true;
|
|
}
|
|
function mute(input) {
|
|
const node = input ? source : sink;
|
|
if (!node || !node.audio)
|
|
return false;
|
|
node.audio.muted = !node.audio.muted;
|
|
return true;
|
|
}
|
|
function select(input, index) {
|
|
const node = (input ? inputs : outputs)[index];
|
|
if (!node)
|
|
return false;
|
|
if (input)
|
|
backend.preferredDefaultAudioSource = node;
|
|
else
|
|
backend.preferredDefaultAudioSink = node;
|
|
return true;
|
|
}
|
|
}
|