From 25a8b45d797ac71c554ac6f8cd0d0f0347e659b0 Mon Sep 17 00:00:00 2001 From: js0ny Date: Sun, 16 Nov 2025 19:21:11 +0000 Subject: [PATCH] niri: workspaces --- .editorconfig | 4 ++ home/dot_config/nvim/ftplugin/nix.lua | 3 ++ .../desktop/wayland-wm/niri/default.nix | 8 ++++ .../desktop/wayland-wm/niri/keymaps.nix | 36 ++++++++-------- .../desktop/wayland-wm/niri/window-rules.nix | 43 +++++++++++++++++++ nixcfgs/users/js0ny/programs/nvim.nix | 1 + 6 files changed, 77 insertions(+), 18 deletions(-) create mode 100644 home/dot_config/nvim/ftplugin/nix.lua diff --git a/.editorconfig b/.editorconfig index b0f87fd..62219cf 100644 --- a/.editorconfig +++ b/.editorconfig @@ -25,3 +25,7 @@ indent_style = space # Empty ruleset to skip global settings # charset = gbk # Not available # end_of_line = crlf + +[*.nix] +indent_size = 2 + diff --git a/home/dot_config/nvim/ftplugin/nix.lua b/home/dot_config/nvim/ftplugin/nix.lua new file mode 100644 index 0000000..6af5a0a --- /dev/null +++ b/home/dot_config/nvim/ftplugin/nix.lua @@ -0,0 +1,3 @@ +vim.bo.shiftwidth = 2 +vim.bo.softtabstop = 2 +vim.bo.expandtab = true diff --git a/nixcfgs/users/js0ny/programs/desktop/wayland-wm/niri/default.nix b/nixcfgs/users/js0ny/programs/desktop/wayland-wm/niri/default.nix index b007271..55177d2 100644 --- a/nixcfgs/users/js0ny/programs/desktop/wayland-wm/niri/default.nix +++ b/nixcfgs/users/js0ny/programs/desktop/wayland-wm/niri/default.nix @@ -13,6 +13,14 @@ prefer-no-csd = true; screenshot-path = "~/Pictures/Screenshots/Screenshot from %Y-%m-%d %H-%M-%S.png"; + workspaces = { + "master" = {}; + "project" = {}; + "remote" = {}; + "info" = {}; + "bg" = {}; + }; + spawn-at-startup = [ {argv = ["waybar"];} {argv = ["dunst"];} diff --git a/nixcfgs/users/js0ny/programs/desktop/wayland-wm/niri/keymaps.nix b/nixcfgs/users/js0ny/programs/desktop/wayland-wm/niri/keymaps.nix index 7a5002d..7a57cf8 100644 --- a/nixcfgs/users/js0ny/programs/desktop/wayland-wm/niri/keymaps.nix +++ b/nixcfgs/users/js0ny/programs/desktop/wayland-wm/niri/keymaps.nix @@ -151,24 +151,24 @@ in { "Mod+Ctrl+Shift+WheelScrollDown".action = move-column-right; "Mod+Ctrl+Shift+WheelScrollUp".action = move-column-left; - "Mod+1".action = focus-workspace 1; - "Mod+2".action = focus-workspace 2; - "Mod+3".action = focus-workspace 3; - "Mod+4".action = focus-workspace 4; - "Mod+5".action = focus-workspace 5; - "Mod+6".action = focus-workspace 6; - "Mod+7".action = focus-workspace 7; - "Mod+8".action = focus-workspace 8; - "Mod+9".action = focus-workspace 9; - "Mod+Shift+1".action.move-column-to-workspace = 1; - "Mod+Shift+2".action.move-column-to-workspace = 2; - "Mod+Shift+3".action.move-column-to-workspace = 3; - "Mod+Shift+4".action.move-column-to-workspace = 4; - "Mod+Shift+5".action.move-column-to-workspace = 5; - "Mod+Shift+6".action.move-column-to-workspace = 6; - "Mod+Shift+7".action.move-column-to-workspace = 7; - "Mod+Shift+8".action.move-column-to-workspace = 8; - "Mod+Shift+9".action.move-column-to-workspace = 9; + "Mod+1".action = focus-workspace "master"; + "Mod+2".action = focus-workspace "project"; + "Mod+3".action = focus-workspace "remote"; + "Mod+4".action = focus-workspace "info"; + "Mod+5".action = focus-workspace 6; + "Mod+6".action = focus-workspace 7; + "Mod+7".action = focus-workspace 8; + "Mod+8".action = focus-workspace 9; + "Mod+9".action = focus-workspace "bg"; + "Mod+Shift+1".action.move-column-to-workspace = "master"; + "Mod+Shift+2".action.move-column-to-workspace = "project"; + "Mod+Shift+3".action.move-column-to-workspace = "remote"; + "Mod+Shift+4".action.move-column-to-workspace = "info"; + "Mod+Shift+5".action.move-column-to-workspace = 6; + "Mod+Shift+6".action.move-column-to-workspace = 7; + "Mod+Shift+7".action.move-column-to-workspace = 8; + "Mod+Shift+8".action.move-column-to-workspace = 9; + "Mod+Shift+9".action.move-column-to-workspace = "bg"; "Mod+BracketLeft".action = consume-or-expel-window-left; "Mod+BracketRight".action = consume-or-expel-window-right; diff --git a/nixcfgs/users/js0ny/programs/desktop/wayland-wm/niri/window-rules.nix b/nixcfgs/users/js0ny/programs/desktop/wayland-wm/niri/window-rules.nix index cddfcbc..9d4eecb 100644 --- a/nixcfgs/users/js0ny/programs/desktop/wayland-wm/niri/window-rules.nix +++ b/nixcfgs/users/js0ny/programs/desktop/wayland-wm/niri/window-rules.nix @@ -84,9 +84,52 @@ app-id = "^wechat$"; title = "^图片和视频$"; } + { + app-id = "^CherryStudio$"; + title = "^Cherry Studio Quick Assistant$"; + } ]; open-floating = true; } + { + matches = [ + {app-id = "^firefox$";} + ]; + open-on-workspace = "master"; + } + { + matches = [ + {app-id = "^code$";} + {app-id = "^dev.zed.Zed$";} + {app-id = "^Vitis IDE$";} + {app-id = "^Vivado$";} + ]; + open-on-workspace = "project"; + } + { + matches = [ + {app-id = "^org.kde.krdc$";} + {app-id = "^\.virt-manager-wrapped$";} + {title = "^🌐 ssh.*";} + ]; + open-on-workspace = "remote"; + } + { + matches = [ + {app-id = "^org.telegram.desktop$";} + {app-id = "^wechat$";} + {app-id = "^QQ$";} + {app-id = "^io.github.kukuruzka165.materialgram$";} + {app-id = "^thunderbird$";} + ]; + open-on-workspace = "info"; + } + { + matches = [ + {app-id = "^feishin$";} + ]; + open-on-workspace = "bg"; + } ]; }; } diff --git a/nixcfgs/users/js0ny/programs/nvim.nix b/nixcfgs/users/js0ny/programs/nvim.nix index b7f58fc..683bcef 100644 --- a/nixcfgs/users/js0ny/programs/nvim.nix +++ b/nixcfgs/users/js0ny/programs/nvim.nix @@ -15,6 +15,7 @@ in { imagemagick ]; }; + home.packages = with pkgs; [lua-language-server]; programs.fish.shellAbbrs = nvimAlias; programs.bash.shellAliases = nvimAlias; programs.zsh.shellAliases = nvimAlias;