diff --git a/.config/hypr/bindings.conf b/.config/hypr/bindings.conf index 4ee9a8d..88497ed 100644 --- a/.config/hypr/bindings.conf +++ b/.config/hypr/bindings.conf @@ -2,30 +2,30 @@ # Media # ========================== # Only display the OSD on the currently focused monitor -# $osdclient = swayosd-client --monitor "$(hyprctl monitors -j | jq -r '.[] | select(.focused == true).name')" +$osdclient = swayosd-client --monitor "$(hyprctl monitors -j | jq -r '.[] | select(.focused == true).name')" # 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 = ,XF86AudioMicMute, Mute microphone, exec, $osdclient --input-volume mute-toggle -# bindeld = ,XF86MonBrightnessUp, Brightness up, exec, omarchy-brightness-display +5% -# bindeld = ,XF86MonBrightnessDown, Brightness down, exec, omarchy-brightness-display 5%- -# bindeld = ,XF86KbdBrightnessUp, Keyboard brightness up, exec, omarchy-brightness-keyboard up -# bindeld = ,XF86KbdBrightnessDown, Keyboard brightness down, exec, omarchy-brightness-keyboard down -# bindld = ,XF86KbdLightOnOff, Keyboard backlight cycle, exec, omarchy-brightness-keyboard cycle +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 = ,XF86AudioMicMute, Mute microphone, exec, $osdclient --input-volume mute-toggle +bindeld = ,XF86MonBrightnessUp, Brightness up, exec, station-brightness-display +5% +bindeld = ,XF86MonBrightnessDown, Brightness down, exec, station-brightness-display 5%- +bindeld = ,XF86KbdBrightnessUp, Keyboard brightness up, exec, station-brightness-keyboard up +bindeld = ,XF86KbdBrightnessDown, Keyboard brightness down, exec, station-brightness-keyboard down +bindld = ,XF86KbdLightOnOff, Keyboard backlight cycle, exec, station-brightness-keyboard cycle # 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, $osdclient --output-volume +1 +bindeld = ALT, XF86AudioLowerVolume, Volume down precise, exec, $osdclient --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, $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 # Switch audio output with Super + Mute # bindld = SUPER, XF86AudioMute, Switch audio output, exec, omarchy-cmd-audio-switch diff --git a/.local/bin/station-brightness-display b/.local/bin/station-brightness-display new file mode 100755 index 0000000..a54505e --- /dev/null +++ b/.local/bin/station-brightness-display @@ -0,0 +1,21 @@ +#!/bin/bash + +# Adjust brightness on the most likely display device. +# Usage: station-brightness-display + +step="${1:-+5%}" + +# Start with the first possible output, then refine to the most likely given an order heuristic. +device="$(ls -1 /sys/class/backlight 2>/dev/null | head -n1)" +for candidate in amdgpu_bl* intel_backlight acpi_video*; do + if [[ -e /sys/class/backlight/$candidate ]]; then + device="$candidate" + break + fi +done + +# Set the actual brightness of the display device. +brightnessctl -d "$device" set "$step" >/dev/null + +# Use SwayOSD to display the new brightness setting. +station-swayosd-brightness "$(brightnessctl -d "$device" -m | cut -d',' -f4 | tr -d '%')" diff --git a/.local/bin/station-brightness-keyboard b/.local/bin/station-brightness-keyboard new file mode 100755 index 0000000..e3e5788 --- /dev/null +++ b/.local/bin/station-brightness-keyboard @@ -0,0 +1,42 @@ +#!/bin/bash + +# Adjust keyboard backlight brightness using available steps. +# Usage: omarchy-brightness-keyboard + +direction="${1:-up}" + +# Find keyboard backlight device (look for *kbd_backlight* pattern in leds class). +device="" +for candidate in /sys/class/leds/*kbd_backlight*; do + if [[ -e $candidate ]]; then + device="$(basename "$candidate")" + break + fi +done + +if [[ -z $device ]]; then + echo "No keyboard backlight device found" >&2 + exit 1 +fi + +# Get current and max brightness to determine step size. +max_brightness="$(brightnessctl -d "$device" max)" +current_brightness="$(brightnessctl -d "$device" get)" + +# Calculate step as one unit (keyboards typically have discrete levels like 0-3). +if [[ $direction == "cycle" ]]; then + new_brightness=$(( (current_brightness + 1) % (max_brightness + 1) )) +elif [[ $direction == "up" ]]; then + new_brightness=$((current_brightness + 1)) + (( new_brightness > max_brightness )) && new_brightness=$max_brightness +else + new_brightness=$((current_brightness - 1)) + (( new_brightness < 0 )) && new_brightness=0 +fi + +# Set the new brightness. +brightnessctl -d "$device" set "$new_brightness" >/dev/null + +# Use SwayOSD to display the new brightness setting. +percent=$((new_brightness * 100 / max_brightness)) +station-swayosd-kbd-brightness "$percent" diff --git a/.local/bin/station-swayosd-brightness b/.local/bin/station-swayosd-brightness new file mode 100755 index 0000000..9b26936 --- /dev/null +++ b/.local/bin/station-swayosd-brightness @@ -0,0 +1,15 @@ +#!/bin/bash + +# Display brightness level using SwayOSD on the current monitor. +# Usage: station-swayosd-brightness + +percent="$1" + +progress="$(awk -v p="$percent" 'BEGIN{printf "%.2f", p/100}')" +[[ $progress == "0.00" ]] && progress="0.01" + +swayosd-client \ + --monitor "$(hyprctl monitors -j | jq -r '.[]|select(.focused==true).name')" \ + --custom-icon display-brightness \ + --custom-progress "$progress" \ + --custom-progress-text "${percent}%" diff --git a/.local/bin/station-swayosd-kbd-brightness b/.local/bin/station-swayosd-kbd-brightness new file mode 100755 index 0000000..59ba5d5 --- /dev/null +++ b/.local/bin/station-swayosd-kbd-brightness @@ -0,0 +1,15 @@ +#!/bin/bash + +# Display keyboard brightness level using SwayOSD on the current monitor. +# Usage: station-swayosd-kbd-brightness + +percent="$1" + +progress="$(awk -v p="$percent" 'BEGIN{printf "%.2f", p/100}')" +[[ $progress == "0.00" ]] && progress="0.01" + +swayosd-client \ + --monitor "$(hyprctl monitors -j | jq -r '.[]|select(.focused==true).name')" \ + --custom-icon keyboard-brightness \ + --custom-progress "$progress" \ + --custom-progress-text "${percent}%"