From cb272240a44c9e9185bbbb0c807c559ae41677c6 Mon Sep 17 00:00:00 2001 From: js0ny Date: Mon, 10 Nov 2025 15:37:07 +0000 Subject: [PATCH] feat(niri): Some basic window-rules --- home/dot_config/nvim/lua/keymaps/buffer.lua | 22 ++++++++++++++++ nixcfgs/users/js0ny/packages/cli.nix | 2 ++ nixcfgs/users/js0ny/packages/gui.nix | 7 ++--- .../programs/desktop/wayland-wm/niri.nix | 26 +++++++++++++++++++ nixcfgs/users/js0ny/programs/shell/direnv.nix | 6 +++++ nixcfgs/users/js0ny/zephyrus.nix | 20 +++----------- 6 files changed, 61 insertions(+), 22 deletions(-) create mode 100644 nixcfgs/users/js0ny/programs/shell/direnv.nix diff --git a/home/dot_config/nvim/lua/keymaps/buffer.lua b/home/dot_config/nvim/lua/keymaps/buffer.lua index 227ef00..aba8aa7 100644 --- a/home/dot_config/nvim/lua/keymaps/buffer.lua +++ b/home/dot_config/nvim/lua/keymaps/buffer.lua @@ -1,3 +1,6 @@ +-- Use leader + m for `major`, inspired by emacs +-- If under mode = 'n' / 'v': m and will be added by default +-- If under `i` local bufmap = { markdown = { { mode = "x", keys = "i", cmd = 'c*"*', opt = { desc = "Add italic to selected text" } }, @@ -32,8 +35,27 @@ local bufmap = { { mode = "x", keys = "d", cmd = 'c+"+', opt = { desc = "Add strikethrough to selected text" } }, { mode = "x", keys = "h", cmd = 'c~"~', opt = { desc = "Add highlight to selected text" } }, }, + sh = { + { mode = "n", keys = "mx", cmd = "!chmod u+x %", opt = { desc = "Mark the file as executable" } }, + }, } +-- Shallow copy +local function extend(tbl1, tbl2) + local t = {} + for _, v in ipairs(tbl1 or {}) do + table.insert(t, v) + end + for _, v in ipairs(tbl2 or {}) do + table.insert(t, v) + end + return t +end + +for _, ft in ipairs({ "bash", "zsh", "fish", "python" }) do + bufmap[ft] = extend(bufmap[ft], bufmap.sh) +end + local function setup_buffer_maps(buffer_map) -- 遍历 buffer_map 中的每个文件类型 for ft, mappings in pairs(buffer_map) do diff --git a/nixcfgs/users/js0ny/packages/cli.nix b/nixcfgs/users/js0ny/packages/cli.nix index 8b0bacc..505863e 100644 --- a/nixcfgs/users/js0ny/packages/cli.nix +++ b/nixcfgs/users/js0ny/packages/cli.nix @@ -52,5 +52,7 @@ package-version-server gemini-cli codex + imagemagick + miniserve ]; } diff --git a/nixcfgs/users/js0ny/packages/gui.nix b/nixcfgs/users/js0ny/packages/gui.nix index 9561248..db1865e 100644 --- a/nixcfgs/users/js0ny/packages/gui.nix +++ b/nixcfgs/users/js0ny/packages/gui.nix @@ -1,8 +1,4 @@ -{ - pkgs, - lib, - ... -}: { +{pkgs, ...}: { home.packages = with pkgs; [ # Terminal Emulator ghostty # default @@ -63,6 +59,7 @@ zotero anki-bin feishin + rose-pine-cursor # Email protonmail-bridge diff --git a/nixcfgs/users/js0ny/programs/desktop/wayland-wm/niri.nix b/nixcfgs/users/js0ny/programs/desktop/wayland-wm/niri.nix index c1f8d49..b491def 100644 --- a/nixcfgs/users/js0ny/programs/desktop/wayland-wm/niri.nix +++ b/nixcfgs/users/js0ny/programs/desktop/wayland-wm/niri.nix @@ -97,6 +97,32 @@ in { app-id = "^anki$"; title = "^Add$"; } + # Dolphin compressing files + { + app-id = "^org.kde.dolphin$"; + title = "^Compressing.*$"; + } + { + app-id = "^thunar$"; + title = "^File Operation Progress$"; + } + ### IM Medias + { + app-id = "^QQ$"; + title = "^图片查看器$"; + } + { + app-id = "^org.telegram.desktop$"; + title = "^Media viewer$"; + } + { + app-id = "^wechat$"; + title = "^图片和视频$"; + } + { + app-id = "^org.pulseaudio.pavucontrol$"; + title = "^Volume Control$"; + } ]; open-floating = true; } diff --git a/nixcfgs/users/js0ny/programs/shell/direnv.nix b/nixcfgs/users/js0ny/programs/shell/direnv.nix new file mode 100644 index 0000000..3a7b8ad --- /dev/null +++ b/nixcfgs/users/js0ny/programs/shell/direnv.nix @@ -0,0 +1,6 @@ +{...}: { + programs.direnv = { + enable = true; + nix-direnv.enable = true; + }; +} diff --git a/nixcfgs/users/js0ny/zephyrus.nix b/nixcfgs/users/js0ny/zephyrus.nix index 93c62c1..0dbbc79 100644 --- a/nixcfgs/users/js0ny/zephyrus.nix +++ b/nixcfgs/users/js0ny/zephyrus.nix @@ -1,9 +1,5 @@ # ~/.config/nixcfgs/users/js0ny/default.nix -{ - pkgs, - config, - ... -}: { +{...}: { imports = [ # General config ./default.nix @@ -22,6 +18,7 @@ ./programs/shell/bash.nix ./programs/shell/zsh.nix ./programs/shell/fish.nix + ./programs/shell/direnv.nix # Personal Program ./programs/chromium.nix @@ -46,24 +43,13 @@ # General Program config ../../modules/home/programs/eza.nix - ../../modules/home/programs/winboat.nix + # ../../modules/home/programs/winboat.nix ../../modules/home/programs/lsd.nix ../../modules/home/programs/starship.nix ../../modules/home/programs/zoxide.nix # Development setup - ../../modules/home/dev/c.nix - ../../modules/home/dev/go.nix - ../../modules/home/dev/java.nix - ../../modules/home/dev/lua.nix ../../modules/home/dev/nix.nix - ../../modules/home/dev/python.nix - ../../modules/home/dev/typst.nix - ../../modules/home/dev/verilog.nix - ]; - - home.packages = with pkgs; [ - rose-pine-cursor ]; home.stateVersion = "25.05";