Skip to content

feat: change the volume with a slider when hovering the Sound widget - #158

Merged
M4n0x merged 1 commit into
mainfrom
feat/sound-hover-slider
Oct 21, 2026
Merged

M4n0x merged 1 commit into
mainfrom
feat/sound-hover-slider

Conversation

@M4n0x

@M4n0x M4n0x commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Follows #157, which made the Sound widget show only its icon at rest.

Problem

Changing the volume from the bar means reaching for the keyboard or the menu-bar Sound menu. The Sound widget only shows the volume.

Changes

  • Hover slider: hovering the Sound widget opens a volume slider beside its icon, with the volume, and closes it when the pointer leaves. It stays open while you drag.
  • Native volume: dragging sets the default output's volume through CoreAudio's virtual main volume as the slider moves, so it is live and keeps the balance. Above zero it unmutes, as the Sound menu's slider does. A device without a volume control gets no slider. A failure shows on the widget's error dot.
  • Side: on the right of the bar the widget grows to the left, so the slider opens to the icon's left and the icon stays under the pointer. Elsewhere it opens to the right.
  • Steady size: the slider is a line of text tall, so the widget keeps its height. The volume beside it is as wide as 100%, so dragging doesn't resize the widget. The width change as it opens and closes animates, as in feat: show the volume only for a moment after it changes #157.
  • Shared hover state: the open state is kept per display in the widget's presentation, so the bar's measuring copy sizes the widget with it. App menus that expand on hover already did this; their set is renamed expandedDisplays and shared.
  • Scope: only the Sound widget without a layout of its own, which is its default Display choice.
  • README: the Sound default layout and the audio source.

Surfaces: no configuration property, so the schema, decoders and Settings are unchanged.

Testing

  • swift test: 275 XCTest and 386 Swift Testing tests pass.
  • New test: the measuring copy draws the slider only on an expanded display, at the same height, never for a device without a volume control. It also checks that only the right of the bar opens before the icon.
  • Live check on a scratch bar with Bluetooth earbuds: hovering opens and closes the slider with the icon staying under the pointer. Screenshots and a recording are below.
  • Not checked live: dragging the slider. I checked the CoreAudio virtual main volume write separately on the same device.
  • Not checked: the slider inside a widget that also has onClick, open or a popup, which wrap it in a button.
At rest Hovered
slider-open slider-rest

Recording:
slider-hover

Merging

One commit, so any merge method keeps it.

Claude Opus 5.5 via Claude Code

Hovering the Sound widget opens a volume slider beside its icon, with
the volume, and closes it when the pointer leaves. Dragging sets the
volume through CoreAudio as it moves, keeps the balance and unmutes
above zero. On the right of the bar the slider opens to the icon's left,
so the icon stays under the pointer; elsewhere it opens to the right.

The slider is a line of text tall, so the widget keeps its height, and
the volume beside it is as wide as 100% so dragging doesn't move the
bar. The open state is kept per display in the widget's presentation,
which app menus that expand on hover now share, so the bar's measuring
copy sizes the widget with it.
@M4n0x
M4n0x requested a review from Seb-GRAF as a code owner October 21, 2026 14:29
@M4n0x
M4n0x merged commit 069fc26 into main Oct 21, 2026
8 checks passed
@M4n0x
M4n0x deleted the feat/sound-hover-slider branch October 21, 2026 14:43
@stablebar-releases

Copy link
Copy Markdown

🎉 This PR is included in version 0.6.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant