2024-12-23 13:03:34 -05:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
2024-12-23 22:54:53 -05:00
|
|
|
pkgs,
|
2024-12-23 13:03:34 -05:00
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib; let
|
2024-12-31 12:44:17 -06:00
|
|
|
cfg = config.custom.desktops.niri.misc;
|
|
|
|
hm = config.home-manager.users.${config.custom.username};
|
|
|
|
|
2024-12-26 19:09:59 -05:00
|
|
|
_1password = "${config.programs._1password-gui.package}/bin/1password";
|
|
|
|
audio = config.home-manager.users.${config.custom.username}.home.file.".local/bin/audio".source;
|
2024-12-23 13:03:34 -05:00
|
|
|
niri = "${config.programs.niri.package}/bin/niri";
|
2024-12-26 19:09:59 -05:00
|
|
|
rm = "${pkgs.coreutils}/bin/rm";
|
2024-12-23 22:54:53 -05:00
|
|
|
sway-audio-idle-inhibit = "${pkgs.sway-audio-idle-inhibit}/bin/sway-audio-idle-inhibit";
|
2024-12-26 19:09:59 -05:00
|
|
|
wallpaper = "${config.home-manager.users.${config.custom.username}.home.file.".local/bin/wallpaper".source}";
|
2024-12-23 13:03:34 -05:00
|
|
|
in {
|
|
|
|
options.custom.desktops.niri.misc = {
|
|
|
|
enable = mkOption {default = false;};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2024-12-31 12:44:17 -06:00
|
|
|
home-manager.sharedModules = [
|
|
|
|
{
|
|
|
|
programs.niri.settings = {
|
|
|
|
# https://github.com/YaLTeR/niri/wiki/Configuration:-Miscellaneous
|
|
|
|
cursor = with hm.gtk.cursorTheme; {
|
|
|
|
# Inherit home-manager GTK settings
|
|
|
|
inherit size;
|
|
|
|
theme = name;
|
2024-12-23 13:03:34 -05:00
|
|
|
|
2024-12-31 12:44:17 -06:00
|
|
|
#// hide-after-inactive-ms = 1000 * 15; # Milliseconds
|
|
|
|
hide-when-typing = true;
|
|
|
|
};
|
2024-12-23 22:54:53 -05:00
|
|
|
|
2024-12-31 12:44:17 -06:00
|
|
|
# HACK: Inherit home-manager environment variables in lieu of upstream fix
|
|
|
|
# https://github.com/nix-community/home-manager/issues/2659
|
|
|
|
environment = mapAttrs (name: value: toString value) hm.home.sessionVariables;
|
2024-12-23 13:03:34 -05:00
|
|
|
|
2024-12-31 12:44:17 -06:00
|
|
|
hotkey-overlay.skip-at-startup = true;
|
|
|
|
prefer-no-csd = true;
|
2024-12-26 19:14:57 -05:00
|
|
|
|
2024-12-31 12:44:17 -06:00
|
|
|
#!! Not executed in a shell
|
|
|
|
# https://github.com/YaLTeR/niri/wiki/Configuration:-Key-Bindings#spawn
|
|
|
|
spawn-at-startup = let
|
|
|
|
home = hm.home.homeDirectory;
|
|
|
|
in
|
|
|
|
[
|
|
|
|
{command = [_1password "--silent"];} # Launch password manager in background
|
|
|
|
{command = [audio "--init"];} # Enforce audio profile state
|
|
|
|
{command = [rm "${home}/.cache/walker/clipboard.gob"];} # Clear clipboard history
|
|
|
|
{command = [sway-audio-idle-inhibit];} # Inhibit while audio is playing
|
|
|
|
]
|
|
|
|
++ optionals config.custom.wallpaper [
|
|
|
|
{command = [wallpaper];}
|
|
|
|
];
|
2024-12-23 13:03:34 -05:00
|
|
|
|
2024-12-31 12:44:17 -06:00
|
|
|
switch-events = {
|
|
|
|
# Turn display off while inhibiting suspend
|
|
|
|
lid-close.action.spawn = [niri "msg" "action" "power-off-monitors"];
|
|
|
|
lid-open.action.spawn = [niri "msg" "action" "power-on-monitors"];
|
|
|
|
};
|
2024-12-23 13:03:34 -05:00
|
|
|
};
|
2024-12-31 12:44:17 -06:00
|
|
|
}
|
|
|
|
];
|
2024-12-23 13:03:34 -05:00
|
|
|
};
|
|
|
|
}
|