diff --git a/hosts/ePower/default.nix b/hosts/ePower/default.nix index 4f317a3..238d66e 100644 --- a/hosts/ePower/default.nix +++ b/hosts/ePower/default.nix @@ -37,10 +37,10 @@ git.enable = true; hypr = { enable = true; - monitors = '' - monitor=,preferred,auto,auto - monitor=HDMI-A-1,preferred,auto,auto,transform,1 - ''; + monitors = [ + ",preferred,auto,auto" + "HDMI-A-1,preferred,auto,auto,transform,1" + ]; }; nvim.enable = true; nu.enable = true; diff --git a/modules/hyprland/default.nix b/modules/hyprland/default.nix index 2cb0f78..e497771 100644 --- a/modules/hyprland/default.nix +++ b/modules/hyprland/default.nix @@ -14,10 +14,10 @@ in { }; hypr.monitors = mkOption { description = "Monitor setup"; - type = types.str; - default = '' - monitor=,preferred,auto,auto - ''; + type = types.listOf types.str; + default = [ + ",preferred,auto,auto" + ]; }; hypr.cursor.size = mkOption { description = "Cursor size"; @@ -29,15 +29,9 @@ in { # if my-config.template.desktop.gnome.enable is set to true # set the following options config = mkIf config.my-config.hypr.enable { - programs.hyprland = { - enable = true; - xwayland = { - enable = true; - }; - }; - security.pam.services.swaylock = {}; + programs.dconf.enable = true; home-manager.users.ejiek = { home.packages = with pkgs; [ brightnessctl @@ -96,205 +90,180 @@ in { ''; }; - home.file = { - "./.config/hypr/hyprland.conf".text = '' - ${config.my-config.hypr.monitors} - - xwayland { - force_zero_scaling = true - } - - input { - kb_layout = us,ru - kb_variant = - kb_model = - kb_options = grp:caps_toggle,grp_led:caps - kb_rules = - - follow_mouse = 1 - - touchpad { - natural_scroll = true - } - - sensitivity = 0 # -1.0 - 1.0, 0 means no modification. - } - - general { - # See https://wiki.hyprland.org/Configuring/Variables/ for more - - gaps_in = 5 - gaps_out = 20 - border_size = 2 - col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg - col.inactive_border = rgba(595959aa) - - layout = ${config.my-config.hypr.layout} - } - - decoration { - # See https://wiki.hyprland.org/Configuring/Variables/ for more - - rounding = 5 - blur { - enabled = yes - size = 3 - passes = 1 - new_optimizations = on - } - - drop_shadow = yes - shadow_range = 4 - shadow_render_power = 3 - col.shadow = rgba(1a1a1aee) - } - - animations { - enabled = yes - - # Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more - - bezier = myBezier, 0.05, 0.9, 0.1, 1.05 - - animation = windows, 1, 7, myBezier - animation = windowsOut, 1, 7, default, popin 80% - animation = border, 1, 10, default - animation = fade, 1, 7, default - animation = workspaces, 1, 6, default - } - - dwindle { - # See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more - pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below - preserve_split = yes # you probably want this - no_gaps_when_only = true - } - - master { - # See https://wiki.hyprland.org/Configuring/Master-Layout/ for more - new_is_master = false - no_gaps_when_only = true - orientation = center - } - - gestures { - # See https://wiki.hyprland.org/Configuring/Variables/ for more - workspace_swipe = true - } - - # Example per-device config - # See https://wiki.hyprland.org/Configuring/Keywords/#executing for more - device:epic mouse V1 { - sensitivity = -0.5 - } - - # Example windowrule v1 - # windowrule = float, ^(kitty)$ - # Example windowrule v2 - # windowrulev2 = float,class:^(kitty)$,title:^(kitty)$ - # See https://wiki.hyprland.org/Configuring/Window-Rules/ for more - windowrule=move 100%-260 20,title:^(HealthBar)(.*)$ - windowrule=noblur,title:^(HealthBar)(.*)$ - windowrule=nofocus,title:^(HealthBar)(.*)$ - windowrule=noshadow,title:^(HealthBar)(.*)$ - windowrule=noborder,title:^(HealthBar)(.*)$ - windowrule=pin,title:^(HealthBar)(.*)$ - - # See https://wiki.hyprland.org/Configuring/Keywords/ for more - $mainMod = SUPER - - # Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more - bind = $mainMod, Return, exec, alacritty - bind = $mainMod, Space, exec, rofi -show drun - bind = $mainMod, P, exec, rofi-rbw - bind = $mainMod, E, exec, rofimoji - bind = $mainMod SHIFT, E, exec, rofi -show emoji - bind = $mainMod SHIFT, C, killactive, - bind = $mainMod SHIFT, Q, exec, swaylock -f -i ~/pictures/lock.jpg - bind = $mainMod, Q, exec, qutebrowser - bind = $mainMod SHIFT, F, togglefloating, - bind = $mainMod, F, fullscreen, 0 - - # Move windows - bind = $mainMod SHIFT, H, swapwindow, l - bind = $mainMod SHIFT, L, swapwindow, r - bind = $mainMod SHIFT, K, swapwindow, u - bind = $mainMod SHIFT, J, swapwindow, d - - # Move focus with mainMod + hjkl - bind = $mainMod, H, movefocus, l - bind = $mainMod, L, movefocus, r - bind = $mainMod, K, movefocus, u - bind = $mainMod, J, movefocus, d - - # Move focus to anothe monitor - bind = $mainMod, I, focusmonitor, l - bind = $mainMod, O, focusmonitor, r - - # Move window to anothe monitor - bind = $mainMod SHIFT, I, movewindow, mon:l - bind = $mainMod SHIFT, O, movewindow, mon:r - - # Switch workspaces with mainMod + [0-9] - bind = $mainMod, 1, workspace, 1 - bind = $mainMod, 2, workspace, 2 - bind = $mainMod, 3, workspace, 3 - bind = $mainMod, 4, workspace, 4 - bind = $mainMod, 5, workspace, 5 - bind = $mainMod, 6, workspace, 6 - bind = $mainMod, 7, workspace, 7 - bind = $mainMod, 8, workspace, 8 - bind = $mainMod, 9, workspace, 9 - bind = $mainMod, 0, workspace, 10 - - # Move active window to a workspace with mainMod + SHIFT + [0-9] - bind = $mainMod SHIFT, 1, movetoworkspace, 1 - bind = $mainMod SHIFT, 2, movetoworkspace, 2 - bind = $mainMod SHIFT, 3, movetoworkspace, 3 - bind = $mainMod SHIFT, 4, movetoworkspace, 4 - bind = $mainMod SHIFT, 5, movetoworkspace, 5 - bind = $mainMod SHIFT, 6, movetoworkspace, 6 - bind = $mainMod SHIFT, 7, movetoworkspace, 7 - bind = $mainMod SHIFT, 8, movetoworkspace, 8 - bind = $mainMod SHIFT, 9, movetoworkspace, 9 - bind = $mainMod SHIFT, 0, movetoworkspace, 10 - - # Scroll through existing workspaces with mainMod + scroll - bind = $mainMod, mouse_down, workspace, e+1 - bind = $mainMod, mouse_up, workspace, e-1 - - # Move/resize windows with mainMod + LMB/RMB and dragging - bindm = $mainMod, mouse:272, movewindow - bindm = $mainMod, mouse:273, resizewindow - - # Media keys - bind = ,XF86AudioRaiseVolume, exec, pw-volume change '+5%' - bind = ,XF86AudioLowerVolume, exec, pw-volume change '-5%' - bind = ,XF86AudioMute, exec, pw-volume mute toggle - bind = ,XF86MonBrightnessDown, exec, brightnessctl set '5%-' - bind = ,XF86MonBrightnessUp, exec, brightnessctl set '+5%' - - # Color picker - bind = $mainMod ALT, P, exec, hyprpicker --autocopy --no-fancy - - # Screenshots - bind = $mainMod, S, exec, TO_FILE=false FULL_SCREEN=true ~/.config/hypr/screenshot.sh - bind = $mainMod ALT, S, exec, TO_FILE=true FULL_SCREEN=true ~/.config/hypr/screenshot.sh - bind = $mainMod SHIFT, S, exec, TO_FILE=false FULL_SCREEN=false ~/.config/hypr/screenshot.sh - bind = $mainMod SHIFT ALT, S, exec, TO_FILE=true FULL_SCREEN=false ~/.config/hypr/screenshot.sh - - # Notifications - exec-once = ${pkgs.swaynotificationcenter}/bin/swaync - bind = $mainMod, N, exec, swaync-client --toggle-panel - bind = $mainMod, D, exec, swaync-client --toggle-dnd - - # Keyboard layout per window - exec-once = ${pkgs.hyprland-per-window-layout}/bin/hyprland-per-window-layout - - # Wallpaper - exec-once = ${pkgs.hyprpaper}/bin/hyprpaper - ''; + # TODO: take a look at https://github.com/Duckonaut/split-monitor-workspaces + wayland.windowManager.hyprland = { + enable = true; + xwayland = { + enable = true; }; + systemd.enable = true; + settings = { + monitor = config.my-config.hypr.monitors; + xwayland = { + force_zero_scaling = true; + }; + + input = { + kb_layout = "us,ru"; + kb_options = "grp:caps_toggle,grp_led:caps"; + follow_mouse = 1; + touchpad = { + natural_scroll = true; + disable_while_typing = true; + clickfinger_behavior = true; + }; + sensitivity = 0; + }; + gestures = { + workspace_swipe = true; + }; + + general = { + gaps_in = 5; + gaps_out = 20; + border_size = 2; + "col.active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg"; + "col.inactive_border" = "rgba(595959aa)"; + + layout = "${config.my-config.hypr.layout}"; + }; + + decoration = { + rounding = 5; + blur = { + enabled = "yes"; + size = 3; + passes = 1; + new_optimizations = "on"; + }; + drop_shadow = "yes"; + shadow_range = 4; + shadow_render_power = 3; + "col.shadow" = "rgba(1a1a1aee)"; + }; + animations = { + enabled = "yes"; + 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" + "fade, 1, 7, default" + "workspaces, 1, 6, default" + ]; + }; + + dwindle = { + pseudotile = "yes"; + preserve_split = "yes"; + no_gaps_when_only = true; + }; + master = { + new_is_master = false; + no_gaps_when_only = true; + orientation = "center"; + }; + + "$mainMod" = "SUPER"; + + bind = [ + "$mainMod, Return, exec, alacritty" + "$mainMod, Space, exec, rofi -show drun" + "$mainMod, P, exec, rofi-rbw" + "$mainMod SHIFT, P, exec, rofi -show emoji" + "$mainMod SHIFT, E, exec, rofi -show emoji" + "$mainMod SHIFT, C, killactive," + "$mainMod SHIFT, Q, exec, swaylock -f -i ~/pictures/lock.jpg" + "$mainMod, Q, exec, qutebrowser" + "$mainMod SHIFT, F, togglefloating," + "$mainMod, F, fullscreen, 0" + + # Move windows + "$mainMod SHIFT, H, swapwindow, l" + "$mainMod SHIFT, L, swapwindow, r" + "$mainMod SHIFT, K, swapwindow, u" + "$mainMod SHIFT, J, swapwindow, d" + + # Move focus with mainMod + hjkl + "$mainMod, H, movefocus, l" + "$mainMod, L, movefocus, r" + "$mainMod, K, movefocus, u" + "$mainMod, J, movefocus, d" + + # Move focus to another monitor + "$mainMod, I, focusmonitor, l" + "$mainMod, O, focusmonitor, r" + + # Move window to anothe monitor + "$mainMod SHIFT, I, movewindow, mon:l" + "$mainMod SHIFT, O, movewindow, mon:r" + + # Switch workspaces with mainMod + [0-9] + "$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" + + # Move active window to a workspace with mainMod + SHIFT + [0-9] + "$mainMod SHIFT, 1, movetoworkspace, 1" + "$mainMod SHIFT, 2, movetoworkspace, 2" + "$mainMod SHIFT, 3, movetoworkspace, 3" + "$mainMod SHIFT, 4, movetoworkspace, 4" + "$mainMod SHIFT, 5, movetoworkspace, 5" + "$mainMod SHIFT, 6, movetoworkspace, 6" + "$mainMod SHIFT, 7, movetoworkspace, 7" + "$mainMod SHIFT, 8, movetoworkspace, 8" + "$mainMod SHIFT, 9, movetoworkspace, 9" + "$mainMod SHIFT, 0, movetoworkspace, 10" + + # Scroll through existing workspaces with mainMod + scroll + "$mainMod, mouse_down, workspace, e+1" + "$mainMod, mouse_up, workspace, e-1" + + # Media keys + ",XF86AudioRaiseVolume, exec, pw-volume change '+5%'" + ",XF86AudioLowerVolume, exec, pw-volume change '-5%'" + ",XF86AudioMute, exec, pw-volume mute toggle" + ",XF86MonBrightnessDown, exec, brightnessctl set '5%-'" + ",XF86MonBrightnessUp, exec, brightnessctl set '+5%'" + + # Color picker + "$mainMod ALT, P, exec, hyprpicker --autocopy --no-fancy" + + # Screenshots + "$mainMod, S, exec, TO_FILE=false FULL_SCREEN=true ~/.config/hypr/screenshot.sh" + "$mainMod ALT, S, exec, TO_FILE=true FULL_SCREEN=true ~/.config/hypr/screenshot.sh" + "$mainMod SHIFT, S, exec, TO_FILE=false FULL_SCREEN=false ~/.config/hypr/screenshot.sh" + "$mainMod SHIFT ALT, S, exec, TO_FILE=true FULL_SCREEN=false ~/.config/hypr/screenshot.sh" + + # Notifications + "$mainMod, N, exec, swaync-client --toggle-panel" + "$mainMod, D, exec, swaync-client --toggle-dnd" + + ]; + bindm = [ # Move/resize windows with mainMod + LMB/RMB and dragging + "$mainMod, mouse:272, movewindow" + "$mainMod, mouse:273, resizewindow" + ]; + + exec-once = [ + # Notifications + "${pkgs.swaynotificationcenter}/bin/swaync" + + # Keyboard layout per window + "${pkgs.hyprland-per-window-layout}/bin/hyprland-per-window-layout" + + # Wallpaper + "${pkgs.hyprpaper}/bin/hyprpaper" + ]; + }; + }; home.file = { "./.config/hypr/hyprpaper.conf".text = ''