Skip to content

Unmute when adjusting volume from the volume keys#5942

Closed
Pegorim wants to merge 1 commit into
basecamp:masterfrom
Pegorim:volume-keys-unmute
Closed

Unmute when adjusting volume from the volume keys#5942
Pegorim wants to merge 1 commit into
basecamp:masterfrom
Pegorim:volume-keys-unmute

Conversation

@Pegorim
Copy link
Copy Markdown
Contributor

@Pegorim Pegorim commented May 22, 2026

Problem

The laptop volume keys are bound to:

bindeld = ,XF86AudioRaiseVolume, Volume up,   exec, omarchy-swayosd-client --output-volume raise
bindeld = ,XF86AudioLowerVolume, Volume down, exec, omarchy-swayosd-client --output-volume lower

swayosd-client --output-volume raise/lower changes the sink's volume level but leaves the mute flag untouched. So when the machine is muted (e.g. you pressed XF86AudioMute), pressing volume up/down does nothing audible — the level changes behind a still-set mute flag.

To actually get sound back you have to press mute first, then adjust. That extra step doesn't match how volume keys behave on macOS/Windows/GNOME/KDE, where nudging the volume up or down also unmutes.

Fix

Add bin/omarchy-audio-output-volume, a small wrapper that clears the mute flag before delegating the raise/lower to swayosd:

wpctl set-mute @DEFAULT_AUDIO_SINK@ 0 >/dev/null 2>&1
omarchy-swayosd-client --output-volume "$1"

Because swayosd reads the sink state when it renders, the OSD still pops up and correctly shows the new, unmuted level. set-mute … 0 is idempotent, so when you're already unmuted it's a no-op and normal volume changes behave exactly as before.

default/hypr/bindings/media.conf now points the volume up/down keys — and their ALT precise (+1/-1) variants — at the wrapper. Mute-toggle is intentionally left on omarchy-swayosd-client --output-volume mute-toggle so it keeps toggling rather than unconditionally unmuting.

This follows the existing convention of small dedicated omarchy-* audio scripts (omarchy-audio-input-mute, omarchy-audio-output-switch).

Testing

On a Zenbook S14 (PipeWire/WirePlumber):

$ wpctl set-mute @DEFAULT_AUDIO_SINK@ 1
$ wpctl get-volume @DEFAULT_AUDIO_SINK@
Volume: 0.50 [MUTED]
$ omarchy-audio-output-volume raise
$ wpctl get-volume @DEFAULT_AUDIO_SINK@
Volume: 0.55          # unmuted and raised in one press; OSD shown
  • Volume up/down while muted → unmutes and adjusts, single keypress.
  • Volume up/down while already unmuted → unchanged behavior.
  • Mute-toggle (XF86AudioMute) → unchanged.

The volume up/down keys run swayosd-client --output-volume raise/lower,
which changes the level but leaves the sink's mute flag set. So on a muted
laptop the keys appear to do nothing — the user has to press mute first and
then adjust, an extra step that doesn't match how volume keys behave on
other desktops.

Add omarchy-audio-output-volume, which clears the mute flag before handing
the raise/lower off to swayosd (so the OSD still shows the new, unmuted
level), and point the volume keys and their ALT precise variants at it.
Mute-toggle is unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 22, 2026 13:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates Hyprland media key bindings to use a new helper that first unmutes the default sink, so volume up/down keys recover from a muted output in a single keypress while still showing OSD.

Changes:

  • Replace direct omarchy-swayosd-client --output-volume raise/lower bindings with omarchy-audio-output-volume for coarse and precise volume changes
  • Add bin/omarchy-audio-output-volume wrapper that clears mute via wpctl before delegating to omarchy-swayosd-client

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.

File Description
default/hypr/bindings/media.conf Routes volume up/down (and ALT precise variants) through the new unmute+OSD helper.
bin/omarchy-audio-output-volume Adds a small script that unmutes the default sink before adjusting volume with OSD.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

dhh added a commit that referenced this pull request May 22, 2026
Closes #5942
Co-authored-by: @Pegrorim
@dhh dhh closed this May 22, 2026
@dhh
Copy link
Copy Markdown
Member

dhh commented May 22, 2026

Fixed on omarchy-shell (Omarchy 4).

@Pegorim
Copy link
Copy Markdown
Contributor Author

Pegorim commented May 22, 2026

Thanks

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants