feat: setup screen for hyprland

This commit is contained in:
2025-11-28 22:01:37 +01:00
parent 3a9ef6270c
commit db2290048e

31
setup_screen_hypr.sh Executable file
View File

@@ -0,0 +1,31 @@
#!/bin/bash
set -eu
handle() {
case $1 in
monitoradded*)
disable_integrated_display_if_connected_to_external_monitors
;;
monitorremoved*)
disable_integrated_display_if_connected_to_external_monitors
;;
esac
}
disable_integrated_display_if_connected_to_external_monitors() {
MONITORS=$(hyprctl monitors all -j | jq ".[] | {name: .name, mode: .availableModes[0]}")
NUMBER_OF_MONITORS=$(echo "$MONITORS" | grep -c "name")
if [ "$NUMBER_OF_MONITORS" -gt 1 ]; then
hyprctl keyword monitor eDP-1, disabled
else
hyprctl keyword monitor eDP-1, highres highrr, auto, 1
fi
pkill waybar || true
waybar
}
disable_integrated_display_if_connected_to_external_monitors
socat -U - "UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock" | while read -r line; do handle "$line"; done