mirror of
https://github.com/Nexoniarz/nexoniarz-config-nixos.git
synced 2026-11-03 04:24:27 +00:00
- Add Osd.qml: themed top-center popup for volume/mic/brightness/media changes. Volume and mic react directly to Pipewire so they fire for any change, not just our own keybinds; brightness is notified explicitly (no live service exists for DDC/CI writes); media is driven by two playerctl --follow watchers (status + metadata) so track changes, pause/resume, and stop all show correctly without double-firing - Add Super+Shift+Z/X to toggle the Left/RightBar sidebars, via a new Quickshell IpcHandler wired to the same expand/collapse logic as the BottomBar arrows - Add function-key binds for volume up/down/mute, mic mute, brightness up/down, and media play/pause/stop/next/prev (wpctl/playerctl); extend brightness-ctl with relative up/down steps for both the backlight and DDC/CI paths - Add gh and playerctl to packages
56 lines
1.9 KiB
Shell
Executable file
56 lines
1.9 KiB
Shell
Executable file
#!/usr/bin/env bash
|
|
# Brightness control abstraction: prefers the kernel backlight class (laptop
|
|
# panels, via brightnessctl); falls back to DDC/CI over I2C (external
|
|
# monitors, via ddcutil) when no backlight device exists. Keeps the rest of
|
|
# the config (Quickshell's brightness popup) hardware-agnostic.
|
|
set -euo pipefail
|
|
|
|
has_backlight() {
|
|
[ -n "$(ls -A /sys/class/backlight 2>/dev/null)" ]
|
|
}
|
|
|
|
case "${1:-get}" in
|
|
get)
|
|
if has_backlight; then
|
|
brightnessctl -m | cut -d, -f4 | tr -d '%'
|
|
else
|
|
ddcutil getvcp 10 --brief 2>/dev/null | awk '{print $4}'
|
|
fi
|
|
;;
|
|
set)
|
|
pct="${2:?usage: brightness-ctl set <0-100>}"
|
|
if has_backlight; then
|
|
brightnessctl set "${pct}%" > /dev/null
|
|
else
|
|
ddcutil setvcp 10 "$pct" > /dev/null
|
|
fi
|
|
;;
|
|
up|down)
|
|
# brightnessctl takes a relative step directly, but ddcutil's
|
|
# setvcp only takes an absolute value — so the DDC/CI path (this
|
|
# machine's AOC 27G2G8 has no backlight device, so it always takes
|
|
# this path) has to read the current level and clamp the step
|
|
# itself.
|
|
step="${2:-5}"
|
|
if has_backlight; then
|
|
if [ "$1" = "up" ]; then
|
|
brightnessctl set "+${step}%" > /dev/null
|
|
else
|
|
brightnessctl set "${step}%-" > /dev/null
|
|
fi
|
|
else
|
|
cur=$(ddcutil getvcp 10 --brief 2>/dev/null | awk '{print $4}')
|
|
cur="${cur:-50}"
|
|
if [ "$1" = "up" ]; then
|
|
new=$(( cur + step > 100 ? 100 : cur + step ))
|
|
else
|
|
new=$(( cur - step < 0 ? 0 : cur - step ))
|
|
fi
|
|
ddcutil setvcp 10 "$new" > /dev/null
|
|
fi
|
|
;;
|
|
*)
|
|
echo "usage: brightness-ctl [get|set <0-100>|up [step]|down [step]]" >&2
|
|
exit 1
|
|
;;
|
|
esac
|