diff options
Diffstat (limited to 'kanshi')
| -rw-r--r-- | kanshi/config | 8 | ||||
| -rwxr-xr-x | kanshi/dual.sh | 21 | ||||
| -rw-r--r-- | kanshi/env.sh | 26 | ||||
| -rwxr-xr-x | kanshi/home_tv.sh | 37 | ||||
| -rwxr-xr-x | kanshi/single.sh | 10 | ||||
| -rwxr-xr-x | kanshi/work.sh | 35 |
6 files changed, 82 insertions, 55 deletions
diff --git a/kanshi/config b/kanshi/config index 9750a16..3876217 100644 --- a/kanshi/config +++ b/kanshi/config @@ -12,14 +12,14 @@ profile dual { profile work { output eDP-1 - output 'Dell Inc. DELL U2722DE HFMKDH3' # DP-5 - output 'Dell Inc. DELL U2722D 3ZS8XN3' # DP-6 + output 'Dell Inc. DELL U2722DE HFMKDH3' + output 'Dell Inc. DELL U2722D 3ZS8XN3' exec ~/.config/kanshi/work.sh } profile home_tv { output eDP-1 - output 'AOC Q2770 FSUE7HA007776' # DP-6 - output 'LG Electronics LG TV 0x00000101' # DP-5 + output 'AOC Q2770 FSUE7HA007776' + output 'LG Electronics LG TV 0x01010101' exec ~/.config/kanshi/home_tv.sh } diff --git a/kanshi/dual.sh b/kanshi/dual.sh index 3e9ee3e..b9c08cf 100755 --- a/kanshi/dual.sh +++ b/kanshi/dual.sh @@ -1,22 +1,21 @@ #!/bin/sh -display1=eDP-1 -display2=$(swaymsg -t get_outputs -r | - jq "map(select(.name != \"$display1\") | .name)[0]" 2> /dev/null | - tr -d "\"") +. $(dirname "$(realpath "$0")")/env.sh + +secondary=$(display_names ".name != \"$primary\"") swaymsg -q reload -swaymsg -q output $display1 pos 0 0 \ - res 1920x1080 \ - bg ~/.pictures/bg1.jpg stretch -swaymsg -q output $display2 pos 1920 0 \ - bg ~/.pictures/bg2.jpg stretch +swaymsg -q output $primary pos 0 0 \ + res $primary_res \ + bg $bg1 stretch +swaymsg -q output $secondary pos $primary_width 0 \ + bg $bg2 stretch for workspace in 1:1 2:2 3:3 4:4; do - swaymsg -q workspace $workspace output $display1 + swaymsg -q workspace $workspace output $primary done for workspace in 5:a 6:s 7:d 8:f; do - swaymsg -q workspace $workspace output $display2 + swaymsg -q workspace $workspace output $secondary done diff --git a/kanshi/env.sh b/kanshi/env.sh new file mode 100644 index 0000000..c7ddd5d --- /dev/null +++ b/kanshi/env.sh @@ -0,0 +1,26 @@ +: ${HOME:?} + +primary=eDP-1 + +primary_width=1920 +primary_height=1080 +primary_res=${primary_width}x${primary_height} + +bg1=$HOME/.pictures/bg1.jpg +bg2=$HOME/.pictures/bg2.jpg + + +display_names() { + wlr-randr --json | \ + jq -r "map(select($1)) | .[] | .name" 2>/dev/null +} + +display_widths() { + wlr-randr --json | \ + jq -r "map(select($1)) | .[] | .modes | map(select(.current)) | .[] | .width" 2>/dev/null +} + +display_heights() { + wlr-randr --json | \ + jq -r "map(select($1)) | .[] | .modes | map(select(.current)) | .[] | .height" 2>/dev/null +} diff --git a/kanshi/home_tv.sh b/kanshi/home_tv.sh index 5cb1392..f54128b 100755 --- a/kanshi/home_tv.sh +++ b/kanshi/home_tv.sh @@ -1,33 +1,30 @@ #!/bin/sh -display1=eDP-1 -display3=$(swaymsg -t get_outputs -r | - jq -r '.[] | select(.model == "LG TV") | .name') -display2=$(swaymsg -t get_outputs -r | - jq -r ".[] | .name | select(. != \"$display1\" and . != \"$display3\")") +. $(dirname "$(realpath "$0")")/env.sh -swaymsg -q reload +tv=$(display_names '.model == "LG TV"') +secondary=$(display_names ".name != \"$primary\" and .name != \"$tv\"") +secondary_width=$(display_widths ".name == \"$secondary\"") -swaymsg -q output $display1 pos 0 0 \ - res 1920x1080 \ - bg ~/.pictures/bg1.jpg stretch -swaymsg -q output $display2 pos 1920 0 \ - bg ~/.pictures/bg2.jpg stretch +swaymsg -q reload -display2_width=$(swaymsg -t get_outputs -r | - jq -r ".[] | select(.name == \"$display2\") | .current_mode.width") +swaymsg -q output $primary pos 0 0 \ + res $primary_res \ + bg $bg1 stretch +swaymsg -q output $secondary pos $primary_width 0 \ + bg $bg2 stretch -swaymsg -q output $display3 pos $((1920 + $display2_width)) 0 \ - bg ~/.pictures/bg1.jpg stretch +swaymsg -q output $tv pos $(($primary_width + $secondary_width)) 0 \ + bg $bg1 stretch -for workspace in 1:1 3:3 4:4; do - swaymsg -q workspace $workspace output $display1 +for workspace in 1:1 2:2 3:3; do + swaymsg -q workspace $workspace output $primary done for workspace in 5:a 6:s 7:d 8:f; do - swaymsg -q workspace $workspace output $display2 + swaymsg -q workspace $workspace output $secondary done -for workspace in 2:2; do - swaymsg -q workspace $workspace output $display3 +for workspace in 4:4; do + swaymsg -q workspace $workspace output $tv done diff --git a/kanshi/single.sh b/kanshi/single.sh index f126662..5a335af 100755 --- a/kanshi/single.sh +++ b/kanshi/single.sh @@ -1,13 +1,13 @@ #!/bin/sh -display=eDP-1 +. $(dirname "$(realpath "$0")")/env.sh swaymsg -q reload -swaymsg -q output $display pos 0 0 \ - res 1920x1080 \ - bg ~/.pictures/bg1.jpg stretch +swaymsg -q output $primary pos 0 0 \ + res $primary_res \ + bg $bg1 stretch for workspace in 1:1 2:2 3:3 4:4 5:a 6:s 7:d 8:f; do - swaymsg -q workspace $workspace output $display + swaymsg -q workspace $workspace output $primary done diff --git a/kanshi/work.sh b/kanshi/work.sh index b03bca2..efc86f8 100755 --- a/kanshi/work.sh +++ b/kanshi/work.sh @@ -1,27 +1,32 @@ #!/bin/sh -display1=eDP-1 -display2=DP-5 -display3=DP-6 +. $(dirname "$(realpath "$0")")/env.sh + +display_width=2560 +display_height=1440 +display_res=${display_width}x${display_height} + +display1=$(display_names '.model == "DELL U2722DE"') +display2=$(display_names '.model == "DELL U2722D"') swaymsg reload -swaymsg -q output $display1 pos 0 1440 \ - res 1920x1080 \ - bg ~/.pictures/bg1.jpg stretch -swaymsg -q output $display2 pos 0 0 \ - res 2560x1440 \ - bg ~/.pictures/bg1.jpg stretch -swaymsg -q output $display3 pos 2560 0 \ - res 2560x1440 \ - bg ~/.pictures/bg2.jpg stretch +swaymsg -q output $primary pos 0 1440 \ + res $primary_res \ + bg $bg1 stretch +swaymsg -q output $display1 pos 0 0 \ + res $display_res \ + bg $bg1 stretch +swaymsg -q output $display2 pos $display_width 0 \ + res $display_res \ + bg $bg2 stretch -swaymsg -q workspace 1:1 output $display1 +swaymsg -q workspace 1:1 output $primary for workspace in 2:2 3:3 4:4; do - swaymsg -q workspace $workspace output $display2 + swaymsg -q workspace $workspace output $display1 done for workspace in 5:a 6:s 7:d 8:f; do - swaymsg -q workspace $workspace output $display3 + swaymsg -q workspace $workspace output $display2 done |
