nix

configuration files that power my machines
Log | Files | Refs | README | LICENSE

tempmenu (494B)


      1 #!/bin/bash
      2 set -euo pipefail
      3 
      4 choices=$(
      5 	echo "off"
      6 	seq 6000 -500 1000
      7 )
      8 chosen=$(printf '%s\n' "$choices" | dmenu "$@")
      9 [ -z "$chosen" ] && exit 0
     10 
     11 if [ "$chosen" != "off" ] && ! [[ "$chosen" =~ ^[0-9]+$ ]]; then
     12 	echo "Error: Invalid temperature '$chosen'" >&2
     13 	exit 1
     14 fi
     15 
     16 if [ -n "${WAYLAND_DISPLAY:-}" ]; then
     17 	pkill gammastep || true
     18 	if [ "$chosen" != "off" ]; then
     19 		gammastep -O "$chosen" &
     20 	fi
     21 else
     22 	if [ "$chosen" = "off" ]; then
     23 		redshift -x
     24 	else
     25 		redshift -O "$chosen"
     26 	fi
     27 fi