diff --git a/bin/displayctl b/bin/displayctl index a42c53c..85c6c7b 100755 --- a/bin/displayctl +++ b/bin/displayctl @@ -1,20 +1,36 @@ #!/bin/sh # unused for now, repurposing for ddcutil control -#DISPLAY_STATUS=$(xrandr | grep DP-2) -# -#if [ "$DISPLAY_STATUS" = *"1440x3440"* ]; then -# xrandr --output DP-2 --off -#else -# init_displays -#fi +## back in use! -CHOICE=$(printf "brightness\ncontrast" | dmenu -c -i -l 2) -VALUE=$(printf "0\n10\n20\n30\n40\n50\n60\n70\n80\n90\n100" | dmenu -c -i -p "value to set") +CHOICE=$(printf "brightness\ncontrast\ntoggle secondary display" | dmenu -c -i -l 3) +DISPLAY_STATUS=$(xrandr | grep DisplayPort-0) +MONITORS="1 2" + +toggle() { + case $DISPLAY_STATUS in + *3440x1440*) + xrandr --output DisplayPort-0 --off;; + *) + init_displays;; + esac +} + +get_value() { + VALUE=$(printf "0\n10\n20\n30\n40\n50\n60\n70\n80\n90\n100" | dmenu -c -i -p "value to set") +} case $CHOICE in "brightness") - ddcutil setvcp 10 $VALUE;; + get_value + for monitor in $MONITORS; do + ddcutil -d $monitor setvcp 10 $VALUE + done;; "contrast") - ddcutil setvcp 12 $VALUE;; + get_value + for monitor in $MONITORS; do + ddcutil -d $monitor setvcp 12 $VALUE + done;; + "toggle secondary display") + toggle;; esac