From b1ee77f2c31ef12b71020a1e4713a59a11b4aadd Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Fri, 13 Dec 2024 17:53:50 +0100 Subject: [PATCH] Hyprland: Add basic custom config --- home/features/desktop/hyprland/config.nix | 263 ++++++++++----------- home/features/desktop/hyprland/default.nix | 29 +++ 2 files changed, 159 insertions(+), 133 deletions(-) diff --git a/home/features/desktop/hyprland/config.nix b/home/features/desktop/hyprland/config.nix index b526c2b..90aff2c 100644 --- a/home/features/desktop/hyprland/config.nix +++ b/home/features/desktop/hyprland/config.nix @@ -3,20 +3,19 @@ settings = { # autostart exec-once = [ - "picokontroller" + "picokontroller" "systemctl --user start hyprpolkitagent" - "busctl --user -- set-property rs.wl-gammarelay / rs.wl.gammarelay Temperature q 4000" - "hyprshade on bluelight" - "fcitx5" + "busctl --user -- set-property rs.wl-gammarelay / rs.wl.gammarelay Temperature q 4000" + "hyprshade on bluelight" + "fcitx5" + "webcord" ]; input = { kb_layout = "de"; numlock_by_default = true; follow_mouse = 1; - float_switch_override_focus = 0; - mouse_refocus = 0; - sensitivity = 0; + sensitivity = 0; # 0 means no modification touchpad = { natural_scroll = true; }; @@ -24,6 +23,8 @@ general = { "$mainMod" = "SUPER"; + "$terminal" = "alacritty"; + "$menu" = "wofi --show drun --allow-images --no-actions"; layout = "dwindle"; gaps_in = 5; gaps_out = 10; @@ -32,8 +33,13 @@ no_border_on_floating = false; }; + plugin = { + hyprsplit = { + num_workspaces = 10; + }; + }; + misc = { - disable_autoreload = true; disable_hyprland_logo = true; always_follow_on_dnd = true; layers_hog_keyboard_focus = true; @@ -45,172 +51,163 @@ }; dwindle = { - # no_gaps_when_only = false; - force_split = 0; - special_scale_factor = 1.0; - split_width_multiplier = 1.0; - use_active_for_splits = true; - pseudotile = "yes"; - preserve_split = "yes"; + pseudotile = true; + preserve_split = true; }; master = { new_status = "master"; - special_scale_factor = 1; - # no_gaps_when_only = false; }; decoration = { - # active_opacity = 0.90; - # inactive_opacity = 0.90; - # fullscreen_opacity = 1.0; + rounding = 10; blur = { enabled = true; size = 3; - passes = 2; - brightness = 1; - contrast = 1.4; - ignore_opacity = true; - noise = 0; - new_optimizations = true; - xray = true; + passes = 1; + vibrancy = 0.1696; }; shadow = { enabled = true; - - ignore_window = true; - offset = "0 2"; - range = 20; + range = 4; render_power = 3; }; }; + animations = { + enabled = true; + + # Default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more + + bezier = [ + "easeOutQuint,0.23,1,0.32,1" + "easeInOutCubic,0.65,0.05,0.36,1" + "linear,0,0,1,1" + "almostLinear,0.5,0.5,0.75,1.0" + "quick,0.15,0,0.1,1" + ]; + + animation = [ + "global, 1, 10, default" + "border, 1, 5.39, easeOutQuint" + "windows, 1, 4.79, easeOutQuint" + "windowsIn, 1, 4.1, easeOutQuint, popin 87%" + "windowsOut, 1, 1.49, linear, popin 87%" + "fadeIn, 1, 1.73, almostLinear" + "fadeOut, 1, 1.46, almostLinear" + "fade, 1, 3.03, quick" + "layers, 1, 3.81, easeOutQuint" + "layersIn, 1, 4, easeOutQuint, fade" + "layersOut, 1, 1.5, linear, fade" + "fadeLayersIn, 1, 1.79, almostLinear" + "fadeLayersOut, 1, 1.39, almostLinear" + "workspaces, 1, 1.94, almostLinear, fade" + "workspacesIn, 1, 1.21, almostLinear, fade" + "workspacesOut, 1, 1.94, almostLinear, fade" + ]; + }; + bind = [ - # show keybinds list - "$mainMod, F1, exec, show-keybinds" + "$mainMod, Return, exec, $terminal" + "$mainMod SHIFT, C, killactive" + "$mainMod SHIFT, Q, exit" + "$mainMod, V, togglefloating" + "$mainMod, Space, exec, $menu" + "$mainMod, P, pseudo" # dwindle + "$mainMod, J, togglesplit" # dwindle - # keybindings - "$mainMod, Return, exec, alacritty" - "$mainMod, B, exec, hyprctl dispatch exec '[workspace 1 silent] zen'" - "$mainMod, Q, killactive," - "$mainMod, F, fullscreen, 0" - "$mainMod SHIFT, F, fullscreen, 1" - "$mainMod, Space, exec, toggle_float" - "$mainMod, D, exec, rofi -show drun || pkill rofi" - "$mainMod SHIFT, D, exec, webcord --enable-features=UseOzonePlatform --ozone-platform=wayland" - "$mainMod SHIFT, S, exec, hyprctl dispatch exec '[workspace 5 silent] SoundWireServer'" - "$mainMod, Escape, exec, swaylock" - "ALT, Escape, exec, hyprlock" - "$mainMod SHIFT, Escape, exec, power-menu" - "$mainMod, P, pseudo," - "$mainMod, X, togglesplit," - "$mainMod, T, exec, toggle_oppacity" - "$mainMod CTRL, E, exec, nemo" - "$mainMod, E, exec, hyprctl dispatch exec '[float; center; size 1111 700] nemo'" - "$mainMod SHIFT, B, exec, toggle_waybar" - "$mainMod, C ,exec, hyprpicker -a" - "$mainMod, W,exec, wallpaper-picker" - "$mainMod SHIFT, W,exec, hyprctl dispatch exec '[float; center; size 925 615] waypaper'" - "$mainMod, N, exec, swaync-client -t -sw" - # "$mainMod SHIFT, W, exec, vm-start" - - # screenshot - ",Print, exec, screenshot --copy" - "$mainMod, Print, exec, screenshot --save" - "$mainMod SHIFT, Print, exec, screenshot --swappy" - - # switch focus + # Move focus with mainMod + arrow keys "$mainMod, left, movefocus, l" "$mainMod, right, movefocus, r" "$mainMod, up, movefocus, u" "$mainMod, down, movefocus, d" - "$mainMod, h, movefocus, l" - "$mainMod, j, movefocus, d" - "$mainMod, k, movefocus, u" - "$mainMod, l, movefocus, r" - # switch workspace - "$mainMod, 1, workspace, 1" - "$mainMod, 2, workspace, 2" - "$mainMod, 3, workspace, 3" - "$mainMod, 4, workspace, 4" - "$mainMod, 5, workspace, 5" - "$mainMod, 6, workspace, 6" - "$mainMod, 7, workspace, 7" - "$mainMod, 8, workspace, 8" - "$mainMod, 9, workspace, 9" - "$mainMod, 0, workspace, 10" + # Switch workspaces with mainMod + [0-9] + "$mainMod, 1, split:workspace, 1" + "$mainMod, 2, split:workspace, 2" + "$mainMod, 3, split:workspace, 3" + "$mainMod, 4, split:workspace, 4" + "$mainMod, 5, split:workspace, 5" + "$mainMod, 6, split:workspace, 6" + "$mainMod, 7, split:workspace, 7" + "$mainMod, 8, split:workspace, 8" + "$mainMod, 9, split:workspace, 9" + "$mainMod, 0, split:workspace, 10" - # same as above, but switch to the workspace - "$mainMod SHIFT, 1, movetoworkspacesilent, 1" # movetoworkspacesilent - "$mainMod SHIFT, 2, movetoworkspacesilent, 2" - "$mainMod SHIFT, 3, movetoworkspacesilent, 3" - "$mainMod SHIFT, 4, movetoworkspacesilent, 4" - "$mainMod SHIFT, 5, movetoworkspacesilent, 5" - "$mainMod SHIFT, 6, movetoworkspacesilent, 6" - "$mainMod SHIFT, 7, movetoworkspacesilent, 7" - "$mainMod SHIFT, 8, movetoworkspacesilent, 8" - "$mainMod SHIFT, 9, movetoworkspacesilent, 9" - "$mainMod SHIFT, 0, movetoworkspacesilent, 10" - "$mainMod CTRL, c, movetoworkspace, empty" + # Move active window to a workspace with mainMod + SHIFT + [0-9] + "$mainMod SHIFT, 1, split:movetoworkspacesilent, 1" + "$mainMod SHIFT, 2, split:movetoworkspacesilent, 2" + "$mainMod SHIFT, 3, split:movetoworkspacesilent, 3" + "$mainMod SHIFT, 4, split:movetoworkspacesilent, 4" + "$mainMod SHIFT, 5, split:movetoworkspacesilent, 5" + "$mainMod SHIFT, 6, split:movetoworkspacesilent, 6" + "$mainMod SHIFT, 7, split:movetoworkspacesilent, 7" + "$mainMod SHIFT, 8, split:movetoworkspacesilent, 8" + "$mainMod SHIFT, 9, split:movetoworkspacesilent, 9" + "$mainMod SHIFT, 0, split:movetoworkspacesilent, 10" - # window control - "$mainMod SHIFT, left, movewindow, l" - "$mainMod SHIFT, right, movewindow, r" - "$mainMod SHIFT, up, movewindow, u" - "$mainMod SHIFT, down, movewindow, d" - "$mainMod SHIFT, h, movewindow, l" - "$mainMod SHIFT, j, movewindow, d" - "$mainMod SHIFT, k, movewindow, u" - "$mainMod SHIFT, l, movewindow, r" + # Example special workspace (scratchpad) + "$mainMod, S, togglespecialworkspace, magic" + "$mainMod SHIFT, S, movetoworkspace, special:magic" - "$mainMod CTRL, left, resizeactive, -80 0" - "$mainMod CTRL, right, resizeactive, 80 0" - "$mainMod CTRL, up, resizeactive, 0 -80" - "$mainMod CTRL, down, resizeactive, 0 80" - "$mainMod CTRL, h, resizeactive, -80 0" - "$mainMod CTRL, j, resizeactive, 0 80" - "$mainMod CTRL, k, resizeactive, 0 -80" - "$mainMod CTRL, l, resizeactive, 80 0" - - "$mainMod ALT, left, moveactive, -80 0" - "$mainMod ALT, right, moveactive, 80 0" - "$mainMod ALT, up, moveactive, 0 -80" - "$mainMod ALT, down, moveactive, 0 80" - "$mainMod ALT, h, moveactive, -80 0" - "$mainMod ALT, j, moveactive, 0 80" - "$mainMod ALT, k, moveactive, 0 -80" - "$mainMod ALT, l, moveactive, 80 0" + # Scroll through existing workspaces with mainMod + scroll + "$mainMod, mouse_down, workspace, e+1" + "$mainMod, mouse_up, workspace, e-1" # media and volume controls - # ",XF86AudioMute,exec, pamixer -t" ",XF86AudioPlay,exec, playerctl play-pause" ",XF86AudioNext,exec, playerctl next" ",XF86AudioPrev,exec, playerctl previous" ",XF86AudioStop,exec, playerctl stop" - - "$mainMod, mouse_down, workspace, e-1" - "$mainMod, mouse_up, workspace, e+1" - - # clipboard manager - "$mainMod, V, exec, cliphist list | rofi -dmenu -theme-str 'window {width: 50%;} listview {columns: 1;}' | cliphist decode | wl-copy" ]; - # mouse binding + # Move/resize windows with mainMod + LMB/RMB and dragging bindm = [ "$mainMod, mouse:272, movewindow" "$mainMod, mouse:273, resizewindow" ]; + + windowrulev2 = [ + "suppressevent maximize, class:.*" # Ignore maximize requests from apps. You'll probably like this. + "nofocus,class:^$,title:^$,xwayland:1,floating:1,fullscreen:0,pinned:0" # Fix some dragging issues with XWayland + + "float, title:^(Picture-in-Picture)$" + "opacity 1.0 override 1.0 override, title:^(Picture-in-Picture)$" + "pin, title:^(Picture-in-Picture)$" + "float,class:^(pavucontrol)$" + "float,class:^(SoundWireServer)$" + "float,class:^(.sameboy-wrapped)$" + "float,class:^(file_progress)$" + "float,class:^(confirm)$" + "float,class:^(dialog)$" + "float,class:^(download)$" + "float,class:^(notification)$" + "float,class:^(error)$" + "float,class:^(confirmreset)$" + "float,title:^(Open File)$" + "float,title:^(File Upload)$" + "float,title:^(branchdialog)$" + "float,title:^(Confirm to replace files)$" + "float,title:^(File Operation Progress)$" + + # workspace setup + "workspace 10, class:^(feishin)$" + + # nextcloud + "float,class:^(com.nextcloud.desktopclient.nextcloud)$" + "stayfocused,class:^(com.nextcloud.desktopclient.nextcloud)$" # otherwise window immediately closes + + # Remove context menu transparency in chromium based apps + "opaque,class:^()$,title:^()$" + "noshadow,class:^()$,title:^()$" + "noblur,class:^()$,title:^()$" + ]; + + monitor = [ + ",preferred,auto,auto" + ]; }; - - extraConfig = " - monitor=,preferred,auto,auto - - xwayland { - force_zero_scaling = true - } - "; }; } diff --git a/home/features/desktop/hyprland/default.nix b/home/features/desktop/hyprland/default.nix index 9a639b8..5b202f8 100644 --- a/home/features/desktop/hyprland/default.nix +++ b/home/features/desktop/hyprland/default.nix @@ -9,6 +9,7 @@ in hyprpicker # hyprsunset # wl-gammarelay-rs + wofi hyprshade hyprpolkitagent grim @@ -25,10 +26,38 @@ in enable = true; xwayland.enable = true; systemd.enable = true; + plugins = [ pkgs.hyprlandPlugins.hyprsplit ]; }; programs.waybar = { enable = true; systemd.enable = true; + settings = { + mainBar = { + layer = "top"; + position = "top"; + + modules-left = [ "hyprland/workspaces" ]; + modules-center = [ "hyprland/window" ]; + modules-right = [ "tray" "memory" "cpu" "clock" ]; + + tray.spacing = 10; + + clock.tooltip-format = "{:%d.%m.%Y}"; + cpu.format = "{}%  "; + memory.format = " {}%  "; + + "hyprland/workspaces" = { + format = "{icon}"; + persistent-workspaces = { + "*" = 10; + }; + format-icons = { + "9" = ""; + "10" = "󰝚"; + }; + }; + }; + }; }; xdg.configFile."hypr/shaders/bluelight.glsl".text = ''