From e1a7870d5d1014eb4e26c10c67c7befe1af9b5d8 Mon Sep 17 00:00:00 2001 From: Wryn Wagner Date: Thu, 23 Jan 2020 16:08:28 -0700 Subject: [PATCH] Added mobile monitor setup scripts --- config/xserver/screenlayout/hdmidock.sh | 9 +++++++++ config/xserver/screenlayout/workplus.sh | 22 ++++++++++++++++++++++ config/xserver/set_randr_layout | 11 +++++++++++ 3 files changed, 42 insertions(+) create mode 100755 config/xserver/screenlayout/workplus.sh diff --git a/config/xserver/screenlayout/hdmidock.sh b/config/xserver/screenlayout/hdmidock.sh index c4884b7..a55e9c5 100755 --- a/config/xserver/screenlayout/hdmidock.sh +++ b/config/xserver/screenlayout/hdmidock.sh @@ -1,4 +1,5 @@ #!/bin/sh + xrandr --output DP-0 --off\ --output DP-1 --off\ --output DP-3 --off\ @@ -6,6 +7,14 @@ xrandr --output DP-0 --off\ --output DP-2 --primary --mode 2880x1800 --scale 0.8x0.8 --pos 0x0 --rotate normal\ --output HDMI-0 --pos 2880x0 --rotate normal + +#xrandr | grep -q "3840" >/dev/null 2>&1; +#if [[ $? -ne 0 ]]; then +# if xrandr | grep -q "1920"; then +# xrandr --output HDMI-0 --mode 1920x1080 --pos 2880x0 --rotate normal --scale 1.5x1.5; +# fi +#fi + ROLL=$(($RANDOM%4)); if [ $ROLL -eq 0 ]; then diff --git a/config/xserver/screenlayout/workplus.sh b/config/xserver/screenlayout/workplus.sh new file mode 100755 index 0000000..c149aaa --- /dev/null +++ b/config/xserver/screenlayout/workplus.sh @@ -0,0 +1,22 @@ +#!/bin/sh +if xrandr | grep -q "DP-0 connected"; then + xrandr \ + --output DP-0 --mode 1920x1080 --pos 0x0 --rotate normal --scale 1.5x1.5 --primary\ + --output DP-1 --off\ + --output DP-2 --mode 2880x1800 --pos 5760x0 --rotate normal --scale 0.8x0.8\ + --output DP-3 --off\ + --output DP-4 --mode 1920x1080 --pos 2880x0 --rotate normal --scale 1.5x1.5\ + --output HDMI-0 --mode 1920x1080 --pos 8640x0 --rotate left\ + ; +else + xrandr \ + --output DP-0 --off\ + --output DP-1 --mode 1920x1080 --pos 0x0 --rotate normal --scale 1.5x1.5 --primary\ + --output DP-2 --mode 2880x1800 --pos 5760x0 --rotate normal --scale 0.8x0.8\ + --output DP-3 --mode 1920x1080 --pos 2880x0 --rotate normal --scale 1.5x1.5\ + --output DP-4 --off\ + --output HDMI-0 --mode 1920x1080 --pos 8640x0 --rotate left\ + ; +fi + +feh --bg-fill --randomize $HOME/Pictures/bg >/dev/null 2>&1; diff --git a/config/xserver/set_randr_layout b/config/xserver/set_randr_layout index 42d57eb..755ab2c 100755 --- a/config/xserver/set_randr_layout +++ b/config/xserver/set_randr_layout @@ -2,7 +2,12 @@ source $HOME/.wryn/env/env.zsh XSERVER_DIR="$DOTWRYN/config/xserver" + AT_HOME(){ + xrandr -q | grep -q 'HDMI-0 connected' && xrandr -q | grep -q '3840'; +} + +CONNECTED_TO_MONITOR() { xrandr -q | grep -q 'HDMI-0 connected'; } @@ -12,6 +17,12 @@ AT_RENT() { if AT_HOME; then "$XSERVER_DIR/screenlayout/homedock_hdmionly.sh"; +elif CONNECTED_TO_MONITOR; then + if AT_RENT; then + "$XSERVER_DIR/screenlayout/workplus.sh"; + else + "$XSERVER_DIR/screenlayout/hdmidock.sh"; + fi elif AT_RENT; then "$XSERVER_DIR/screenlayout/workdock.sh"; else;