feat: setup screen for hyprland
This commit is contained in:
31
setup_screen_hypr.sh
Executable file
31
setup_screen_hypr.sh
Executable 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
|
||||||
Reference in New Issue
Block a user