feat(niri): Some basic window-rules

This commit is contained in:
js0ny 2025-11-10 15:37:07 +00:00
parent 4053e59e2e
commit cb272240a4
6 changed files with 61 additions and 22 deletions

View file

@ -1,3 +1,6 @@
-- Use leader + m for `major`, inspired by emacs
-- If under mode = 'n' / 'v': <leader>m and <localleader> will be added by default
-- If under `i`
local bufmap = {
markdown = {
{ mode = "x", keys = "i", cmd = 'c*<C-r>"*', opt = { desc = "Add italic to selected text" } },
@ -32,8 +35,27 @@ local bufmap = {
{ mode = "x", keys = "d", cmd = 'c+<C-r>"+', opt = { desc = "Add strikethrough to selected text" } },
{ mode = "x", keys = "h", cmd = 'c~<C-r>"~', opt = { desc = "Add highlight to selected text" } },
},
sh = {
{ mode = "n", keys = "<leader>mx", cmd = "<cmd>!chmod u+x %<CR>", 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

View file

@ -52,5 +52,7 @@
package-version-server
gemini-cli
codex
imagemagick
miniserve
];
}

View file

@ -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

View file

@ -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;
}

View file

@ -0,0 +1,6 @@
{...}: {
programs.direnv = {
enable = true;
nix-direnv.enable = true;
};
}

View file

@ -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";