From anonymous, 2 Weeks ago, written in Bash.
Embed
  1. #!/bin/bash
  2.  
  3. d=-  # depending on driver
  4. declare -A configurations=(
  5.     [internal]="--output HDMI${d}1 --off --output HDMI${d}2 --off --output DP${d}2-2 --off --output DP${d}1 --off"
  6.     [home]="--output DP${d}2-2 --left-of eDP${d}1 --auto"
  7.     [hsr]="--output HDMI${d}2 --left-of eDP${d}1 --auto"
  8.     [hdmi]="--output HDMI${d}2 --right-of eDP${d}1 --auto"
  9.     [dvi]="--output HDMI${d}1 --right-of eDP${d}1 --auto"
  10. )
  11.  
  12. choice=$(printf '%s\n' "${!configurations[@]}" | rofi -dmenu)
  13. [[ $? != 0 ]] && exit
  14. config=${configurations[$choice]}
  15.  
  16. xrandr $config
  17. herbstclient detect_monitors
  18. herbstclient reload
  19.  
  20. # FIXME are those IDs fixed?
  21. xinput map-to-output 9 eDP-1
  22. xinput map-to-output 20 eDP-1
  23.