user services + wm in hjr, some qs workaround

This commit is contained in:
atagen 2025-10-29 12:27:35 +11:00
parent 9e3aa574eb
commit cb44e16d76
19 changed files with 393 additions and 361 deletions

View file

@ -1,122 +1,137 @@
_: { }
# TODO rewrite this with hjem-rum
# {
# pkgs,
# lib,
# config,
# inputs,
# scope,
# ...
# }:
# let
# inherit (lib)
# range
# nameValuePair
# mapAttrs'
# mergeAttrsList
# ;
# inherit (builtins) listToAttrs replaceStrings;
# inherit (config.hm.lib.niri) actions;
# hBinds = {
# H = "left";
# L = "right";
# };
# vBinds = {
# J = "down";
# K = "up";
# };
# makeDirBind =
# mods: cmd: keys:
# mapAttrs' (
# key: dir:
# nameValuePair "${mods}+${key}" {
# action = actions."${replaceStrings [ "$DIR" ] [ "${dir}" ] "${cmd}"}";
# }
# ) keys;
# makeWsBind =
# mods: cmd:
# listToAttrs (
# map (num: {
# name = "${mods}+${builtins.toString num}";
# value = {
# action."${cmd}" = num;
# };
# }) (range 1 6)
# );
# tagctl = lib.getExe' inputs.niri-tag.packages.${pkgs.system}.unstable "tagctl";
# makeTagBind =
# mods: cmd:
# listToAttrs (
# map (num: {
# name = "${mods}+${builtins.toString num}";
# value = {
# action.spawn = [
# tagctl
# cmd
# (builtins.toString num)
# ];
# };
# }) (range 1 6)
# );
# in
# scope "hm.programs.niri.settings" {
# binds = mergeAttrsList [
# {
# "Mod+D".action.spawn = [
# "qs"
# "ipc"
# "call"
# "launch"
# "toggle"
# ];
# "Mod+F".action.spawn = "firefox";
# "Mod+E".action.spawn = "nautilus";
# "Mod+Return".action.spawn = "foot";
# "Mod+Shift+E".action.spawn = "wlogout";
# "Mod+Equal".action.spawn = "bitwarden";
# "Mod+Shift+Q".action = actions.close-window;
# "Mod+Shift+S".action = actions.screenshot;
# "Mod+R".action = actions.switch-preset-column-width;
# "Mod+Shift+R".action = actions.maximize-column;
# "XF86AudioRaiseVolume".action.spawn = [
# "volumectl"
# "-u"
# "up"
# ];
# "XF86AudioLowerVolume".action.spawn = [
# "volumectl"
# "-u"
# "down"
# ];
# "XF86AudioMute".action.spawn = [
# "volumectl"
# "toggle-mute"
# ];
# "XF86AudioStop".action.spawn = [
# "playerctl"
# "stop"
# ];
# "XF86AudioPlay".action.spawn = [
# "playerctl"
# "play-pause"
# ];
# "XF86AudioNext".action.spawn = [
# "playerctl"
# "next"
# ];
# "XF86AudioPrev".action.spawn = [
# "playerctl"
# "previous"
# ];
# "Mod+Space".action = actions.toggle-window-floating;
# }
# (makeDirBind "Mod" "focus-window-$DIR" vBinds)
# (makeDirBind "Mod" "focus-column-or-monitor-$DIR" hBinds)
# (makeDirBind "Mod+Shift" "move-column-$DIR-or-to-monitor-$DIR" hBinds)
# (makeDirBind "Mod+Ctrl" "consume-or-expel-window-$DIR" hBinds)
# (makeDirBind "Mod+Ctrl" "move-window-$DIR" vBinds)
# (makeTagBind "Mod" "toggle-tag")
# (makeTagBind "Mod+Shift" "toggle")
# (makeTagBind "Mod+Ctrl" "exclusive-tag")
# ];
# }
{
lib,
config,
scope,
...
}:
let
inherit (lib)
range
nameValuePair
mapAttrs'
mergeAttrsList
;
inherit (builtins) listToAttrs replaceStrings;
hBinds = {
H = "left";
L = "right";
};
vBinds = {
J = "down";
K = "up";
};
makeDirBind =
mods: cmd: keys:
mapAttrs' (
key: dir:
nameValuePair "${mods}+${key}" {
action = "${replaceStrings [ "$DIR" ] [ "${dir}" ] "${cmd}"}";
}
) keys;
makeTagBind =
mods: cmd:
listToAttrs (
map (num: {
name = "${mods}+${builtins.toString (lib.mod num 10)}";
value = {
spawn = [
"tagctl"
cmd
(builtins.toString num)
];
};
}) (range 1 10)
);
getApp = app: lib.singleton (lib.getExe config.apps.${app});
in
scope "user.desktops.niri.binds"
<| mergeAttrsList [
{
"Mod+Grave".action = "focus-monitor-next";
"Mod+Shift+Grave".action = "move-column-to-monitor-next";
"Mod+Minus".spawn = [
"tagctl"
"toggle-tag"
"99"
];
"Mod+Equal".spawn = [
"tagctl"
"toggle-tag"
"101"
];
"Mod+D".spawn = [
"qs"
"ipc"
"call"
"launch"
"toggle"
];
"Mod+F".spawn = (getApp "browser");
"Mod+E".spawn = (getApp "fm");
"Mod+Return".spawn = (getApp "terminal");
"Mod+Shift+E".spawn = [
"qs"
"ipc"
"call"
"logout"
"toggle"
];
# "Mod+Equal".spawn = (getAppName "passwordManager"); # niri-tag needs proper scratchpads smh
"Mod+Shift+Q".action = "close-window";
"Mod+Shift+S".action = "screenshot";
"Mod+R".action = "switch-preset-column-width";
"Mod+Shift+R".action = "maximize-column";
"XF86AudioLowerVolume".spawn = [
"volumectl"
"-u"
"down"
];
"XF86AudioMute".spawn = [
"volumectl"
"toggle-mute"
];
"XF86AudioNext".spawn = [
"playerctl"
"next"
];
"XF86AudioPlay".spawn = [
"playerctl"
"play-pause"
];
"XF86AudioPrev".spawn = [
"playerctl"
"previous"
];
"XF86AudioRaiseVolume".spawn = [
"volumectl"
"-u"
"up"
];
"XF86AudioStop".spawn = [
"playerctl"
"stop"
];
"XF86MonBrightnessUp".spawn = [
"brightnessctl"
"s"
"5%+"
];
"XF86MonBrightnessDown".spawn = [
"brightnessctl"
"s"
"5%-"
];
"Mod+Space".action = "switch-focus-between-floating-and-tiling";
"Mod+Shift+Space".action = "toggle-window-floating";
"Mod+Ctrl+Space".action = "fullscreen-window";
"Mod+C".action = "center-window";
}
(makeDirBind "Mod" "focus-window-$DIR" vBinds)
(makeDirBind "Mod" "focus-column-or-monitor-$DIR" hBinds)
(makeDirBind "Mod+Shift" "consume-or-expel-window-$DIR" hBinds)
(makeDirBind "Mod+Ctrl" "move-column-$DIR-or-to-monitor-$DIR" hBinds)
(makeDirBind "Mod+Ctrl" "move-window-$DIR" vBinds)
(makeTagBind "Mod" "toggle-tag")
(makeTagBind "Mod+Shift" "toggle")
(makeTagBind "Mod+Ctrl" "exclusive-tag")
]