270 lines
6.7 KiB
Nix
270 lines
6.7 KiB
Nix
{
|
|
pkgs,
|
|
lib,
|
|
config,
|
|
...
|
|
}:
|
|
let
|
|
services =
|
|
let
|
|
inherit (pkgs) swaynotificationcenter sway-audio-idle-inhibit;
|
|
in
|
|
[
|
|
swaynotificationcenter
|
|
sway-audio-idle-inhibit
|
|
];
|
|
errata =
|
|
let
|
|
inherit (pkgs) sirula avizo playerctl;
|
|
in
|
|
[
|
|
sirula
|
|
avizo
|
|
playerctl
|
|
];
|
|
extraServices =
|
|
let
|
|
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
|
|
niri = lib.getExe niri-unstable;
|
|
systemctl = lib.getExe' systemd "systemctl";
|
|
in
|
|
''
|
|
${lib.getExe swayidle} -w \
|
|
timeout 1800 '${systemctl} suspend' \
|
|
timeout 600 '${niri} msg action power-off-monitors'
|
|
'';
|
|
}
|
|
];
|
|
in
|
|
{
|
|
home.packages = errata;
|
|
ezServices = builtins.listToAttrs (
|
|
(map (entry: {
|
|
name = "${lib.strings.toLower entry.pname}";
|
|
value = "${lib.getExe entry}";
|
|
}) services)
|
|
++ 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 = "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+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-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";
|
|
outputs = {
|
|
# "Unknown-1".enable = false;
|
|
"DP-1" = {
|
|
transform.rotation = 90;
|
|
scale = 1;
|
|
};
|
|
"DP-2" = {
|
|
variable-refresh-rate = true;
|
|
scale = 1;
|
|
};
|
|
};
|
|
input = {
|
|
warp-mouse-to-focus = true;
|
|
};
|
|
cursor = {
|
|
hide-after-inactive-ms = 5000;
|
|
hide-when-typing = true;
|
|
size = 16;
|
|
theme = pkgs.rice.cursor.name;
|
|
};
|
|
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)
|
|
];
|
|
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.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};
|
|
*/
|
|
'';
|
|
};
|
|
}
|