aboutsummaryrefslogtreecommitdiff
path: root/kanshi
diff options
context:
space:
mode:
Diffstat (limited to 'kanshi')
-rw-r--r--kanshi/config14
-rwxr-xr-xkanshi/dual.sh45
-rwxr-xr-xkanshi/home_tv.sh30
-rwxr-xr-xkanshi/single.sh19
-rwxr-xr-xkanshi/work.sh32
5 files changed, 45 insertions, 95 deletions
diff --git a/kanshi/config b/kanshi/config
index 3876217..7e79f7c 100644
--- a/kanshi/config
+++ b/kanshi/config
@@ -9,17 +9,3 @@ profile dual {
output *
exec ~/.config/kanshi/dual.sh
}
-
-profile work {
- output eDP-1
- 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'
- output 'LG Electronics LG TV 0x01010101'
- exec ~/.config/kanshi/home_tv.sh
-}
diff --git a/kanshi/dual.sh b/kanshi/dual.sh
index b9c08cf..bda0ff0 100755
--- a/kanshi/dual.sh
+++ b/kanshi/dual.sh
@@ -4,18 +4,39 @@
secondary=$(display_names ".name != \"$primary\"")
-swaymsg -q reload
+wlr-randr --output $primary --pos 0,0
+wlr-randr --output $secondary --right-of $primary
-swaymsg -q output $primary pos 0 0 \
- res $primary_res \
- bg $bg1 stretch
-swaymsg -q output $secondary pos $primary_width 0 \
- bg $bg2 stretch
+killall swaybg >/dev/null
+swaybg -o $primary -i $bg1 \
+ -o $secondary -i $bg2 &
-for workspace in 1:1 2:2 3:3 4:4; do
- swaymsg -q workspace $workspace output $primary
-done
+if [ "$XDG_CURRENT_DESKTOP" = "sway" ]; then
+ for workspace in 1:1 2:2 3:3 4:4; 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 $secondary
+ done
+
+elif [ "$XDG_CURRENT_DESKTOP" = "niri" ]; then
+ for workspace in 1:1 2:2 3:3 4:4; do
+ niri msg action move-workspace-to-monitor --reference $workspace $primary
+ done
+
+ for workspace in 5:a 6:s 7:d 8:f; do
+ niri msg action move-workspace-to-monitor --reference $workspace $secondary
+ done
+
+ niri msg action move-workspace-to-index --reference 1:1 1
+ niri msg action move-workspace-to-index --reference 2:2 2
+ niri msg action move-workspace-to-index --reference 3:3 3
+ niri msg action move-workspace-to-index --reference 4:4 4
+
+ niri msg action move-workspace-to-index --reference 5:a 1
+ niri msg action move-workspace-to-index --reference 6:s 2
+ niri msg action move-workspace-to-index --reference 7:d 3
+ niri msg action move-workspace-to-index --reference 8:f 4
+fi
-for workspace in 5:a 6:s 7:d 8:f; do
- swaymsg -q workspace $workspace output $secondary
-done
diff --git a/kanshi/home_tv.sh b/kanshi/home_tv.sh
deleted file mode 100755
index f54128b..0000000
--- a/kanshi/home_tv.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/sh
-
-. $(dirname "$(realpath "$0")")/env.sh
-
-tv=$(display_names '.model == "LG TV"')
-secondary=$(display_names ".name != \"$primary\" and .name != \"$tv\"")
-secondary_width=$(display_widths ".name == \"$secondary\"")
-
-swaymsg -q reload
-
-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 $tv pos $(($primary_width + $secondary_width)) 0 \
- bg $bg1 stretch
-
-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 $secondary
-done
-
-for workspace in 4:4; do
- swaymsg -q workspace $workspace output $tv
-done
diff --git a/kanshi/single.sh b/kanshi/single.sh
index 5a335af..015c22d 100755
--- a/kanshi/single.sh
+++ b/kanshi/single.sh
@@ -2,12 +2,17 @@
. $(dirname "$(realpath "$0")")/env.sh
-swaymsg -q reload
+killall swaybg
+swaybg -o $primary -i $bg1 &
-swaymsg -q output $primary pos 0 0 \
- res $primary_res \
- bg $bg1 stretch
+if [ "$XDG_CURRENT_DESKTOP" = "sway" ]; then
+ 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 $primary
+ done
+
+elif [ "$XDG_CURRENT_DESKTOP" = "niri" ]; then
+ for workspace in 1 2 3 4 a s d f; do
+ niri msg action move-workspace-to-monitor --reference $workspace $primary
+ done
+fi
-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 $primary
-done
diff --git a/kanshi/work.sh b/kanshi/work.sh
deleted file mode 100755
index efc86f8..0000000
--- a/kanshi/work.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/sh
-
-. $(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 $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 $primary
-
-for workspace in 2:2 3:3 4:4; do
- swaymsg -q workspace $workspace output $display1
-done
-
-for workspace in 5:a 6:s 7:d 8:f; do
- swaymsg -q workspace $workspace output $display2
-done