repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

feat(audio): tap-device options drawer (set default + mute)

bb54961752afac0abf8c0ffd5ba71a44721c53f7

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Tapping an output/input device now opens an inline options drawer with
explicit "set default" (hidden when already default) and mute/unmute
pills, replacing the undiscoverable left-click-to-default /
middle-click-to-mute gestures. The volume slider stays on the card; its
track MouseArea still wins over the card tap, so dragging volume never
opens the drawer.

As with the network panel, the per-list capped Flickables (which clipped
the drawer) are replaced by one outer scroll pane around the whole audio
panel, so drawers grow in-flow and a long device list scrolls.

No port/profile picker: PipeWire's PwNode exposes no routing, so the
drawer honestly offers only set-default + mute.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Changed files (1)

+201 / −56 text lines

Diff layout

quickshell/nuguland/PopoutHost.qml

Modified

+201 / −56 text lines

38773877 readonly property var sinks: state.sinks || []
38783878 readonly property var sources: state.sources || []
38793879 readonly property var streams: state.streams || []
3880 // device id whose options drawer is open ("" = none), per section.
3881 property string expandedSink: ""
3882 property string expandedSource: ""
38823885 function refreshFrom(text) {
39263929 spacing: 10
39273930 width: parent ? parent.width : 0
3932 // One scroll pane for the whole panel so device option drawers grow
3933 // without clipping and a long device list scrolls. Idle (no overflow)
3934 // => not interactive.
3935 Flickable {
3936 width: parent.width
3937 height: root.height
3938 contentWidth: width
3939 contentHeight: audioCol.height
3940 clip: true
3941 interactive: contentHeight > height
3942 boundsBehavior: Flickable.StopAtBounds
3943 flickableDirection: Flickable.VerticalFlick
3945 Column {
3946 id: audioCol
3948 width: parent.width
3949 spacing: 10
39293951 // output devices (sinks). solid-dark cards — the popup frame is light,
39303952 // so a translucent tint fill washes to near-white. Identity is carried
39313953 // by the left accent bar + border; default = ui.accent.
39403962 text: "output"
3943 Flickable {
3965 Column {
39443966 width: parent.width
3945 height: Math.min(sinkListCol.height, 204)
3946 contentHeight: sinkListCol.height
3947 clip: true
3948 interactive: contentHeight > height
3949 boundsBehavior: Flickable.StopAtBounds
3967 spacing: 6
3951 Column {
3952 id: sinkListCol
3969 Repeater {
3970 model: root.sinks
3954 width: parent.width
3955 spacing: 6
3972 delegate: Column {
3973 id: sinkRow
3957 Repeater {
3958 model: root.sinks
3975 required property var modelData
3976 readonly property bool revealed: root.expandedSink === modelData.id
3960 delegate: Rectangle {
3961 id: sinkRow
3963 required property var modelData
3978 width: parent.width
3979 spacing: 4
3981 Rectangle {
39653982 width: parent.width
39663983 height: 48
39673984 radius: 12
39683985 color: root.theme ? root.theme.withAlpha(root.theme.ui.backdrop, sinkRow.modelData.isDefault ? 0.82 : 0.55) : "transparent"
3969 border.width: sinkRow.modelData.isDefault ? 2 : 1
3970 border.color: root.theme ? (sinkRow.modelData.isDefault ? root.theme.ui.accent : root.theme.withAlpha(root.theme.ui.minor, 0.45)) : "transparent"
3986 border.width: (sinkRow.modelData.isDefault || sinkRow.revealed) ? 2 : 1
3987 border.color: root.theme ? (sinkRow.modelData.isDefault ? root.theme.ui.accent : (sinkRow.revealed ? root.theme.withAlpha(root.theme.ui.accent, 0.6) : root.theme.withAlpha(root.theme.ui.minor, 0.45))) : "transparent"
3972 // row click: left selects default sink, middle toggles mute.
3973 // declared first so the slider-track MouseArea (later sibling,
3974 // higher z) wins on the track region; glyph/name Text items have
3975 // no MouseArea so their clicks fall through to here.
3989 // tap the device (glyph/name area) opens its options drawer;
3990 // the slider-track MouseArea (later sibling, higher z) wins on
3991 // the track region so dragging volume never opens the drawer.
39763992 MouseArea {
39773993 anchors.fill: parent
3978 acceptedButtons: Qt.LeftButton | Qt.MiddleButton
3979 onClicked: (event) => {
3980 if (event.button === Qt.MiddleButton)
3981 root.toggleMute(sinkRow.modelData.id);
3982 else
3983 root.selectSink(sinkRow.modelData.id);
3984 }
3994 onClicked: root.expandedSink = sinkRow.revealed ? "" : sinkRow.modelData.id
39873997 // left accent bar — only on the default device
4071 }
4081 }
4083 // device options drawer: set-default + mute. PipeWire
4084 // exposes no port/profile routing, so those aren't offered.
4085 Rectangle {
4086 visible: sinkRow.revealed
4087 width: parent.width
4088 height: visible ? sinkOpts.height + 16 : 0
4089 radius: 10
4090 color: root.theme ? root.theme.withAlpha(root.theme.ui.backdrop, 0.55) : "#333333"
4091 border.width: 1
4092 border.color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.4) : "white"
4093 clip: true
4095 Row {
4096 id: sinkOpts
4098 x: 12
4099 y: 8
4100 spacing: 8
4102 Rectangle {
4103 visible: !sinkRow.modelData.isDefault
4104 width: 110
4105 height: 28
4106 radius: 9
4107 color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.18) : "transparent"
4108 border.width: 1
4109 border.color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.7) : "white"
4111 NuguText {
4112 anchors.centerIn: parent
4113 theme: root.theme
4114 variant: "meta"
4115 text: "set default"
4116 }
4118 MouseArea {
4119 anchors.fill: parent
4120 onClicked: {
4121 root.expandedSink = "";
4122 root.selectSink(sinkRow.modelData.id);
4123 }
4124 }
4126 }
4128 Rectangle {
4129 width: 92
4130 height: 28
4131 radius: 9
4132 color: root.theme ? root.theme.withAlpha(sinkRow.modelData.muted ? root.theme.warning : root.theme.ui.accent, 0.18) : "transparent"
4133 border.width: 1
4134 border.color: root.theme ? root.theme.withAlpha(sinkRow.modelData.muted ? root.theme.warning : root.theme.ui.accent, 0.7) : "white"
4136 NuguText {
4137 anchors.centerIn: parent
4138 theme: root.theme
4139 variant: "meta"
4140 text: sinkRow.modelData.muted ? "unmute" : "mute"
4141 }
4143 MouseArea {
4144 anchors.fill: parent
4145 onClicked: root.toggleMute(sinkRow.modelData.id)
4146 }
4148 }
4150 }
40904171 text: "input"
4093 Flickable {
4174 Column {
40944175 width: parent.width
4095 height: Math.min(sourceListCol.height, 204)
4096 contentHeight: sourceListCol.height
4097 clip: true
4098 interactive: contentHeight > height
4099 boundsBehavior: Flickable.StopAtBounds
4176 spacing: 6
4101 Column {
4102 id: sourceListCol
4178 Repeater {
4179 model: root.sources
4104 width: parent.width
4105 spacing: 6
4181 delegate: Column {
4182 id: sourceRow
4107 Repeater {
4108 model: root.sources
4184 required property var modelData
4185 readonly property bool revealed: root.expandedSource === modelData.id
4110 delegate: Rectangle {
4111 id: sourceRow
4113 required property var modelData
4187 width: parent.width
4188 spacing: 4
4190 Rectangle {
41154191 width: parent.width
41164192 height: 48
41174193 radius: 12
41184194 color: root.theme ? root.theme.withAlpha(root.theme.ui.backdrop, sourceRow.modelData.isDefault ? 0.82 : 0.55) : "transparent"
4119 border.width: sourceRow.modelData.isDefault ? 2 : 1
4120 border.color: root.theme ? (sourceRow.modelData.isDefault ? root.theme.ui.accent : root.theme.withAlpha(root.theme.ui.minor, 0.45)) : "transparent"
4195 border.width: (sourceRow.modelData.isDefault || sourceRow.revealed) ? 2 : 1
4196 border.color: root.theme ? (sourceRow.modelData.isDefault ? root.theme.ui.accent : (sourceRow.revealed ? root.theme.withAlpha(root.theme.ui.accent, 0.6) : root.theme.withAlpha(root.theme.ui.minor, 0.45))) : "transparent"
41224198 MouseArea {
41234199 anchors.fill: parent
4124 acceptedButtons: Qt.LeftButton | Qt.MiddleButton
4125 onClicked: (event) => {
4126 if (event.button === Qt.MiddleButton)
4127 root.toggleMute(sourceRow.modelData.id);
4128 else
4129 root.selectSource(sourceRow.modelData.id);
4130 }
4200 onClicked: root.expandedSource = sourceRow.revealed ? "" : sourceRow.modelData.id
41334203 Rectangle {
4215 }
4285 }
4287 // device options drawer: set-default + mute. PipeWire
4288 // exposes no port/profile routing, so those aren't offered.
4289 Rectangle {
4290 visible: sourceRow.revealed
4291 width: parent.width
4292 height: visible ? sourceOpts.height + 16 : 0
4293 radius: 10
4294 color: root.theme ? root.theme.withAlpha(root.theme.ui.backdrop, 0.55) : "#333333"
4295 border.width: 1
4296 border.color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.4) : "white"
4297 clip: true
4299 Row {
4300 id: sourceOpts
4302 x: 12
4303 y: 8
4304 spacing: 8
4306 Rectangle {
4307 visible: !sourceRow.modelData.isDefault
4308 width: 110
4309 height: 28
4310 radius: 9
4311 color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.18) : "transparent"
4312 border.width: 1
4313 border.color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.7) : "white"
4315 NuguText {
4316 anchors.centerIn: parent
4317 theme: root.theme
4318 variant: "meta"
4319 text: "set default"
4320 }
4322 MouseArea {
4323 anchors.fill: parent
4324 onClicked: {
4325 root.expandedSource = "";
4326 root.selectSource(sourceRow.modelData.id);
4327 }
4328 }
4330 }
4332 Rectangle {
4333 width: 92
4334 height: 28
4335 radius: 9
4336 color: root.theme ? root.theme.withAlpha(sourceRow.modelData.muted ? root.theme.warning : root.theme.ui.accent, 0.18) : "transparent"
4337 border.width: 1
4338 border.color: root.theme ? root.theme.withAlpha(sourceRow.modelData.muted ? root.theme.warning : root.theme.ui.accent, 0.7) : "white"
4340 NuguText {
4341 anchors.centerIn: parent
4342 theme: root.theme
4343 variant: "meta"
4344 text: sourceRow.modelData.muted ? "unmute" : "mute"
4345 }
4347 MouseArea {
4348 anchors.fill: parent
4349 onClicked: root.toggleMute(sourceRow.modelData.id)
4350 }
4352 }
4354 }
42274372 component MediaPanel: Column {