niri, ocaml meat

This commit is contained in:
atagen 2024-11-23 17:20:39 +11:00
parent cd61813078
commit c470c63ab2
25 changed files with 583 additions and 756 deletions

View file

@ -2,26 +2,33 @@
pkgs,
lib,
config,
inputs,
...
}: let
services = let
inherit (pkgs) ironbar swaynotificationcenter;
inherit (pkgs) swaynotificationcenter sway-audio-idle-inhibit;
in [
ironbar
swaynotificationcenter
sway-audio-idle-inhibit
];
errata = let
inherit (pkgs) anyrun;
inherit (pkgs) sirula avizo playerctl;
in [
anyrun
sirula
avizo
playerctl
];
extraServices = let
inherit (pkgs) swayidle swaylock swaybg systemd niri-unstable;
inherit (pkgs) swayidle swaybg systemd niri-unstable avizo;
in [
{
name = "swaybg";
value = "${lib.getExe swaybg} -m fill -i /home/${config.mainUser}/.nix/wallpaper.jpg";
}
{
name = "avizo-service";
value = "${lib.getExe' avizo "avizo-service"}";
}
{
name = "swayidle";
value = let
@ -30,27 +37,23 @@
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' \
timeout 1800 '${systemctl} suspend' \
timeout 600 '${niri} msg action power-off-monitors' \
timeout 599 '${lock} -f' \
before-sleep '${lock} -f'
'';
}
];
in {
home.packages = errata;
ezServices = let
attrify =
map (entry: {
name = "${entry.pname}";
ezServices = builtins.listToAttrs (
(map (entry: {
name = "${lib.strings.toLower entry.pname}";
value = "${lib.getExe entry}";
})
services;
in
builtins.listToAttrs (
attrify
++ extraServices
);
services)
++ extraServices
);
programs.niri.settings = let
inherit (lib) range nameValuePair mapAttrs';
inherit (builtins) listToAttrs replaceStrings;
@ -80,38 +83,45 @@ in {
}) (range 0 6));
in
{
"Mod+D".action.spawn = "anyrun";
"Mod+D".action.spawn = "sirula";
"Mod+F".action.spawn = "firefox";
"Mod+E".action.spawn = "nautilus";
"Mod+Return".action.spawn = "kitty";
"Mod+Shift+E".action.spawn = "wlogout";
"Mod+Equal".action.spawn = "keepassxc";
"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;
"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"];
}
// 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
// makeDirBind "Mod+Ctrl" "move-window-$DIR" vBinds
// 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;
};
"HDMI-A-2" = {
transform.rotation = 90;
scale = 1;
};
};
input = {
warp-mouse-to-focus = true;
workspace-auto-back-and-forth = true;
};
cursor = {
hide-after-inactive-ms = 5000;
@ -130,11 +140,87 @@ in {
0.5
(1.0 / 3.0)
];
focus-ring = let
pal = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette;
in {
active = {color = pal.bright.yellow;};
inactive = {color = pal.normal.black;};
};
};
prefer-no-csd = true;
hotkey-overlay.skip-at-startup = true;
};
programs.swaylock = {
enable = true;
settings.color = (pkgs.lib.nix-rice.palette.toRGBShortHex pkgs.rice.palette).normal.black;
};
programs.ironbar = {
enable = true;
systemd = true;
config = {
monitors."DP-1" = {
position = "top";
height = 16;
start = [
{
type = "music";
player_type = "mpris";
}
];
center = [
{
type = "focused";
icon_size = 16;
truncate = "middle";
}
];
end = [
{type = "clock";}
{type = "tray";}
];
};
};
};
systemd.user.services.ironbar = {
Unit.PartOf = ["graphical-session.target"];
Unit.After = [
"graphical-session.target"
"niri.service"
];
Install.WantedBy = ["graphical-session.target"];
};
xdg.configFile = {
"sirula/config.toml".text = ''
exclusive = false
icon_size = 24
lines = 2
anchor_left = false
anchor_right = true
anchor_bottom = false
anchor_top = false
width = 320
height = 720
command_prefix = ":"
frequent_first = true
recent_first = true
term_command = "kitty {}"
'';
"sirula/style.css".text = let
pal = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette;
in ''
#root-box {
background-color: ${pal.normal.black};
color: ${pal.normal.yellow};
font-family: '${pkgs.rice.fonts.sans.name}';
}
/* what's the name of the highlighted search text?
color: ${pal.normal.white};
*/
'';
};
}