dotfiles/scripts/x11/s-x11-screen-standby
2025-09-09 00:23:03 -06:00

33 lines
653 B
Bash
Executable file

#!/bin/sh
# s-x11-screen-standby - set x11 screen standby time
#
# *SYNOPSIS*
# ```sh
# s-x11-screen-standby [seconds]
# ```
#
# *DESCRIPTION*
# Screen shuts off after specified time in seconds.
#
# *EXAMPLES*
# ```sh
# s-x11-screen-standby 3600 # 1h time-out to standby
# ```
# ```sh
# s-x11-screen-standby # No argument, brings up menu
# ```
if [ -n "$1" ]; then
xset dpms "$1"
fi
opts="0=none 900=15min 1800=30min 3600=1h 7200=2h 14400=4h 28800=8h 43200=12h 86400=24h"
time="$(for o in $opts; do
printf '%s\n' "$o"
done | menu 'dmenu' 'x11 screen standby time (seconds)')"
time="${time%%=*}"
if [ "$time" != "" ]; then
xset dpms "$time"
fi