Created
July 19, 2024 17:00
-
-
Save jjwatt/197c8db66ecf802c9851cedfcf4df1b5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
: ${IDLE:=swayidle} | |
: ${YDOTOOL_SOCKET:=/tmp/.ydotool_socket} | |
stayawake() { | |
# Get screen dimensions using wlr-randr (for wlroots-based compositors) | |
# NOTE(jjwatt): Does not work on Plasma 5 Wayland | |
# read screenwidth screenheight << EOF | |
# $(wlr-randr | awk '/current/ {print $1, $3}' | tr 'x' ' ') | |
# EOF | |
# : ${screenwidth:=1920} | |
# : ${screenheight=1080} | |
"${IDLE}" -w timeout 5 \ | |
'ydotool mousemove 1920 1080' | |
} | |
# Make sure ydotool daemon is running | |
sudo pkill ydotoold | |
sudo ydotoold & | |
sudo chmod 777 "$YDOTOOL_SOCKET" | |
# Run the function | |
stayawake |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment