aboutsummaryrefslogtreecommitdiff
path: root/kanshi/home_tv.sh
diff options
context:
space:
mode:
authorbozo.kopic <bozo@kopic.xyz>2024-06-01 21:49:19 +0200
committerbozo.kopic <bozo@kopic.xyz>2024-06-01 21:49:19 +0200
commit9dd5082688f18e0f887de9ff31d1fb28ba5aa14c (patch)
tree374e46fdb7bf3fd047faa5f3c7a628511c0964fe /kanshi/home_tv.sh
parent2718a4de5389cfe5287f2289b0e46d8509e2aeab (diff)
.
Diffstat (limited to 'kanshi/home_tv.sh')
-rwxr-xr-xkanshi/home_tv.sh37
1 files changed, 17 insertions, 20 deletions
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