140 lines
3.6 KiB
Nix
140 lines
3.6 KiB
Nix
{
|
|
pkgs,
|
|
lib,
|
|
config,
|
|
...
|
|
}: let
|
|
services = let
|
|
inherit (pkgs) ironbar swaynotificationcenter;
|
|
in [
|
|
ironbar
|
|
swaynotificationcenter
|
|
];
|
|
errata = let
|
|
inherit (pkgs) anyrun;
|
|
in [
|
|
anyrun
|
|
];
|
|
extraServices = let
|
|
inherit (pkgs) swayidle swaylock swaybg systemd niri-unstable;
|
|
in [
|
|
{
|
|
name = "swaybg";
|
|
value = "${lib.getExe swaybg} -m fill -i /home/${config.mainUser}/.nix/wallpaper.jpg";
|
|
}
|
|
{
|
|
name = "swayidle";
|
|
value = let
|
|
lock = lib.getExe pkgs.swaylock;
|
|
niri = lib.getExe niri-unstable;
|
|
systemctl = lib.getExe' systemd "systemctl";
|
|
in ''
|
|
${lib.getExe swayidle} -w \
|
|
timeout 1200 '${systemctl} suspend' \
|
|
timeout 601 '${niri} msg action power-off-monitors' \
|
|
timeout 600 '${lock} -f' \
|
|
before-sleep '${lock} -f'
|
|
'';
|
|
}
|
|
];
|
|
in {
|
|
home.packages = errata;
|
|
ezServices = let
|
|
attrify =
|
|
map (entry: {
|
|
name = "${entry.pname}";
|
|
value = "${lib.getExe entry}";
|
|
})
|
|
services;
|
|
in
|
|
builtins.listToAttrs (
|
|
attrify
|
|
++ extraServices
|
|
);
|
|
programs.niri.settings = let
|
|
inherit (lib) range nameValuePair mapAttrs';
|
|
inherit (builtins) listToAttrs replaceStrings;
|
|
inherit (config.lib.niri) actions;
|
|
in {
|
|
binds = let
|
|
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 0 6));
|
|
in
|
|
{
|
|
"Mod+D".action.spawn = "anyrun";
|
|
"Mod+F".action.spawn = "firefox";
|
|
"Mod+E".action.spawn = "nautilus";
|
|
"Mod+Return".action.spawn = "kitty";
|
|
"Mod+Shift+E".action.spawn = "wlogout";
|
|
"Mod+Shift+Q".action = actions.close-window;
|
|
"Mod+Shift+S".action = actions.screenshot;
|
|
"Mod+R".action = actions.switch-preset-column-width;
|
|
"Mod+Shift+Space".action = actions.maximize-column;
|
|
}
|
|
// makeDirBind "Mod" "focus-window-or-workspace-$DIR" vBinds
|
|
// makeDirBind "Mod" "focus-column-or-monitor-$DIR" hBinds
|
|
// makeDirBind "Mod+Shift" "move-window-to-workspace-$DIR" vBinds
|
|
// makeDirBind "Mod+Shift" "move-column-$DIR-or-to-monitor-$DIR" hBinds
|
|
// makeDirBind "Mod+Ctrl" "consume-or-expel-window-$DIR" hBinds
|
|
// makeWsBind "Mod" "focus-workspace"
|
|
// makeWsBind "Mod+Shift" "move-window-to-workspace";
|
|
prefer-no-csd = true;
|
|
outputs = {
|
|
"Unknown-1".enable = false;
|
|
"HDMI-A-2" = {
|
|
transform.rotation = 90;
|
|
scale = 1;
|
|
};
|
|
"DP-1" = {
|
|
variable-refresh-rate = true;
|
|
scale = 1;
|
|
};
|
|
};
|
|
input = {
|
|
warp-mouse-to-focus = true;
|
|
workspace-auto-back-and-forth = true;
|
|
};
|
|
cursor = {
|
|
hide-after-inactive-ms = 5000;
|
|
hide-when-typing = true;
|
|
size = 16;
|
|
};
|
|
layout = {
|
|
always-center-single-column = true;
|
|
gaps = 24;
|
|
default-column-width.proportion = 0.5;
|
|
preset-column-widths =
|
|
map
|
|
(p: {proportion = p;})
|
|
[
|
|
(2.0 / 3.0)
|
|
0.5
|
|
(1.0 / 3.0)
|
|
];
|
|
};
|
|
};
|
|
|
|
programs.swaylock = {
|
|
enable = true;
|
|
settings.color = (pkgs.lib.nix-rice.palette.toRGBShortHex pkgs.rice.palette).normal.black;
|
|
};
|
|
}
|