Extract omarchy-swayosd-client

So we don't have to manually compose it every time
This commit is contained in:
David Heinemeier Hansson
2026-04-22 13:04:30 +02:00
parent ed9ecccb21
commit edf7067797
8 changed files with 20 additions and 27 deletions
+2 -7
View File
@@ -2,15 +2,11 @@
# Switch between audio outputs while preserving the mute status. By default mapped to Super + Mute.
focused_monitor=$(omarchy-hyprland-monitor-focused)
sinks=$(pactl -f json list sinks | jq '[.[] | select((.ports | length == 0) or ([.ports[]? | .availability != "not available"] | any))]')
sinks_count=$(echo "$sinks" | jq '. | length')
if (( sinks_count == 0 )); then
swayosd-client \
--monitor "$focused_monitor" \
--custom-message "No audio devices found"
omarchy-swayosd-client --custom-message "No audio devices found"
exit 1
fi
@@ -60,7 +56,6 @@ if [[ $next_sink_name != $current_sink_name ]]; then
pactl set-default-sink "$next_sink_name"
fi
swayosd-client \
--monitor "$focused_monitor" \
omarchy-swayosd-client \
--custom-message "$next_sink_description" \
--custom-icon "$next_sink_volume_icon"
+1 -1
View File
@@ -5,5 +5,5 @@
if omarchy-hw-match "XPS"; then
omarchy-cmd-mic-mute-xps
else
swayosd-client --monitor "$(omarchy-hyprland-monitor-focused)" --input-volume mute-toggle
omarchy-swayosd-client --input-volume mute-toggle
fi
+1 -2
View File
@@ -38,7 +38,6 @@ if [[ -e /sys/class/leds/platform::micmute/brightness ]]; then
done
fi
swayosd-client \
--monitor "$(omarchy-hyprland-monitor-focused)" \
omarchy-swayosd-client \
--custom-message "$osd_message" \
--custom-icon "$osd_icon"
+1 -2
View File
@@ -8,8 +8,7 @@ percent="$1"
progress="$(awk -v p="$percent" 'BEGIN{printf "%.2f", p/100}')"
[[ $progress == "0.00" ]] && progress="0.01"
swayosd-client \
--monitor "$(omarchy-hyprland-monitor-focused)" \
omarchy-swayosd-client \
--custom-icon display-brightness \
--custom-progress "$progress" \
--custom-progress-text "${percent}%"
+5
View File
@@ -0,0 +1,5 @@
#!/bin/bash
# Wrapper for swayosd-client that targets the currently focused monitor.
exec swayosd-client --monitor "$(omarchy-hyprland-monitor-focused)" "$@"
+1 -2
View File
@@ -8,8 +8,7 @@ percent="$1"
progress="$(awk -v p="$percent" 'BEGIN{printf "%.2f", p/100}')"
[[ $progress == "0.00" ]] && progress="0.01"
swayosd-client \
--monitor "$(omarchy-hyprland-monitor-focused)" \
omarchy-swayosd-client \
--custom-icon keyboard-brightness \
--custom-progress "$progress" \
--custom-progress-text "${percent}%"
-1
View File
@@ -1,7 +1,6 @@
#!/bin/bash
STATE_CONF="$HOME/.local/state/omarchy/toggles/hypr/touchpad-disabled.conf"
osdclient="swayosd-client --monitor $(omarchy-hyprland-monitor-focused)"
device="$(omarchy-hw-touchpad)"
+9 -12
View File
@@ -1,10 +1,7 @@
# Only display the OSD on the currently focused monitor
$osdclient = swayosd-client --monitor "$(omarchy-hyprland-monitor-focused)"
# Laptop multimedia keys for volume and LCD brightness (with OSD)
bindeld = ,XF86AudioRaiseVolume, Volume up, exec, $osdclient --output-volume raise
bindeld = ,XF86AudioLowerVolume, Volume down, exec, $osdclient --output-volume lower
bindeld = ,XF86AudioMute, Mute, exec, $osdclient --output-volume mute-toggle
bindeld = ,XF86AudioRaiseVolume, Volume up, exec, omarchy-swayosd-client --output-volume raise
bindeld = ,XF86AudioLowerVolume, Volume down, exec, omarchy-swayosd-client --output-volume lower
bindeld = ,XF86AudioMute, Mute, exec, omarchy-swayosd-client --output-volume mute-toggle
bindeld = ,XF86AudioMicMute, Mute microphone, exec, omarchy-cmd-mic-mute
bindeld = ,XF86MonBrightnessUp, Brightness up, exec, omarchy-brightness-display +5%
bindeld = ,XF86MonBrightnessDown, Brightness down, exec, omarchy-brightness-display 5%-
@@ -16,16 +13,16 @@ bindld = ,XF86TouchpadOn, Enable touchpad, exec, omarchy-toggle-touchpad on
bindld = ,XF86TouchpadOff, Disable touchpad, exec, omarchy-toggle-touchpad off
# Precise 1% multimedia adjustments with Alt modifier
bindeld = ALT, XF86AudioRaiseVolume, Volume up precise, exec, $osdclient --output-volume +1
bindeld = ALT, XF86AudioLowerVolume, Volume down precise, exec, $osdclient --output-volume -1
bindeld = ALT, XF86AudioRaiseVolume, Volume up precise, exec, omarchy-swayosd-client --output-volume +1
bindeld = ALT, XF86AudioLowerVolume, Volume down precise, exec, omarchy-swayosd-client --output-volume -1
bindeld = ALT, XF86MonBrightnessUp, Brightness up precise, exec, omarchy-brightness-display +1%
bindeld = ALT, XF86MonBrightnessDown, Brightness down precise, exec, omarchy-brightness-display 1%-
# Requires playerctl
bindld = , XF86AudioNext, Next track, exec, $osdclient --playerctl next
bindld = , XF86AudioPause, Pause, exec, $osdclient --playerctl play-pause
bindld = , XF86AudioPlay, Play, exec, $osdclient --playerctl play-pause
bindld = , XF86AudioPrev, Previous track, exec, $osdclient --playerctl previous
bindld = , XF86AudioNext, Next track, exec, omarchy-swayosd-client --playerctl next
bindld = , XF86AudioPause, Pause, exec, omarchy-swayosd-client --playerctl play-pause
bindld = , XF86AudioPlay, Play, exec, omarchy-swayosd-client --playerctl play-pause
bindld = , XF86AudioPrev, Previous track, exec, omarchy-swayosd-client --playerctl previous
# Switch audio output with Super + Mute
bindld = SUPER, XF86AudioMute, Switch audio output, exec, omarchy-cmd-audio-switch