feat(hypr): update monitor configuration and lid behavior
This commit is contained in:
40
hypr/scripts/lid.sh
Executable file
40
hypr/scripts/lid.sh
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ACTION="${1:-}" # "on" oder "off"
|
||||
LAPTOP="eDP-1"
|
||||
LAPTOP_MODE="2256x1504"
|
||||
LAPTOP_SCALE="1.175"
|
||||
|
||||
has_external() {
|
||||
hyprctl monitors | awk '/^Monitor /{print $2}' | grep -vq "^${LAPTOP}$"
|
||||
}
|
||||
|
||||
enable_laptop() {
|
||||
hyprctl keyword monitor "${LAPTOP}, ${LAPTOP_MODE}, 0x0, ${LAPTOP_SCALE}"
|
||||
hyprctl dispatch dpms on "${LAPTOP}" 2>/dev/null || true
|
||||
}
|
||||
|
||||
disable_laptop() {
|
||||
hyprctl keyword monitor "${LAPTOP}, disable"
|
||||
}
|
||||
|
||||
case "$ACTION" in
|
||||
off)
|
||||
if has_external; then
|
||||
disable_laptop
|
||||
else
|
||||
disable_laptop
|
||||
hyprlock
|
||||
fi
|
||||
;;
|
||||
|
||||
on)
|
||||
enable_laptop
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "usage: $0 {on|off}" >&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user