diff --git a/home-manager/modules/default.nix b/home-manager/modules/default.nix index edaeef4..b277b4f 100644 --- a/home-manager/modules/default.nix +++ b/home-manager/modules/default.nix @@ -2,6 +2,7 @@ imports = [ ./cursor.nix ./git.nix + ./hyprland ./zsh.nix ./tmux.nix ]; diff --git a/home-manager/modules/hyprland.nix b/home-manager/modules/hyprland.nix new file mode 100644 index 0000000..c55a8db --- /dev/null +++ b/home-manager/modules/hyprland.nix @@ -0,0 +1,174 @@ +{ + wayland.windowManager.hyprland = { + enable = true; + settings = { + monitor = ",1920x1080@60,auto,1"; + "$mainMod" = "SUPER"; + "$terminal" = "alacritty"; + "$fileManager" = "lf"; + "$menu" = "fuzzel"; + + exec-once = [ + "swww-daemon" + "swww img ~/Downloads/wp.png" + "sleep 5 && waybar -c ~/.config/waybar/config.json" + "wl-paste --type text --watch cliphist store" + "wl-paste --type image --watch cliphist store" + ]; + + input = { + kb_layout = "us,ru"; + kb_options = "grp:caps_toggle"; + }; + + general = { + gaps_in = 0; + gaps_out = 0; + + border_size = 5; + + "col.active_border" = "rgba(d65d0eff) rgba(98971aff) 45deg"; + "col.inactive_border" = "rgba(202020ff)"; + + resize_on_border = true; + + allow_tearing = false; + layout = "master"; + }; + + decoration = { + shadow = { + enabled = false; + }; + + blur = { + enabled = false; + }; + }; + + animations = { + enabled = false; + }; + + windowrulev2 = [ + "bordersize 0, floating:0, onworkspace:w[t1]" + "float,class:(mpv)|(imv)" + "workspace 3,class:(obsidian)" + "workspace 4,class:(com.obsproject.S" + "workspace 5,class:(telegram)" + "workspace 6,class:(teams-for-linux)" + "suppressevent maximize, class:.*" + "nofocus,class:^$,title:^$,xwayland:1,floating:1,fullscreen:0,pinned:0" + ]; + + dwindle = { + pseudotile = true; + preserve_split = true; + }; + + master = { + new_status = "slave"; + new_on_top = true; + mfact = 0.5; + }; + + misc = { + force_default_wallpaper = 0; + disable_hyprland_logo = true; + }; + + gestures = { + workspace_swipe = true; + workspace_swipe_invert = false; + workspace_swipe_forever = true; + }; + + bind = [ + "$mainMod SHIFT, Return, exec, $terminal" + "$mainMod SHIFT, C, killactive," + "$mainMod SHIFT, Q, exit," + "$mainMod, E, exec, $fileManager" + "$mainMod, F, togglefloating," + "$mainMod, D, exec, $menu" + "$mainMod, P, pseudo, # dwindle" + "$mainMod, J, togglesplit, # dwindle" + "$mainMod, V, exec, cliphist list | wofi --dmenu | cliphist decode | wl-copy" + "$mainMod, B, exec, pkill -SIGUSR2 waybar" + "$mainMod SHIFT, B, exec, pkill -SIGUSR1 waybar" + + "$mainMod SHIFT, R, exec, $terminal -e sh -c 'nh os switch'" + "$mainMod SHIFT, N, exec, $terminal -e sh -c '$EDITOR $FLAKE/nixos/configuration.nix'" + "$mainMod SHIFT, H, exec, $terminal -e sh -c '$EDITOR ~/.config/hypr/hyprland.conf'" + "$mainMod SHIFT, W, exec, $terminal -e sh -c '$EDITOR ~/.config/waybar/config.json'" + ", Print, exec, grimblast copysave area" + + "$mainMod, left, movefocus, l" + "$mainMod, right, movefocus, r" + "$mainMod, up, movefocus, u" + "$mainMod, down, movefocus, d" + + "$mainMod SHIFT, left, swapwindow, l" + "$mainMod SHIFT, right, swapwindow, r" + "$mainMod SHIFT, up, swapwindow, u" + "$mainMod SHIFT, down, swapwindow, d" + + "$mainMod CTRL, left, resizeactive, -60 0" + "$mainMod CTRL, right, resizeactive, 60 0" + "$mainMod CTRL, up, resizeactive, 0 -60" + "$mainMod CTRL, down, resizeactive, 0 60" + + "$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" + + "$mainMod SHIFT, 1, movetoworkspacesilent, 1" + "$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, S, togglespecialworkspace, magic" + "$mainMod SHIFT, S, movetoworkspace, special:magic" + + "$mainMod, mouse_down, workspace, e+1" + "$mainMod, mouse_up, workspace, e-1" + ]; + + # Move/resize windows with mainMod + LMB/RMB and dragging + bindm = [ + "$mainMod, mouse:272, movewindow" + "$mainMod, mouse:273, resizewindow" + ]; + + # Laptop multimedia keys for volume and LCD brightness + bindel = [ + ",XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+" + ",XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-" + ",XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" + ",XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle" + ",XF86MonBrightnessUp, exec, brightnessctl s 10%+" + ",XF86MonBrightnessDown, exec, brightnessctl s 10%-" + ]; + + # Requires playerctl + bindl = [ + ", XF86AudioNext, exec, playerctl next" + ", XF86AudioPause, exec, playerctl play-pause" + ", XF86AudioPlay, exec, playerctl play-pause" + ", XF86AudioPrev, exec, playerctl previous" + ]; + }; + }; +} diff --git a/home-manager/modules/hyprland/binds.nix b/home-manager/modules/hyprland/binds.nix new file mode 100644 index 0000000..71c090d --- /dev/null +++ b/home-manager/modules/hyprland/binds.nix @@ -0,0 +1,94 @@ +{ + wayland.windowManager.hyprland.settings = { + bind = [ + "$mainMod SHIFT, Return, exec, $terminal" + "$mainMod SHIFT, C, killactive," + "$mainMod SHIFT, Q, exit," + "$mainMod, E, exec, $fileManager" + "$mainMod, F, togglefloating," + "$mainMod, D, exec, $menu" + "$mainMod, P, pseudo," + "$mainMod, J, togglesplit," + "$mainMod, V, exec, cliphist list | wofi --dmenu | cliphist decode | wl-copy" + "$mainMod, B, exec, pkill -SIGUSR2 waybar" + "$mainMod SHIFT, B, exec, pkill -SIGUSR1 waybar" + + # configuration files + "$mainMod SHIFT, R, exec, $terminal -e sh -c 'nh os switch'" + "$mainMod SHIFT, N, exec, $terminal -e sh -c '$EDITOR $FLAKE/nixos/configuration.nix'" + "$mainMod SHIFT, H, exec, $terminal -e sh -c '$EDITOR ~/.config/hypr/hyprland.conf'" + "$mainMod SHIFT, W, exec, $terminal -e sh -c '$EDITOR ~/.config/waybar/config.json'" + ", Print, exec, grimblast copysave area" + + # Moving focus + "$mainMod, left, movefocus, l" + "$mainMod, right, movefocus, r" + "$mainMod, up, movefocus, u" + "$mainMod, down, movefocus, d" + + # Moving windows + "$mainMod SHIFT, left, swapwindow, l" + "$mainMod SHIFT, right, swapwindow, r" + "$mainMod SHIFT, up, swapwindow, u" + "$mainMod SHIFT, down, swapwindow, d" + + # Resizeing windows X Y + "$mainMod CTRL, left, resizeactive, -60 0" + "$mainMod CTRL, right, resizeactive, 60 0" + "$mainMod CTRL, up, resizeactive, 0 -60" + "$mainMod CTRL, down, resizeactive, 0 60" + + # Switching workspaces + "$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" + + # Moving windows to workspaces + "$mainMod SHIFT, 1, movetoworkspacesilent, 1" + "$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" + + # Scratchpad + "$mainMod, S, togglespecialworkspace, magic" + "$mainMod SHIFT, S, movetoworkspace, special:magic" + ]; + + # Move/resize windows with mainMod + LMB/RMB and dragging + bindm = [ + "$mainMod, mouse:272, movewindow" + "$mainMod, mouse:273, resizewindow" + ]; + + # Laptop multimedia keys for volume and LCD brightness + bindel = [ + ",XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+" + ",XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-" + ",XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" + ",XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle" + ",XF86MonBrightnessUp, exec, brightnessctl s 10%+" + ",XF86MonBrightnessDown, exec, brightnessctl s 10%-" + ]; + + # Audio playback + bindl = [ + ", XF86AudioNext, exec, playerctl next" + ", XF86AudioPause, exec, playerctl play-pause" + ", XF86AudioPlay, exec, playerctl play-pause" + ", XF86AudioPrev, exec, playerctl previous" + ]; + }; +} diff --git a/home-manager/modules/hyprland/default.nix b/home-manager/modules/hyprland/default.nix new file mode 100644 index 0000000..c0e3f04 --- /dev/null +++ b/home-manager/modules/hyprland/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./binds.nix + ./main.nix + ]; +} diff --git a/home-manager/modules/hyprland/main.nix b/home-manager/modules/hyprland/main.nix new file mode 100644 index 0000000..3e5c35d --- /dev/null +++ b/home-manager/modules/hyprland/main.nix @@ -0,0 +1,87 @@ +{ + wayland.windowManager.hyprland = { + enable = true; + settings = { + monitor = ",1920x1080@60,auto,1"; + "$mainMod" = "SUPER"; + "$terminal" = "alacritty"; + "$fileManager" = "$terminal -e sh -c 'lf'"; + "$menu" = "fuzzel"; + + exec-once = [ + "swww-daemon" + "swww img ~/Downloads/wp.png" + "sleep 5 && waybar -c ~/.config/waybar/config.json" + "wl-paste --type text --watch cliphist store" + "wl-paste --type image --watch cliphist store" + ]; + + input = { + kb_layout = "us,ru"; + kb_options = "grp:caps_toggle"; + }; + + general = { + gaps_in = 0; + gaps_out = 0; + + border_size = 5; + + "col.active_border" = "rgba(d65d0eff) rgba(98971aff) 45deg"; + "col.inactive_border" = "rgba(3c3836ff)"; + + resize_on_border = true; + + allow_tearing = false; + layout = "master"; + }; + + decoration = { + shadow = { + enabled = false; + }; + + blur = { + enabled = false; + }; + }; + + animations = { + enabled = false; + }; + + windowrulev2 = [ + "bordersize 0, floating:0, onworkspace:w[t1]" + "float,class:(mpv)|(imv)" + "workspace 3,class:(obsidian)" + "workspace 4,class:(com.obsproject.S" + "workspace 5,class:(telegram)" + "workspace 6,class:(teams-for-linux)" + "suppressevent maximize, class:.*" + "nofocus,class:^$,title:^$,xwayland:1,floating:1,fullscreen:0,pinned:0" + ]; + + dwindle = { + pseudotile = true; + preserve_split = true; + }; + + master = { + new_status = "slave"; + new_on_top = true; + mfact = 0.5; + }; + + misc = { + force_default_wallpaper = 0; + disable_hyprland_logo = true; + }; + + gestures = { + workspace_swipe = true; + workspace_swipe_invert = false; + workspace_swipe_forever = true; + }; + }; + }; +}