dotfiles

Obligatory dotfiles repo
git clone git://git.danielmoch.com/dotfiles.git
Log | Files | Refs

commit d2ca66f9d3ed0589b41a1af4c4c56a736c7c017b
parent 33cf423565fcd7da836282f9577c77e11af58b19
Author: Daniel Moch <daniel@danielmoch.com>
Date:   Fri, 21 May 2021 09:03:31 -0400

screen.carbon: simplifications

Diffstat:
Mbin/screen.carbon | 44++++++++++++++++++++++----------------------
1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/bin/screen.carbon b/bin/screen.carbon @@ -1,34 +1,34 @@ #!/bin/sh -expected="eDP-1 DP-1-2" +expected="eDP-1 DP-2-1 HDMI-1" for mon in $expected do if xrandr -q | grep $mon | grep ' connected' >/dev/null 2>&1 then connected="$connected $mon" - else - disconnected="$disconnected $mon" fi done -cmd="xrandr --dpi eDP-1" +if echo $connected | grep HDMI-1 >/dev/null 2>&1 +then + cmd="xrandr --dpi HDMI-1 --output HDMI-1 --auto --primary + --output DP-2-1 --auto --right-of HDMI-1 + --output eDP-1 --off --output DP-2-2 --off" +else + cmd="xrandr --dpi eDP-1 --output HDMI-1 --off + --output DP-2-1 --off --output DP-2-2 --off + --output eDP-1 --mode 1920x1080 --primary" +fi -for mon in $connected -do - if [ "$mon" = "eDP-1" ] - then - cmd="$cmd --output eDP-1 --auto --primary" - elif [ "$mon" = "DP-1-2" ] - then - cmd="$cmd --output DP-1-2 --auto --right-of eDP-1 --scale 2x2" - fi -done - -for mon in $disconnected -do - cmd="$cmd --output $mon --off" -done - -echo "my-screen.local: Running cmd $cmd" >> "$HOME/var/log/my" -$cmd +if [ -z "$1" ] +then + echo "my-screen.local: Running cmd $cmd" >> "$HOME/var/log/my" + $cmd +elif [ "$1" = "-d" ] +then + echo $cmd +else + echo $(basename $0): unknown flag --- $1 + exit 1 +fi