Files
nix/hosts/common/configs/user/gui/hyprland/default.nix
Nikolaos Karaolidis b631d466ff Add asusctl settings
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
2025-05-25 21:18:28 +01:00

182 lines
4.8 KiB
Nix

{
user ? throw "user argument is required",
home ? throw "home argument is required",
}:
{
config,
lib,
pkgs,
...
}:
{
nixpkgs.overlays = [
(final: prev: {
hyprland = prev.hyprland.overrideAttrs (oldAttrs: {
patches = oldAttrs.patches or [ ] ++ [
./auto-center.patch
./maxwidth-resolution-mode.patch
];
});
})
];
programs.hyprland.enable = true;
home-manager.users.${user} = {
imports = [ ./options.nix ];
wayland.windowManager.hyprland = {
enable = true;
settings = {
"$mod" = "Super";
"$term" = lib.meta.getExe pkgs.kitty;
bind =
let
bindHelper = lib.meta.getExe (
pkgs.writeShellApplication {
name = "hyprland-bind-helper";
bashOptions = [
"errexit"
"pipefail"
];
runtimeInputs = with pkgs; [ hyprland ];
text = builtins.readFile ./scripts/bind.sh;
}
);
in
[
"$mod, Return, exec, $term"
"$mod, 1, exec, ${bindHelper} 1"
"$mod, 2, exec, ${bindHelper} 2"
"$mod, 3, exec, ${bindHelper} 3"
"$mod, 4, exec, ${bindHelper} 4"
"$mod, 5, exec, ${bindHelper} 5"
"$mod, 6, exec, ${bindHelper} 6"
"$mod, 7, exec, ${bindHelper} 7"
"$mod, 8, exec, ${bindHelper} 8"
"$mod, 9, exec, ${bindHelper} 9"
"$mod, 0, exec, ${bindHelper} 10"
"$mod_Ctrl, 1, exec, ${bindHelper} -m 1"
"$mod_Ctrl, 2, exec, ${bindHelper} -m 2"
"$mod_Ctrl, 3, exec, ${bindHelper} -m 3"
"$mod_Ctrl, 4, exec, ${bindHelper} -m 4"
"$mod_Ctrl, 5, exec, ${bindHelper} -m 5"
"$mod_Ctrl, 6, exec, ${bindHelper} -m 6"
"$mod_Ctrl, 7, exec, ${bindHelper} -m 7"
"$mod_Ctrl, 8, exec, ${bindHelper} -m 8"
"$mod_Ctrl, 9, exec, ${bindHelper} -m 9"
"$mod_Ctrl, 0, exec, ${bindHelper} -m 10"
"$mod, x, togglespecialworkspace"
"$mod_Ctrl, x, movetoworkspace, special"
"$mod, h, movefocus, l"
"$mod, j, movefocus, d"
"$mod, k, movefocus, u"
"$mod, l, movefocus, r"
"$mod_Shift, h, movewindow, l"
"$mod_Shift, j, movewindow, d"
"$mod_Shift, k, movewindow, u"
"$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, h, resizeactive, -20 0"
"$mod_Ctrl, j, resizeactive, 0 20"
"$mod_Ctrl, k, resizeactive, 0 -20"
"$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";
};
general.layout = "master";
master = {
orientation = "center";
slave_count_for_center_master = 0;
mfact = 0.5;
};
gestures = {
workspace_swipe = true;
workspace_swipe_min_fingers = true;
workspace_swipe_forever = true;
workspace_swipe_cancel_ratio = 0.2;
};
decoration.blur = {
passes = 2;
popups = true;
};
input.touchpad.natural_scroll = true;
xwayland.force_zero_scaling = true;
misc = {
disable_hyprland_logo = true;
disable_splash_rendering = true;
new_window_takes_over_fullscreen = 2;
};
ecosystem = {
no_update_news = true;
no_donation_nag = true;
};
};
extraConfig = "source = ./theme.conf";
};
programs.zsh.loginExtra = lib.mkAfter ''
if [ -z "$WAYLAND_DISPLAY" ] && [ -n "$XDG_VTNR" ] && [ "$XDG_VTNR" -eq 1 ]; then
Hyprland 2> >(systemd-cat -p err -t hyprland) 1> >(systemd-cat -p info -t hyprland)
fi
'';
theme = {
template.".config/hypr/theme.conf".source = ./theme.conf;
reloadExtraConfig = "${
lib.meta.getExe (
pkgs.writeShellApplication {
name = "reload-hyprland";
runtimeInputs = with pkgs; [ hyprland ];
text = "exec hyprctl reload";
}
)
} &";
};
home.sessionVariables.NIXOS_OZONE_WL = "1";
};
}