Files
nix/hosts/common/user/configs/gui/hyprland/default.nix
2024-07-16 18:50:25 +01:00

160 lines
4.3 KiB
Nix

{
username ? throw "username argument is required",
}:
{
config,
lib,
pkgs,
...
}:
let
hmConfig = config.home-manager.users.${username};
in
{
programs.hyprland.enable = true;
home-manager.users.${username} = {
imports = [ ./options.nix ];
wayland.windowManager.hyprland = {
enable = true;
settings = {
"$mod" = "Super_L";
"$term" = lib.meta.getExe pkgs.kitty;
bind = [
"$mod, Return, exec, $term"
"$mod, `, togglespecialworkspace"
"$mod, 1, workspace, 1"
"$mod, 2, workspace, 2"
"$mod, 3, workspace, 3"
"$mod, 4, workspace, 4"
"$mod, 5, workspace, 5"
"$mod, 6, workspace, 6"
"$mod, 7, workspace, 7"
"$mod, 8, workspace, 8"
"$mod, 9, workspace, 9"
"$mod, 0, workspace, 10"
"$mod_Shift, `, movetoworkspacesilent, special"
"$mod_Shift, 1, movetoworkspacesilent, 1"
"$mod_Shift, 2, movetoworkspacesilent, 2"
"$mod_Shift, 3, movetoworkspacesilent, 3"
"$mod_Shift, 4, movetoworkspacesilent, 4"
"$mod_Shift, 5, movetoworkspacesilent, 5"
"$mod_Shift, 6, movetoworkspacesilent, 6"
"$mod_Shift, 7, movetoworkspacesilent, 7"
"$mod_Shift, 8, movetoworkspacesilent, 8"
"$mod_Shift, 9, movetoworkspacesilent, 9"
"$mod_Shift, 0, movetoworkspacesilent, 10"
"$mod_Ctrl, Space, workspaceopt, allfloat"
"$mod, left, movefocus, l"
"$mod, h, movefocus, l"
"$mod, down, movefocus, d"
"$mod, j, movefocus, d"
"$mod, up, movefocus, u"
"$mod, k, movefocus, u"
"$mod, right, movefocus, r"
"$mod, l, movefocus, r"
"$mod_Shift, left, movewindow, l"
"$mod_Shift, h, movewindow, l"
"$mod_Shift, down, movewindow, d"
"$mod_Shift, j, movewindow, d"
"$mod_Shift, up, movewindow, u"
"$mod_Shift, k, movewindow, u"
"$mod_Shift, right, movewindow, r"
"$mod_Shift, l, movewindow, r"
"$mod, Tab, cyclenext"
"$mod, Tab, bringactivetotop"
"$mod_Shift, Tab, cyclenext, prev"
"$mod_Shift, Tab, bringactivetotop"
"$mod, f, fullscreen, 0"
"$mod, m, fullscreen, 1"
"$mod, p, pin"
"$mod, Space, togglefloating"
"$mod, Space, centerwindow"
"$mod, q, killactive"
"Ctrl_Alt, Delete, exit"
];
binde = [
"$mod_Ctrl, left, resizeactive, -20 0"
"$mod_Ctrl, h, resizeactive, -20 0"
"$mod_Ctrl, down, resizeactive, 0 20"
"$mod_Ctrl, j, resizeactive, 0 20"
"$mod_Ctrl, up, resizeactive, 0 -20"
"$mod_Ctrl, k, resizeactive, 0 -20"
"$mod_Ctrl, right, resizeactive, 20 0"
"$mod_Ctrl, l, resizeactive, 20 0"
];
bindm = [
"$mod, mouse:272, movewindow"
"$mod, mouse:273, resizewindow"
];
input = {
accel_profile = "flat";
kb_layout = "us,gr";
kb_options = "grp:alt_shift_toggle";
};
gestures = {
workspace_swipe = true;
workspace_swipe_min_fingers = true;
workspace_swipe_forever = true;
workspace_swipe_cancel_ratio = 0.2;
};
misc = {
disable_hyprland_logo = true;
disable_splash_rendering = true;
new_window_takes_over_fullscreen = 2;
};
decoration.blur = {
passes = 2;
popups = true;
};
input.touchpad.natural_scroll = true;
};
extraConfig = "source = ./theme.conf";
};
programs = {
zsh.loginExtra = lib.mkAfter ''
if [ -z "$WAYLAND_DISPLAY" ] && [ -n "$XDG_VTNR" ] && [ "$XDG_VTNR" -eq 1 ]; then
hyprland &> /tmp/hyprland.log
fi
'';
matugen.settings.templates.hyprland = {
input_path = ./theme.conf;
output_path = "${hmConfig.xdg.configHome}/hypr/theme.conf";
};
};
theme.extraConfig = "${
lib.meta.getExe (
pkgs.writeShellApplication {
name = "reload-hyprland";
runtimeInputs = with pkgs; [ hyprland ];
text = "exec hyprctl reload";
}
)
} &";
home.sessionVariables.NIXOS_OZONE_WL = "1";
};
}