From 32fab59d245e6092080a51a0e8caecc93164d821 Mon Sep 17 00:00:00 2001 From: Gabriel Brown Date: Thu, 20 Aug 2026 00:03:21 -0400 Subject: [PATCH] Let a sound device be heard, and the Dock's icons be sized Nine outputs named after their chipsets cannot be told apart by reading, so each one gets a Test button that plays a short sample out of that device. Targeted by node name rather than by making it the default first, because finding out which is which should not move where everything else is playing. That belongs in its own service rather than in AudioDevices. sound-page-contract forbids Process, pactl and wpctl in the files that own device state, and it is right to: shelling out there races the PipeWire service that owns those same objects. Playback is a different thing -- pw-play opens its own stream and mutates no device, so there is nothing to race -- but the rule's letter covered it, and weakening a guard to fit a new case is how guards stop meaning anything. SoundTest exists so AudioDevices stays native bindings only. Worth recording next to the call: pw-play falls back to the default output for a target it cannot find, rather than failing. A stale node name would play from the wrong device and look exactly like a successful test, which is why the name is taken straight from the live node. The Dock's icon size was a constant in Theme. It goes through the preference schema like everything else, so validation, search, the generated docs and the write sweep all pick it up without being told about it separately -- and two contracts duly failed until docs/settings.md and the per-page commands were regenerated. Dock position is deliberately not here. It is not a setting but a rework: the dock is anchored bottom, and the reveal strip, tooltip placement, intellihide and the qs-dock rule in hypr/rules.lua all assume that. Doing it properly means changing compositor rules on a machine somebody uses daily, which is not something to start as a side effect of adding a slider. Claude-Session: https://claude.ai/code/session_01BRvzt4H8XXLPVH5MyYdk9L --- .../quickshell/config/PreferenceSchema.qml | 6 +++ config/dot/quickshell/config/Theme.qml | 2 +- .../modules/settings/DesktopPage.qml | 3 +- .../modules/settings/SoundDeviceRow.qml | 26 +++++++++--- config/dot/quickshell/services/SoundTest.qml | 40 +++++++++++++++++++ .../share/vicinae/scripts/settings-desktop.sh | 2 +- docs/settings.md | 3 +- 7 files changed, 72 insertions(+), 10 deletions(-) create mode 100644 config/dot/quickshell/services/SoundTest.qml diff --git a/config/dot/quickshell/config/PreferenceSchema.qml b/config/dot/quickshell/config/PreferenceSchema.qml index 1d5a373..c3fbb63 100644 --- a/config/dot/quickshell/config/PreferenceSchema.qml +++ b/config/dot/quickshell/config/PreferenceSchema.qml @@ -91,6 +91,12 @@ Singleton { label: "Automatically hide the Dock", detail: "Reveal it at the bottom edge when a workspace is occupied" }, + { + key: "dockIconSize", type: "int", def: 48, min: 32, max: 80, step: 4, + unit: "px", group: "dock", + label: "Icon size", + detail: "How large the Dock's application icons are drawn" + }, { key: "dockRevealDelayMs", type: "int", def: 0, min: 0, max: 1000, step: 25, unit: "ms", diff --git a/config/dot/quickshell/config/Theme.qml b/config/dot/quickshell/config/Theme.qml index ab4daa2..db3452c 100644 --- a/config/dot/quickshell/config/Theme.qml +++ b/config/dot/quickshell/config/Theme.qml @@ -126,7 +126,7 @@ Singleton { readonly property int barGap: 6 // breathing room below the bar for popovers readonly property int barSideMargin: 10 // inset for floating popovers - readonly property int dockIconSize: 48 + readonly property int dockIconSize: DesktopPreferences.get("dockIconSize") readonly property int dockPadding: 8 readonly property int dockGap: 8 readonly property int dockRadius: 20 diff --git a/config/dot/quickshell/modules/settings/DesktopPage.qml b/config/dot/quickshell/modules/settings/DesktopPage.qml index 30828f6..1cedd44 100644 --- a/config/dot/quickshell/modules/settings/DesktopPage.qml +++ b/config/dot/quickshell/modules/settings/DesktopPage.qml @@ -22,7 +22,8 @@ SettingsPage { ToggleRow { setting: "dockAutohide" } SliderRow { setting: "dockRevealDelayMs"; zeroLabel: "Instant" } - SliderRow { setting: "dockHideDelayMs"; zeroLabel: "Instant"; divider: false } + SliderRow { setting: "dockHideDelayMs"; zeroLabel: "Instant" } + SliderRow { setting: "dockIconSize"; divider: false } } SettingsCard { diff --git a/config/dot/quickshell/modules/settings/SoundDeviceRow.qml b/config/dot/quickshell/modules/settings/SoundDeviceRow.qml index 2fc5cfa..3188140 100644 --- a/config/dot/quickshell/modules/settings/SoundDeviceRow.qml +++ b/config/dot/quickshell/modules/settings/SoundDeviceRow.qml @@ -89,13 +89,27 @@ Rectangle { } } - SettingsButton { - id: useButton + Row { anchors.verticalCenter: parent.verticalCenter - width: root.selected ? 78 : 64 - text: root.selected ? "Default" : "Use" - enabled: !root.selected - onClicked: AudioDevices.select(root.output, root.node) + spacing: 7 + + // Outputs only. Testing an input would mean recording and playing + // it back, which is a different thing than this button implies. + SettingsButton { + anchors.verticalCenter: parent.verticalCenter + visible: root.output + text: "Test" + onClicked: SoundTest.play(root.node) + } + + SettingsButton { + id: useButton + anchors.verticalCenter: parent.verticalCenter + width: root.selected ? 78 : 64 + text: root.selected ? "Default" : "Use" + enabled: !root.selected + onClicked: AudioDevices.select(root.output, root.node) + } } } diff --git a/config/dot/quickshell/services/SoundTest.qml b/config/dot/quickshell/services/SoundTest.qml new file mode 100644 index 0000000..1930d59 --- /dev/null +++ b/config/dot/quickshell/services/SoundTest.qml @@ -0,0 +1,40 @@ +pragma Singleton + +// Playing a short sound out of one chosen output. +// +// Deliberately not part of AudioDevices, which owns device state through the +// Quickshell PipeWire bindings and must not shell out -- doing so there would +// race the service that owns those same objects. This spawns a short-lived +// playback client instead: it creates its own stream and mutates no device, so +// there is nothing for it to race. +// +// It exists because nine outputs named after their chipsets cannot be told +// apart by reading. The only way to know which is which is to hear one. + +import Quickshell +import Quickshell.Io +import QtQuick + +Singleton { + id: root + + // A short, unmistakable, front-and-centre sample that ships with the + // freedesktop sound theme, so nothing has to be bundled. + readonly property string sample: + "/usr/share/sounds/freedesktop/stereo/audio-channel-front-center.oga" + + readonly property bool playing: player.running + + // Targeted by node name taken straight from the live node. pw-play falls + // back to the default output for a target it cannot find, so a stale name + // would play out of the wrong device and look like the test had worked. + function play(node: var): void { + const target = String(node?.name ?? ""); + if (target === "" || player.running) + return; + player.command = ["pw-play", "--target", target, root.sample]; + player.running = true; + } + + Process { id: player } +} diff --git a/config/local/share/vicinae/scripts/settings-desktop.sh b/config/local/share/vicinae/scripts/settings-desktop.sh index db741c0..222de00 100755 --- a/config/local/share/vicinae/scripts/settings-desktop.sh +++ b/config/local/share/vicinae/scripts/settings-desktop.sh @@ -5,6 +5,6 @@ # @vicinae.mode silent # @vicinae.icon ../../icons/hicolor/scalable/apps/panama-settings.svg # @vicinae.description Open Desktop & Dock in Settings. -# @vicinae.keywords ["settings", "automatically hide the dock", "reveal delay", "hide delay", "focus session length", "resize by dragging the border", "border grab area", "show the resize cursor", "snap distance between windows", "snap distance to screen edges", "snapping respects gaps", "master area size", "master area position"] +# @vicinae.keywords ["settings", "automatically hide the dock", "icon size", "reveal delay", "hide delay", "focus session length", "resize by dragging the border", "border grab area", "show the resize cursor", "snap distance between windows", "snap distance to screen edges", "snapping respects gaps", "master area size"] exec "$HOME/.config/quickshell/scripts/panama-action" settings-page desktop diff --git a/docs/settings.md b/docs/settings.md index 043f140..0fec546 100644 --- a/docs/settings.md +++ b/docs/settings.md @@ -4,7 +4,7 @@ Do not edit this file. Run `quickshell/scripts/panama-settings-docs` after changing the schema; a contract fails when this copy is stale. -131 settings across 27 groups. 67 of them are applied to the compositor and confirmed by reading the value back. +132 settings across 27 groups. 67 of them are applied to the compositor and confirmed by reading the value back. ## accessibility @@ -66,6 +66,7 @@ Found on **Desktop & Dock**. | Setting | Default | What it does | |---|---|---| | **Automatically hide the Dock**
`dockAutohide` | true | Reveal it at the bottom edge when a workspace is occupied | +| **Icon size**
`dockIconSize` | 48 px | How large the Dock's application icons are drawn. Range 32–80. | | **Reveal delay**
`dockRevealDelayMs` | 0 ms | Zero reveals the Dock the instant the pointer reaches the edge. Range 0–1000. | | **Hide delay**
`dockHideDelayMs` | 250 ms | Prevents flicker when crossing between icons. Range 0–2000. | | **Pinned applications**
`dockPinned` | [ | Applications that stay in the Dock whether or not they are running |