Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- #
- # dmenu-splitmonitor.sh
- #
- if [ $# -eq 0 ]; then
- echo "Supply the width of the center monitor as an argument"
- echo "e.g. dmenu-splitmonitor-custom.sh 1400"
- exit
- fi
- widthCenter=$1
- if [ "$widthCenter" = "Default" ]; then
- widthCenter=1500
- fi
- let widthLeft=(3840-$widthCenter)/2
- let positionRight=widthCenter+widthLeft
- let widthRight=(3840-$widthCenter)/2
- if [ "$widthCenter" -eq 1920 ]; then
- let widthRight=0
- let widthLeft=1920
- let positionRight=0
- fi
- echo "$widthLeft @ 0"
- echo "$widthCenter @ $widthLeft"
- echo "$widthRight @ $positionRight"
- xrandr | grep -E 'HDMI-1 connected( primary)? 3840x1080' &> /dev/null
- if [ $? == 0 ]; then
- echo "Deleting existing"
- xrandr --delmonitor HDMI-1-3
- xrandr --delmonitor HDMI-1-1
- xrandr --delmonitor HDMI-1-2
- if [ "$widthCenter" != "Full" ]; then
- echo "Configuring output"
- xrandr --setmonitor HDMI-1-1 $widthLeft/255x1080/286+0+0 none
- xrandr --setmonitor HDMI-1-2 $widthCenter/255x1080/286+$widthLeft+0 none
- if [ $widthRight -gt 0 ]; then
- xrandr --setmonitor HDMI-1-3 $widthRight/255x1080/286+$positionRight+0 none
- fi
- xrandr --output HDMI-1 --auto --left-of eDP-1
- fi
- echo "Reloading"
- i3-msg reload
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement