31 lines
788 B
Bash
Executable File
31 lines
788 B
Bash
Executable File
#!/bin/zsh
|
|
# This script puts the monitors to sleep via dpms.
|
|
# Sth in hyprland crashes and creates high gpu usage, if hyprpaper is running
|
|
# when a monitor is being turned off and on again.
|
|
# Therefore, we kill hyprpaper when turning the monitor off and start it again when turning it on.
|
|
|
|
export STATUS_FILE="$XDG_RUNTIME_DIR/display.status"
|
|
|
|
enable_display() {
|
|
printf "true" >"$STATUS_FILE"
|
|
hyprctl dispatch dpms on
|
|
sleep 1
|
|
exec hyprpaper
|
|
}
|
|
|
|
disable_display() {
|
|
killall hyprpaper
|
|
printf "false" >"$STATUS_FILE"
|
|
hyprctl dispatch dpms off
|
|
}
|
|
|
|
if ! [ -f "$STATUS_FILE" ]; then
|
|
disable_display
|
|
else
|
|
if [ $(cat "$STATUS_FILE") = "true" ]; then
|
|
disable_display
|
|
elif [ $(cat "$STATUS_FILE") = "false" ]; then
|
|
enable_display
|
|
fi
|
|
fi
|