{ config, lib, pkgs, accentColour ? "base07", catppuccinVariant ? "Mocha", ... }: { stylix.targets.xresources.enable = true; imports = [ ../default.nix ../email/default.nix ../password-store/default.nix ../waybar/default.nix ../rofi/default.nix ../swaync/default.nix ../avizo/default.nix ../alacritty/default.nix ../emacs/default.nix ../nyxt/default.nix ../obs/default.nix ../cava/default.nix ]; home.packages = with pkgs; [ (writeShellScriptBin "protonmail-setup-bridge" '' pkill -9 -f protonmail-bridge ${protonmail-bridge}/bin/protonmail-bridge -c ${config.wayland.windowManager.hyprland.finalPackage}/bin/hyprctl dispatch exec "${protonmail-bridge}/bin/protonmail-bridge -n" '') ]; programs = { rofi = with pkgs; { package = rofi-wayland; terminal = "${alacritty}/bin/alacritty"; pass.package = rofi-pass-wayland; }; zellij.settings.copy_command = "wl-copy"; }; services = { gpg-agent.pinentryPackage = pkgs.pinentry-gtk2; avizo.enable = true; syncthing.enable = true; udiskie = { enable = true; notify = true; automount = true; tray = "never"; }; }; gtk = with lib.strings; let accent = "Lavender"; size = "Standard"; in { enable = true; iconTheme = { package = pkgs.catppuccin-papirus-folders.override { accent = toLower accent; flavor = toLower catppuccinVariant; }; name = "Papirus-Dark"; }; theme = { package = with lib.strings; pkgs.catppuccin-gtk.override { accents = [(toLower accent)]; size = toLower size; variant = toLower catppuccinVariant; }; name = "Catppuccin-${catppuccinVariant}-${size}-${accent}-Dark"; }; }; systemd.user.services.hyprpaper = { Unit = { Description = "Hyprland wallpaper utility"; Wants = ["hyprland-session.target"]; After = ["hyprland-session.target"]; }; Service = { Environment = ["PATH=/run/current-system/sw/bin/:$PATH"]; Restart = "always"; ExecStart = "${pkgs.hyprpaper}/bin/hyprpaper"; }; Install.WantedBy = ["default.target"]; }; wayland.windowManager.hyprland = { enable = true; xwayland.enable = true; systemd.enable = true; settings = { monitor = [",preferred,auto,auto"]; env = with config; [ "XDG_CURRENT_DESKTOP=Hyprland" "XDG_SESSION_TYPE=wayland" "XDG_SESSION_DESKTOP=Hyprland" "GDK_BACKEND=wayland,x11" "GTK_THEME,${gtk.theme.name}" "XCURSOR_THEME,${stylix.cursor.name}" "XCURSOR_SIZE,${toString stylix.cursor.size}" "QT_AUTO_SCREEN_SCALE_FACTOR,1" "QT_QPA_PLATFORM,wayland" "QT_WAYLAND_DISABLE_WINDOWDECORATION,1" "MOZ_ENABLE_WAYLAND,1" "GRIM_DEFAULT_DIR=${xdg.userDirs.pictures}/Grim" ]; exec-once = with config; [ "${wayland.windowManager.hyprland.finalPackage}/bin/hyprctl setcursor ${stylix.cursor.name} ${toString stylix.cursor.name}" "${pkgs.swaynotificationcenter}/bin/swaync" "${pkgs.libsForQt5.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1" "${pkgs.protonmail-bridge}/bin/protonmail-bridge -n" ]; gestures.workspace_swipe = true; input = { kb_layout = "gb"; kb_options = "ctrl:nocaps"; follow_mouse = 1; touchpad.natural_scroll = "yes"; }; dwindle = { force_split = 2; preserve_split = false; smart_split = false; smart_resizing = false; special_scale_factor = 0.95; no_gaps_when_only = 0; use_active_for_splits = true; default_split_ratio = 1.0; }; master = { allow_small_split = true; special_scale_factor = 0.95; mfact = 0.5; new_is_master = false; new_on_top = false; no_gaps_when_only = 0; orientation = "left"; inherit_fullscreen = false; smart_resizing = false; drop_at_cursor = true; }; general = with config.lib.stylix; with colors; { "col.active_border" = "rgb(${colors.${accentColour}})"; "col.inactive_border" = "rgb(${base03})"; gaps_in = 5; gaps_out = 10; border_size = 1; cursor_inactive_timeout = 5; layout = "dwindle"; }; decoration = with config.lib.stylix.colors; { rounding = 10; "col.shadow" = "rgba(0d${base00})"; drop_shadow = "yes"; shadow_ignore_window = true; shadow_range = 4; shadow_render_power = 3; blur = { enabled = true; size = 5; passes = 3; new_optimizations = true; brightness = 1.0; noise = 2.0e-2; }; }; animations = { enabled = true; bezier = "myBezier, 0.05, 0.9, 0.1, 1.05"; animation = [ "windows, 1, 7, myBezier" "windowsOut, 1, 7, default, popin 80%" "border, 1, 10, default" "borderangle, 1, 8, default" "fade, 1, 7, default" "workspaces, 1, 6, default" ]; }; misc = { disable_splash_rendering = true; disable_autoreload = true; mouse_move_enables_dpms = true; key_press_enables_dpms = true; }; xwayland.force_zero_scaling = true; layerrule = let blur = x: "blur, ^(${x})$"; ignorealpha = x: "ignorealpha 0.3, ^(${x})$"; layers = [ "waybar" "system-menu" "rofi" "gtk-layer-shell" "notifications" "swaync-.*" "avizo" ]; in (lib.lists.forEach layers blur) ++ (lib.lists.forEach layers ignorealpha); windowrule = [ # Workspace binds "workspace 2 silent, firefox" "workspace 3 silent, (signal|whatsapp-for-linux|teams-for-linux)" "workspace 4 silent, (libreoffice|soffice)(.*)" "workspace 5 silent, steam" "workspace 6 silent, (WebCord|com.obsproject.Studio)" # Float + move system windows "float, org.kde.polkit-kde-authentication-agent-1|Pinentry" "center, org.kde.polkit-kde-authentication-agent-1|Pinentry" "pin, org.kde.polkit-kde-authentication-agent-1|Pinentry" "dimaround, org.kde.polkit-kde-authentication-agent-1|Pinentry" "stayfocused, org.kde.polkit-kde-authentication-agent-1|Pinentry" "float, pavucontrol|.blueman-manager-wrapped|nm-connection-editor" "size 800 600, pavucontrol|.blueman-manager-wrapped|nm-connection-editor" "move onscreen 100%-820 60,pavucontrol|.blueman-manager-wrapped|nm-connection-editor" # PrismLauncher / Minecraft "float, org.prismlauncher.PrismLauncher" "center, org.prismlauncher.PrismLauncher" "size 800 600, org.prismlauncher.PrismLauncher" ]; windowrulev2 = [ # Firefox PIP "float, title:Picture-in-Picture|Library,class:firefox" "size 750 400, title:Picture-in-Picture,class:firefox" "size 800 800, title:Library,class:firefox" "move onscreen 100%-775 100%-425, title:Picture-in-Picture,class:firefox" "center, title:Library,class:firefox" "pin, title:Picture-in-Picture,class:firefox" # LibreOffice "suppressevent fullscreen maximize, class:(libreoffice|soffice)(.*)" "float, title:Open,class:(libreoffice|soffice)(.*)" # Steam "float, title:Friends List,class:steam" "size 400 600, title:Friends List,class:steam" "float, title:(.*)(Chat),class:steam" "size 800 600, title:(.*)(Chat),class:steam" "float, title:Steam Settings,class:steam" "size 800 600, title:Steam Settings,class:steam" # X2Go / NoMachine "suppressevent fullscreen maximize, class:x2goclient|Nxplayer.bin" "float, title:(X2Go Client|Freia|Heimdall), class:x2goclient" "float, class:Nxplayer.bin" "center, title:(X2Go Client|Freia|Heimdall), class:x2goclient" "center, class:Nxplayer.bin" "size 800 600, title:X2Go Client, class:x2goclient" "size 1920 1080, title:Freia|Heimdall, class:x2goclient" "size 1920 1080, class:Nxplayer.bin" ]; bind = let withTerm = { term ? "alacritty", package ? config.programs.${term}.package, progname, args ? "", }: "${package}/bin/${term} -T ${progname} -e ${progname} ${args}"; workspace = w: [ "SUPER, ${toString w}, moveworkspacetomonitor, ${toString w} current" "SUPER, ${toString w}, workspace, ${toString w}" "SUPER SHIFT, ${toString w}, movetoworkspace, ${toString w}" ]; in with config.programs; with lib.lists; flatten (forEach (range 1 9) workspace) ++ (let btm_args = "--autohide_time --battery --celsius --enable_cache_memory --enable_gpu_memory --group --hide_avg_cpu --hide_table_gap --retention=3m --show_table_scroll_position"; in [ # See https://wiki.hyprland.org/Configuring/Keywords/ for more "SUPER, F1, exec, ${pkgs.hyprlock}/bin/hyprlock" "SUPER, Q, killactive," "SUPER SHIFT, Q, exec, pkill rofi || ${rofi.finalPackage}/bin/rofi -show powermenu -modi powermenu:${pkgs.rofi-power-menu}/bin/rofi-power-menu" "SUPER, V, togglefloating" "SUPER, F, fullscreen, 0" # Actual fullscreen "SUPER, M, fullscreen, 1" # Maximise window "SUPER, Z, exec, ${pkgs.swaynotificationcenter}/bin/swaync-client -t -sw" "SUPER SHIFT, Z, exec, ${pkgs.swaynotificationcenter}/bin/swaync-client -d -sw" # Common program shortcuts "SUPER, Return, exec, ${alacritty.package}/bin/alacritty" "SUPER, E, exec, ${emacs.finalPackage}/bin/emacsclient -c" "SUPER, W, exec, [workspace 2 silent] ${pkgs.firefox}/bin/firefox" "SUPER, T, exec, [workspace 3 silent] ${pkgs.xfce.thunar}/bin/thunar" # Rofi binds "SUPER, Space, exec, pkill rofi || ${rofi.finalPackage}/bin/rofi -show drun" "SUPER, tab, exec, pkill rofi || ${rofi.finalPackage}/bin/rofi -show window" "SUPER SHIFT, Return, exec, pkill rofi || ${rofi.finalPackage}/bin/rofi -show ssh" # rofi-pass binds "SUPER, P, exec, pkill rofi || ${rofi.pass.package}/bin/rofi-pass" "SUPER SHIFT, P, exec, pkill rofi || ${rofi.pass.package}/bin/rofi-pass --last-used" "SUPER ALT, P, exec, pkill rofi || ${rofi.pass.package}/bin/rofi-pass --insert" # Terminal utilities "SUPER, S, exec, ${withTerm { progname = "btm"; args = btm_args; }}" "SUPER SHIFT, S, exec, ${withTerm { progname = "btm"; args = btm_args + " --basic"; }}" "SUPER, C, exec, ${withTerm {progname = "cava";}}" # Misc useful binds '',Print,exec,${pkgs.grim}/bin/grim -g "$(${pkgs.slurp}/bin/slurp)"'' ",XF86Calculator,exec,pkill rofi || ${rofi.finalPackage}/bin/rofi -show calc" # Movement binds "SUPER, H, movefocus, l" "SUPER, L, movefocus, r" "SUPER, K, movefocus, u" "SUPER, J, movefocus, d" "SUPER SHIFT, H, movewindow, l" "SUPER SHIFT, L, movewindow, r" "SUPER SHIFT, K, movewindow, u" "SUPER SHIFT, J, movewindow, d" # Special workspaces "SUPER, comma, workspace, m-1" "SUPER SHIFT, comma, movetoworkspace, r-1" "SUPER, period, workspace, m+1" "SUPER SHIFT, period, movetoworkspace, r+1" "SUPER, N, workspace, empty" "SUPER SHIFT, N, movetoworkspace, empty" "SUPER, minus, togglespecialworkspace" "SUPER SHIFT, minus, movetoworkspace, special" "SUPER, bracketright, focusmonitor, +1" "SUPER SHIFT, bracketright, movecurrentworkspacetomonitor, +1" "SUPER, bracketleft, focusmonitor, -1" "SUPER SHIFT, bracketleft, movecurrentworkspacetomonitor, -1" "SUPER, O, focusurgentorlast" ]); bindl = with config.services; [ # Sound ",XF86AudioMute,exec,${avizo.package}/bin/volumectl %" ",XF86AudioMicMute,exec,${avizo.package}/bin/volumectl -m %" # Playback ",XF86AudioPlay,exec,${pkgs.playerctl}/bin/playerctl play-pause" ",XF86AudioStop,exec,${pkgs.playerctl}/bin/playerctl play-pause" ",XF86AudioPrev,exec,${pkgs.playerctl}/bin/playerctl previous" ",XF86AudioNext,exec,${pkgs.playerctl}/bin/playerctl next" ]; bindle = with config.services; [ # Sound ",XF86AudioRaiseVolume,exec,${avizo.package}/bin/volumectl -u + 5" ",XF86AudioLowerVolume,exec,${avizo.package}/bin/volumectl -u - 5" # Brightness ",XF86MonBrightnessUp,exec,${avizo.package}/bin/lightctl + 5" ",XF86MonBrightnessDown,exec,${avizo.package}/bin/lightctl - 5" ]; bindm = [ # Move/resize windows with mainMod + LMB/RMB and dragging "SUPER, mouse:272, movewindow" "SUPER, mouse:273, resizewindow" ]; }; extraConfig = '' exec-once = systemctl --user import-environment WAYLAND_DISPLAY QT_QPA_PLATFORMTHEME exec-once = systemctl --user restart "xdg-desktop-portal*" ''; }; xdg.configFile = { "hypr/hyprpaper.conf".text = '' preload = ${config.stylix.image} wallpaper = ,${config.stylix.image} ''; "hypr/hyprlock.conf".text = with config.lib.stylix.colors; let font = config.stylix.fonts.sansSerif.name; accent = config.lib.stylix.colors.${accentColour}; in '' # GENERAL general { disable_loading_bar = true } # BACKGROUND background { monitor = path = screenshot blur_passes = 3 color = 0xff${accent} } # TIME label { monitor = text = cmd[update:30000] echo "$(date +"%R")" color = 0xff${base05} font_size = 90 font_family = ${font} position = -30, 0 halign = right valign = top } # DATE label { monitor = text = cmd[update:43200000] echo "$(date +"%A,%e %B %Y")" color = 0xff${base05} font_size = 25 font_family = ${font} position = -30, -150 halign = right valign = top } # USER label { monitor = text = Logging in as $USER color = 0xff${base05} font_size = 25 font_family = ${font} position = 0, 50 halign = center valign = center } # INPUT FIELD input-field { monitor = size = 300, 60 outline_thickness = 2 dots_size = 0.2 # Scale of input-field height, 0.2 - 0.8 dots_spacing = 0.2 # Scale of dots' absolute size, 0.0 - 1.0 dots_center = true outer_color = 0xff${accent} inner_color = 0xff${base00} font_color = 0xff${base05} fade_on_empty = false placeholder_text = Input Password... hide_input = false position = 0, -50 halign = center valign = center } ''; }; }