From 071212e40ff7443db37824ee6dbdbad239ade693 Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Fri, 31 Jul 2026 12:06:27 +0800 Subject: [PATCH] feat(niri): reorganize workspace layout --- home/linux/gui/niri/conf/keybindings.kdl | 14 ++----- home/linux/gui/niri/conf/windowrules.kdl | 45 +++++++++++++-------- home/linux/gui/niri/reorder-workspaces.sh | 47 ++++++++++++++++------ hosts/12kingdoms-shoukei/niri-hardware.kdl | 7 +--- hosts/idols-ai/niri-hardware.kdl | 10 ++--- 5 files changed, 71 insertions(+), 52 deletions(-) diff --git a/home/linux/gui/niri/conf/keybindings.kdl b/home/linux/gui/niri/conf/keybindings.kdl index 1f04f2a4..abafc43e 100644 --- a/home/linux/gui/niri/conf/keybindings.kdl +++ b/home/linux/gui/niri/conf/keybindings.kdl @@ -151,22 +151,16 @@ binds { Mod+1 { focus-workspace "1terminal"; } Mod+2 { focus-workspace "2browser"; } Mod+3 { focus-workspace "3chat"; } - Mod+4 { focus-workspace "4music"; } + Mod+4 { focus-workspace "4entertainment"; } Mod+5 { focus-workspace "5mail"; } - Mod+6 { focus-workspace "6file"; } - Mod+7 { focus-workspace "7"; } - Mod+8 { focus-workspace "8"; } - Mod+9 { focus-workspace "9"; } + Mod+6 { focus-workspace "6utility"; } Mod+0 { focus-workspace "0other"; } Mod+Ctrl+1 { move-column-to-workspace "1terminal"; } Mod+Ctrl+2 { move-column-to-workspace "2browser"; } Mod+Ctrl+3 { move-column-to-workspace "3chat"; } - Mod+Ctrl+4 { move-column-to-workspace "4music"; } + Mod+Ctrl+4 { move-column-to-workspace "4entertainment"; } Mod+Ctrl+5 { move-column-to-workspace "5mail"; } - Mod+Ctrl+6 { move-column-to-workspace "6file"; } - Mod+Ctrl+7 { move-column-to-workspace "7"; } - Mod+Ctrl+8 { move-column-to-workspace "8"; } - Mod+Ctrl+9 { move-column-to-workspace "9"; } + Mod+Ctrl+6 { move-column-to-workspace "6utility"; } Mod+Ctrl+0 { move-column-to-workspace "0other"; } // Alternatively, there are commands to move just a single window: diff --git a/home/linux/gui/niri/conf/windowrules.kdl b/home/linux/gui/niri/conf/windowrules.kdl index 82103980..db39c4df 100644 --- a/home/linux/gui/niri/conf/windowrules.kdl +++ b/home/linux/gui/niri/conf/windowrules.kdl @@ -61,66 +61,77 @@ window-rule { open-on-workspace "3chat" } -// Gaming applications - open in workspace 4 +// Entertainment applications - open in workspace 4 window-rule { match app-id="steam" - open-on-workspace "4gaming" + open-on-workspace "4entertainment" } window-rule { match app-id="steam_app_default" - open-on-workspace "4gaming" + open-on-workspace "4entertainment" } window-rule { match app-id="heroic" - open-on-workspace "4gaming" + open-on-workspace "4entertainment" } window-rule { match app-id="net.lutris.Lutris" - open-on-workspace "4gaming" + open-on-workspace "4entertainment" } window-rule { match app-id="com.vysp3r.ProtonPlus" - open-on-workspace "4gaming" + open-on-workspace "4entertainment" } window-rule { // Run anime games on Linux match app-id="^moe.launcher" - open-on-workspace "4gaming" + open-on-workspace "4entertainment" } window-rule { // All *.exe (Windows applications) match app-id=".exe$" - open-on-workspace "4gaming" + open-on-workspace "4entertainment" +} +window-rule { + match app-id="^mpv$" + open-on-workspace "4entertainment" } -// File management applications - open in workspace 6 +// Utility applications - open in workspace 6 window-rule { match app-id="com.github.johnfactotum.Foliate" - open-on-workspace "6file" + open-on-workspace "6utility" } window-rule { match app-id="thunar" - open-on-workspace "6file" + open-on-workspace "6utility" } - -// Other applications - open in workspace 0 window-rule { - match app-id="Clash-verge" - open-on-workspace "0other" + match app-id="^Clash-verge$" + match app-id="^[.]clash-verge-wrapped$" + open-on-workspace "6utility" +} +window-rule { + match app-id="^org[.]kde[.]easyeffects$" + open-on-workspace "6utility" } window-rule { match app-id="Zoom Workplace" // Zoom Home Page match title="^(Zoom Workplace)( - Free account)?$" - open-on-workspace "0other" + open-on-workspace "6utility" } window-rule { match app-id="Zoom Workplace" // Zoom - other windows exclude title="^(Zoom Workplace)( - Free account)?$" - open-on-workspace "0other" + open-on-workspace "6utility" open-floating true } +window-rule { + match app-id="^Zoom$" + open-on-workspace "6utility" +} window-rule { match app-id="^Zoom$" title="^as_toolbar$" open-floating true diff --git a/home/linux/gui/niri/reorder-workspaces.sh b/home/linux/gui/niri/reorder-workspaces.sh index 8bbfff4c..1acdcedf 100644 --- a/home/linux/gui/niri/reorder-workspaces.sh +++ b/home/linux/gui/niri/reorder-workspaces.sh @@ -1,17 +1,38 @@ #!/usr/bin/env bash set -euo pipefail -# Reorder named workspaces so indices match their numeric prefixes: -# 1 → "1terminal", 2 → "2browser", ..., 6 → "6file", 10 → "0other". -# Requires a running niri session and the `niri msg` command in PATH. +# Niri keeps a separate workspace index sequence on each output. +case "$(hostname)" in + ai) + workspace_order=( + "4entertainment:1" + "2browser:2" + "0other:3" + "1terminal:1" + "3chat:2" + "6utility:3" + ) + ;; + shoukei) + workspace_order=( + "1terminal:1" + "2browser:2" + "3chat:3" + "4entertainment:4" + "5mail:5" + "6utility:6" + "0other:7" + ) + ;; + *) + printf 'No workspace order configured for host %s\n' "$(hostname)" >&2 + exit 0 + ;; +esac -niri msg action move-workspace-to-index 1 --reference "1terminal" -niri msg action move-workspace-to-index 2 --reference "2browser" -niri msg action move-workspace-to-index 3 --reference "3chat" -niri msg action move-workspace-to-index 4 --reference "4music" -niri msg action move-workspace-to-index 5 --reference "5mail" -niri msg action move-workspace-to-index 6 --reference "6file" -niri msg action move-workspace-to-index 7 --reference "7" -niri msg action move-workspace-to-index 8 --reference "8" -niri msg action move-workspace-to-index 9 --reference "9" -niri msg action move-workspace-to-index 10 --reference "0other" +for entry in "${workspace_order[@]}"; do + workspace="${entry%%:*}" + index="${entry##*:}" + printf 'Moving workspace %s to index %s\n' "$workspace" "$index" + niri msg action move-workspace-to-index "$index" --reference "$workspace" +done diff --git a/hosts/12kingdoms-shoukei/niri-hardware.kdl b/hosts/12kingdoms-shoukei/niri-hardware.kdl index a01cc3fe..753922c1 100644 --- a/hosts/12kingdoms-shoukei/niri-hardware.kdl +++ b/hosts/12kingdoms-shoukei/niri-hardware.kdl @@ -7,12 +7,9 @@ output "eDP-1" { workspace "1terminal" { open-on-output "eDP-1"; } workspace "2browser" { open-on-output "eDP-1"; } workspace "3chat" { open-on-output "eDP-1"; } -workspace "4music" { open-on-output "eDP-1"; } +workspace "4entertainment" { open-on-output "eDP-1"; } workspace "5mail" { open-on-output "eDP-1"; } -workspace "6file" { open-on-output "eDP-1"; } -workspace "7" { open-on-output "eDP-1"; } -workspace "8" { open-on-output "eDP-1"; } -workspace "9" { open-on-output "eDP-1"; } +workspace "6utility" { open-on-output "eDP-1"; } workspace "0other" { open-on-output "eDP-1"; } debug { render-drm-device "/dev/dri/renderD128"; } diff --git a/hosts/idols-ai/niri-hardware.kdl b/hosts/idols-ai/niri-hardware.kdl index 7d2e4899..28d379ae 100644 --- a/hosts/idols-ai/niri-hardware.kdl +++ b/hosts/idols-ai/niri-hardware.kdl @@ -38,14 +38,10 @@ output "HDMI-A-2" { } // ============= Named Workspaces ============= +workspace "4entertainment" { open-on-output "DP-1"; } workspace "2browser" { open-on-output "DP-1"; } -workspace "4gaming" { open-on-output "DP-1"; } -workspace "5music" { open-on-output "DP-1"; } +workspace "0other" { open-on-output "DP-1"; } workspace "1terminal" { open-on-output "HDMI-A-2"; } workspace "3chat" { open-on-output "HDMI-A-2"; } -workspace "6file" { open-on-output "HDMI-A-2"; } -workspace "7" { open-on-output "HDMI-A-2"; } -workspace "8" { open-on-output "HDMI-A-2"; } -workspace "9" { open-on-output "HDMI-A-2"; } -workspace "0other" { open-on-output "HDMI-A-2"; } +workspace "6utility" { open-on-output "HDMI-A-2"; }