From 7b99932299ab27249e784ebd9f1f64f755b8f917 Mon Sep 17 00:00:00 2001 From: Jeena Date: Thu, 14 May 2026 12:03:43 +0000 Subject: [PATCH 1/3] feat: add wob overlay for volume and brightness keys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move FIFO setup and percentage emission into helper scripts so the Hyprland config has no raw $VAR references — Hyprland's parser substitutes $varname at parse time, which mangled awk's $2 and $HYPRLAND_INSTANCE_SIGNATURE and left binds broken after reload. Co-Authored-By: Claude Opus 4.7 (1M context) --- hypr/autostart.conf | 1 + hypr/hyprland.conf | 8 ++++---- hypr/scripts/wob-brightness.sh | 17 +++++++++++++++++ hypr/scripts/wob-daemon.sh | 14 ++++++++++++++ hypr/scripts/wob-volume.sh | 15 +++++++++++++++ 5 files changed, 51 insertions(+), 4 deletions(-) create mode 100755 hypr/scripts/wob-brightness.sh create mode 100755 hypr/scripts/wob-daemon.sh create mode 100755 hypr/scripts/wob-volume.sh diff --git a/hypr/autostart.conf b/hypr/autostart.conf index fb8287d..4f2da34 100644 --- a/hypr/autostart.conf +++ b/hypr/autostart.conf @@ -1,4 +1,5 @@ exec-once = fcitx5 +exec-once = ~/.config/hypr/scripts/wob-daemon.sh exec-once = [workspace 1 silent] $browser exec-once = [workspace 2 silent] thunderbird exec-once = [workspace 2 silent] element-desktop diff --git a/hypr/hyprland.conf b/hypr/hyprland.conf index 6d83c16..8874816 100644 --- a/hypr/hyprland.conf +++ b/hypr/hyprland.conf @@ -282,12 +282,12 @@ bindd = SUPER SHIFT, up, Swap window up, swapwindow, u bindd = SUPER SHIFT, down, Swap window down, swapwindow, d # Laptop multimedia keys for volume and LCD brightness -bindel = ,XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+ -bindel = ,XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- +bindel = ,XF86AudioRaiseVolume, exec, ~/.config/hypr/scripts/wob-volume.sh up +bindel = ,XF86AudioLowerVolume, exec, ~/.config/hypr/scripts/wob-volume.sh down bindel = ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle bindel = ,XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle -bindel = ,XF86MonBrightnessUp, exec, brightnessctl -e4 -n2 set 5%+ -bindel = ,XF86MonBrightnessDown, exec, brightnessctl -e4 -n2 set 5%- +bindel = ,XF86MonBrightnessUp, exec, ~/.config/hypr/scripts/wob-brightness.sh up +bindel = ,XF86MonBrightnessDown, exec, ~/.config/hypr/scripts/wob-brightness.sh down # Requires playerctl bindl = , XF86AudioNext, exec, playerctl next diff --git a/hypr/scripts/wob-brightness.sh b/hypr/scripts/wob-brightness.sh new file mode 100755 index 0000000..438ad3d --- /dev/null +++ b/hypr/scripts/wob-brightness.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +# Adjust backlight and emit current percentage to the wob overlay FIFO. +# Usage: wob-brightness.sh up|down + +set -u + +case "${1:-}" in + up) brightnessctl -e4 -n2 set 5%+ >/dev/null ;; + down) brightnessctl -e4 -n2 set 5%- >/dev/null ;; + *) echo "usage: $0 up|down" >&2; exit 2 ;; +esac + +fifo="${XDG_RUNTIME_DIR:-/tmp}/hypr-wob.${HYPRLAND_INSTANCE_SIGNATURE:-default}" +[[ -p "$fifo" ]] || exit 0 +current=$(brightnessctl get) +max=$(brightnessctl max) +awk -v c="$current" -v m="$max" 'BEGIN { printf "%d\n", (c/m)*100 }' > "$fifo" diff --git a/hypr/scripts/wob-daemon.sh b/hypr/scripts/wob-daemon.sh new file mode 100755 index 0000000..5adfbd0 --- /dev/null +++ b/hypr/scripts/wob-daemon.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +# Run by Hyprland exec-once. Creates a per-instance FIFO and pipes it to wob +# so volume/brightness binds can show an on-screen overlay. + +set -u + +command -v wob >/dev/null 2>&1 || exit 0 + +fifo="${XDG_RUNTIME_DIR:-/tmp}/hypr-wob.${HYPRLAND_INSTANCE_SIGNATURE:-default}" +rm -f "$fifo" +mkfifo "$fifo" +trap 'rm -f "$fifo"' EXIT + +tail -f "$fifo" | wob diff --git a/hypr/scripts/wob-volume.sh b/hypr/scripts/wob-volume.sh new file mode 100755 index 0000000..cd0b27e --- /dev/null +++ b/hypr/scripts/wob-volume.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +# Adjust volume and emit current percentage to the wob overlay FIFO. +# Usage: wob-volume.sh up|down + +set -u + +case "${1:-}" in + up) wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+ ;; + down) wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- ;; + *) echo "usage: $0 up|down" >&2; exit 2 ;; +esac + +fifo="${XDG_RUNTIME_DIR:-/tmp}/hypr-wob.${HYPRLAND_INSTANCE_SIGNATURE:-default}" +[[ -p "$fifo" ]] || exit 0 +wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{printf "%d\n", $2*100}' > "$fifo" From 8ac4023dc1c2a1d2725e542f9893733857dafdec Mon Sep 17 00:00:00 2001 From: Jeena Date: Thu, 14 May 2026 12:30:50 +0000 Subject: [PATCH 2/3] fix: capture active monitor in screenshot bind instead of hardcoded DP-1 Ctrl+Print was tied to DP-1, so it failed on the laptop alone or with a different external. Using -m active picks the currently focused output, so the same bind works on any host. Co-Authored-By: Claude Opus 4.7 (1M context) --- hypr/keybindings.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hypr/keybindings.conf b/hypr/keybindings.conf index 6217f8e..3eb362a 100644 --- a/hypr/keybindings.conf +++ b/hypr/keybindings.conf @@ -12,7 +12,7 @@ bind = $mainMod, J, togglesplit, # dwindle bind = $mainMod, F, fullscreen # Screenshot -bind = CTRL, PRINT, exec, hyprshot -m output -m DP-1 +bind = CTRL, PRINT, exec, hyprshot -m active -m output bind = , PRINT, exec, hyprshot -m window bind = SHIFT, PRINT, exec, hyprshot -m region From ebea0fd6ecf2660e0dc74c01aa6f09b4345d8e3c Mon Sep 17 00:00:00 2001 From: Jeena Date: Thu, 14 May 2026 12:44:11 +0000 Subject: [PATCH 3/3] feat: add mirror-display toggle to launch menu Adds a "Mirror Display" entry that calls a helper script which finds the first connected non-internal monitor and toggles mirroring of eDP-1 onto it via hyprctl. Use case: plugging into a conference room TV/projector while travelling. Also fixes the menu's "Screenshot full" entry to capture the active output instead of the hardcoded DP-1, matching the equivalent fix to the Ctrl+Print keybind. Co-Authored-By: Claude Opus 4.7 (1M context) --- hypr/menu.list | 3 ++- hypr/scripts/monitor-mirror.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100755 hypr/scripts/monitor-mirror.sh diff --git a/hypr/menu.list b/hypr/menu.list index 98e563d..8bcf1e1 100644 --- a/hypr/menu.list +++ b/hypr/menu.list @@ -1,7 +1,8 @@ -Screenshot full=hyprshot -m output -m DP-1 +Screenshot full=hyprshot -m active -m output Screenshot window=hyprshot -m window Screenshot region=hyprshot -m region Color Picker=hyprpicker --autocopy Hypertension=xdg-open ~/Documents/Private-Documents/High-Blood-Preassure-test-results.ods Emoji Picker=~/.config/hypr/scripts/emoji-picker.py Shortcuts=~/.config/hypr/scripts/cheatsheet.py ~/.config/hypr/shortcuts.txt +Mirror Display=~/.config/hypr/scripts/monitor-mirror.sh diff --git a/hypr/scripts/monitor-mirror.sh b/hypr/scripts/monitor-mirror.sh new file mode 100755 index 0000000..72e4ed1 --- /dev/null +++ b/hypr/scripts/monitor-mirror.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +# Toggle: mirror the internal display to the first connected external monitor. +# Travel use case — plug into a conference room TV/projector via HDMI, press +# the bound key, and the external mirrors the laptop. Press again to revert +# to the host's default monitor layout (via hyprctl reload). + +set -u + +internal="eDP-1" + +external=$(hyprctl monitors -j | jq -r ".[] | select(.name != \"$internal\") | .name" | head -n1) + +if [[ -z "$external" ]]; then + notify-send "Mirror" "No external display connected" + exit 0 +fi + +mirror_of=$(hyprctl monitors -j | jq -r ".[] | select(.name == \"$external\") | .mirrorOf // \"\"") + +if [[ -n "$mirror_of" ]]; then + hyprctl reload + notify-send "Mirror" "Off — reverted to default layout" +else + hyprctl keyword monitor "$external,preferred,auto,1,mirror,$internal" + notify-send "Mirror" "On — $internal → $external" +fi