>>106337749
It is ugly, but it works to quickly switch from 1 to 2 monitors, and of course I have the opposite functionaltiy.
dualscreen.sh
#!/bin/bash
pkill xmobar
sed -i -e 's: xmproc :-- xmproc1 :g' ~/.xmonad/xmonad.hs
sed -i -e 's:-- xmproc2 : xmproc :g' -e 's:-- xmobar2 : xmobar2 :g' ~/.xmonad/xmonad.hs
xrandr --output HDMI-0 --mode 1920x1080 --rate 60 --left-of DP-0 --output DP-0 --mode 1920x1080 --rate 120
xmonad --restart
singlescreen.sh
#!/bin/bash
pkill xmobar
sed -i -e 's: xmproc :-- xmproc2 :g' -e 's: xmobar2 :-- xmobar2 :g' ~/.xmonad/xmonad.hs
sed -i -e 's:-- xmproc1 : xmproc :g' ~/.xmonad/xmonad.hs
xrandr --output HDMI-0 --off
xmonad --restart
$ grep 'screen.sh' .bash_aliases
alias dlscrn='~/bin/dualscreen.sh'
alias snglscrn='~/bin/singlescreen.sh'