Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion settings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ displaysettings() {
menu ':b Autodetect monitor docking'
menu ':b External screen'
menu ':b HiDPI'
menu ':b 累Change refresh rate'
menu ':b Keep screen on when locked'

CHOICE="$({
Expand All @@ -392,7 +393,7 @@ displaysettings() {
echo ':b Back'
} | sidebar)"
case $CHOICE in
*settings)
*display*)
arandr &
;;
*brightness)
Expand Down Expand Up @@ -436,6 +437,17 @@ displaysettings() {
instantdpi
xrdb ~/.Xresources
;;
*refresh*)
REFRESH=$(imenu -i 'enter refresh rate (default is 60)')
[ -z "$REFRESH" ] && return

xrandr -r "$REFRESH" && {
confirm 10 'confirm refresh rate? (timeout after 10 seconds)' || xrandr -r 60
} || {
imenu -e "unable to set ${REFRESH}Hz refresh rate"
}
displaysettings
;;
*locked)
toggleiconf nolocktimeout "keep monitor on when the screen is locked?"
displaysettings
Expand Down
8 changes: 8 additions & 0 deletions utils/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,11 @@ list_users() {
# list real human users (uid above 1000, not 'nobody')
awk -F: '$3 >= 1000 && $1 != "nobody" {print $1}' /etc/passwd
}

timeout() { imenu -m "$2" | $(read -t $1 || echo pkill instantmenu); }

confirm() {
result=$(timeout "${1:-5}" "${2:-timeout}" 2>&1)
[ "$result" = 'Terminated' ] && return 1 || return 0
}