{ user, home }: { config, lib, pkgs, ... }: { programs.hyprland = { enable = true; withUWSM = true; }; home-manager.users.${user} = { wayland.windowManager.hyprland = { enable = true; systemd.enable = false; 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, uwsm app -- $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, exec, uwsm stop" ]; 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; }; cursor = { inactive_timeout = 3; hide_on_key_press = 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; }; # FIXME: https://github.com/ValveSoftware/gamescope/issues/1825 debug.full_cm_proto = true; }; extraConfig = "source = ./theme.conf"; }; programs.zsh = { loginExtra = lib.mkAfter '' if uwsm check may-start; then exec uwsm start hyprland-uwsm.desktop fi ''; initContent = '' launch() { if [[ $# -eq 0 ]]; then echo "Usage: launch [args...]" return 1 fi uwsm app -S both -- "$@" &! } ''; }; 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"; }; }