commit 7fe8ce2cab3b3b9089bc4441ef9ea9ad9392ecd0
parent d16888435e04f5fef167655609d3c81de4b26e8b
Author: Milutin Popovic <milutin@popovic.xyz>
Date: Mon, 30 Mar 2026 16:37:15 +0100
u
Diffstat:
1 file changed, 22 insertions(+), 17 deletions(-)
diff --git a/.local/bin/scripts/niri-monitors b/.local/bin/scripts/niri-monitors
@@ -1,10 +1,16 @@
#!/bin/sh
+MONITOR_OUT=${MONITOR_OUT:-0}
+
+mon_n="BOE 0x0BCA Unknown"
+mon_l="PNP(BNQ) BenQ GL2760 H3E04203019"
+mon_r="PNP(BNQ) BenQ GL2760 SCF04101019"
+
move_workspaces() {
monitor=$1
direction=$2
- for nw in 1 2 3 4 5 6 7 8 9; do
+ for nw in $(seq 1 9); do
niri msg action \
move-workspace-to-monitor \
--reference "${direction}${nw}" \
@@ -13,13 +19,25 @@ move_workspaces() {
}
mulmon_activate() {
-# ln -sf "$XDG_CONFIG_HOME/niri/config.mulmon.kdl" "$XDG_CONFIG_HOME/niri/config.kdl"
+ noctalia-shell kill && \
+ niri msg output "$mon_l" on && \
+ niri msg output "$mon_r" on && \
+ move_workspaces "$mon_l" "l" && \
+ move_workspaces "$mon_r" "r" && \
+ niri msg output "$mon_n" off && \
+ noctalia-shell &
MONITOR_OUT=1
export MONITOR_OUT
}
mulmon_deactivate() {
-# ln -sf "$XDG_CONFIG_HOME/niri/config.laptop.kdl" "$XDG_CONFIG_HOME/niri/config.kdl"
+ noctalia-shell kill && \
+ niri msg output "$mon_n" on && \
+ move_workspaces "$mon_n" "l" && \
+ move_workspaces "$mon_n" "r" && \
+ niri msg output "$mon_l" off && \
+ niri msg output "$mon_r" off && \
+ noctalia-shell &
MONITOR_OUT=0
export MONITOR_OUT
}
@@ -29,23 +47,10 @@ active_connection() {
[ "$count" -eq 2 ]
}
-MONITOR_OUT=${MONITOR_OUT:-0}
-
-mon_l="PNP(BNQ) BenQ GL2760 H3E04203019"
-mon_r="PNP(BNQ) BenQ GL2760 SCF04101019"
-
-if active_connection; then
- mulmon_activate
- move_workspaces "$mon_l" "l"
- move_workspaces "$mon_r" "r"
-fi
-
while :; do
if active_connection; then
if [ "$MONITOR_OUT" -eq 0 ]; then
mulmon_activate
- move_workspaces "$mon_l" "l"
- move_workspaces "$mon_r" "r"
fi
else
if [ "$MONITOR_OUT" -eq 1 ]; then
@@ -60,5 +65,5 @@ while :; do
sudo powerprofilesctl set balanced
fi
- sleep 2
+ sleep 1
done