diff options
Diffstat (limited to 'modules/programs/hypr')
-rw-r--r-- | modules/programs/hypr/default.nix | 10 | ||||
-rw-r--r-- | modules/programs/hypr/hypridle.nix | 56 | ||||
-rw-r--r-- | modules/programs/hypr/hyprland.nix | 302 | ||||
-rw-r--r-- | modules/programs/hypr/hyprlock.nix | 96 | ||||
-rw-r--r-- | modules/programs/hypr/hyprpaper.nix | 28 |
5 files changed, 492 insertions, 0 deletions
diff --git a/modules/programs/hypr/default.nix b/modules/programs/hypr/default.nix new file mode 100644 index 0000000..08b2d93 --- /dev/null +++ b/modules/programs/hypr/default.nix @@ -0,0 +1,10 @@ +{ ... }: + +{ + imports = [ + ./hypridle.nix + ./hyprland.nix + ./hyprlock.nix + ./hyprpaper.nix + ]; +} diff --git a/modules/programs/hypr/hypridle.nix b/modules/programs/hypr/hypridle.nix new file mode 100644 index 0000000..f69db63 --- /dev/null +++ b/modules/programs/hypr/hypridle.nix @@ -0,0 +1,56 @@ +{ config, pkgs, lib, inputs, ... }: + +let + # inputs + system = pkgs.stdenv.hostPlatform.system; + hypridle = inputs.hypridle.packages.${system}; +in +{ + config = lib.mkIf config.desktop.enable { + + home-manager.users.${config.user} = { + services.hypridle = { + + enable = true; + package = hypridle.hypridle; + + settings = { + general = { + lock_cmd = "pidof hyprlock || hyprlock"; + before_sleep_cmd = "loginctl lock-session"; + after_sleep_cmd = "hyprctl dispatch dpms on"; + ignore_dbus_inhibit = false; + }; + + listener = [ + # dim screen + { + timeout = 150; + on-timeout = "brightnessctl -s set 10"; + on-resume = "brightnessctl -r"; + } + # dim keyboard backlight + { + timeout = 150; + on-timeout = "brightnessctl -sd rgb:kbd_backlight set 0"; + on-resume = "brightnessctl -rd rgb:kbd_backlight"; + } + # lock + { + timeout = 300; + on-timeout = "loginctl lock-session"; + } + # turn off screen + { + timeout = 350; + on-timeout = "hyprctl dispatch dpms off"; + on-resume = "hyprctl dispatch dpms on"; + } + ]; + }; + }; + }; + + }; +} + diff --git a/modules/programs/hypr/hyprland.nix b/modules/programs/hypr/hyprland.nix new file mode 100644 index 0000000..6ae9afd --- /dev/null +++ b/modules/programs/hypr/hyprland.nix @@ -0,0 +1,302 @@ +{ config, pkgs, lib, inputs, ... }: + +let + # inputs + system = pkgs.stdenv.hostPlatform.system; + hyprland = inputs.hyprland.packages.${system}; + hyprland-plugins = inputs.hyprland-plugins.packages.${system}; + hy3 = inputs.hy3.packages.${system}; + + browser = "firefox"; + launcher = "wofi --show drun --prompt \"Search Program\""; + lock_screen = "hyprlock"; + terminal = "kitty"; +in +{ + config = lib.mkIf config.desktop.enable { + + home-manager.users.${config.user} = { + wayland.windowManager.hyprland = { + + enable = true; + package = hyprland.hyprland; + + # Plugins + plugins = [ + hyprland-plugins.hyprexpo + hy3.hy3 + ]; + + # Config + settings = { + # Monitors + monitor = [ + "${config.monitor.name}, highres, auto, ${toString config.monitor.scale}" + ]; + + # Autostart + exec-once = [ + "waybar" + "thunderbird" + "discord --enable-features=UseOzonePlatform --ozone-platform=wayland" + "element-desktop --enable-features=UseOzonePlatform --ozone-platform=wayland" + ]; + + # General + general = { + gaps_in = config.theme.innerGap; + gaps_out = config.theme.outerGap; + layout = "hy3"; + resize_on_border = "yes"; + extend_border_grab_area = 20; + border_size = config.theme.borderWidth; + "col.active_border" = "rgb(${config.theme.accentColor})"; + "col.inactive_border" = "rgb(${config.theme.colors.base04})"; + }; + + # Gestures + gestures = { + workspace_swipe = true; + workspace_swipe_fingers = 3; + workspace_swipe_forever = true; + workspace_swipe_cancel_ratio = 0.15; + }; + + # Decoration + decoration = { + rounding = config.theme.outerRadius; + shadow.enabled = false; + blur = { + enabled = true; + size = 4; + passes = 2; + noise = 0.008; + contrast = 0.8916; + brightness = 0.8; + }; + }; + + # Animations + animations = { + enabled = true; + + bezier = [ + "windowIn, 0.06, 0.71, 0.25, 1" + "windowResize, 0.04, 0.67, 0.38, 1" + ]; + + animation = [ + "windowsIn, 1, 3, windowIn, slide #popin 20%" + "windowsOut, 1, 3, windowIn, slide #popin 70%" + "windowsMove, 1, 2.5, windowResize" + "border, 1, 10, default" + "borderangle, 1, 8, default" + "fade, 1, 3, default" + "workspaces, 1, 6, default" + "layers, 1, 5, windowIn, slide" + ]; + }; + + # Environment + env = [ + "XDG_CURRENT_DESKTOP,Hyprland" + "XDG_SESSION_DESKTOP,Hyprland" + + "XCURSOR_THEME,Adwaita" + "XCURSOR_SIZE,24" + + "GTK_THEME,Orchis-Teal-Dark" + "GDK_SCALE,${toString config.monitor.scale}" + + "MOZ_ENABLE_WAYLAND,1" + "MOZ_USE_XINPUT,1" + "_JAVA_AWT_WM_NONREPARENTING,1" + ]; + + # Input + input = { + kb_layout = "us"; + kb_variant = ""; + kb_model = ""; + kb_options = "gtp:alt_shit_toggle, compose:ralt"; + kb_rules = ""; + follow_mouse = 1; + touchpad = { + natural_scroll = "yes"; + }; + sensitivity = 0; + }; + + # Keybinds + "$mod" = "SUPER"; + bind = [ + # Launch programs + + "$mod, W, exec, ${browser}" + "$mod, D, exec, ${launcher}" + "$mod, L, exec, ${lock_screen}" + "$mod, Return, exec, ${terminal}" + + # Misc + + "$mod SHIFT, L, exit" + "$mod, tab, hyprexpo:expo, toggle" + + # Window operations + + "$mod SHIFT, Q, killactive" + "$mod SHIFT, SPACE, togglefloating" + "$mod, F, fullscreen" + "$mod, J, togglesplit" + + # Move focus with mod + arrow keys + + "$mod, left, movefocus, l" + "$mod, right, movefocus, r" + "$mod, up, movefocus, u" + "$mod, down, movefocus, d" + + # Move window across workspace with mod + arrow keys + + "$mod SHIFT, left, hy3:movewindow, l" + "$mod SHIFT, right, hy3:movewindow, r" + "$mod SHIFT, up, hy3:movewindow, u" + "$mod SHIFT, down, hy3:movewindow, d" + + # Switch workspaces with mod + [0-9] + + "$mod, 1, workspace, 1" + "$mod, 2, workspace, 2" + "$mod, 3, workspace, 3" + "$mod, 4, workspace, 4" + "$mod, 5, workspace, 5" + "$mod, 6, workspace, 6" + "$mod, 7, workspace, 7" + "$mod, 8, workspace, 8" + "$mod, 9, workspace, 9" + + # Move active window to a workspace with mod + SHIFT + [0-9] + + "$mod SHIFT, 1, movetoworkspacesilent, 1" + "$mod SHIFT, 2, movetoworkspacesilent, 2" + "$mod SHIFT, 3, movetoworkspacesilent, 3" + "$mod SHIFT, 4, movetoworkspacesilent, 4" + "$mod SHIFT, 5, movetoworkspacesilent, 5" + "$mod SHIFT, 6, movetoworkspacesilent, 6" + "$mod SHIFT, 7, movetoworkspacesilent, 7" + "$mod SHIFT, 8, movetoworkspacesilent, 8" + "$mod SHIFT, 9, movetoworkspacesilent, 9" + "$mod SHIFT, 0, movetoworkspacesilent, 10" + + # Move to tab + + "LALT, 1, hy3:focustab, index, 01" + "LALT, 2, hy3:focustab, index, 02" + "LALT, 3, hy3:focustab, index, 03" + "LALT, 4, hy3:focustab, index, 04" + "LALT, 5, hy3:focustab, index, 05" + "LALT, 6, hy3:focustab, index, 06" + "LALT, 7, hy3:focustab, index, 07" + "LALT, 8, hy3:focustab, index, 08" + "LALT, 9, hy3:focustab, index, 09" + "LALT, 0, hy3:focustab, index, 10" + + "$mod SHIFT, B, hy3:makegroup, h" + "$mod SHIFT, V, hy3:makegroup, v" + "$mod SHIFT, C, hy3:changegroup, toggletab" + + # Scroll through existing workspaces with mod + scroll + + "$mod, mouse_down, workspace, e+1" + "$mod, mouse_up, workspace, e-1" + ]; + + bindn = [ + # Focus windows with scroll wheel or middle click + + ", mouse:272, hy3:focustab, mouse" + ", mouse_down, hy3:focustab, l, require_hovered" + ", mouse_up, hy3:focustab, r, require_hovered" + ]; + + bindm = [ + # Move/resize windows with mod + LMB/RMB and dragging + + "$mod, mouse:272, movewindow" + "$mod, mouse:273, resizewindow" + ]; + + binde = [ + # Audio + + # raise volume + ", XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+" + # lower volume + ", XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-" + # mute speaker + ", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" + # mute mic + ", XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle" + + # Media + + # play + ", XF86AudioPlay, exec, playerctl play-pause" + # next + ", XF86AudioNext, exec, playerctl next" + # prev + ", XF86AudioPrev, exec, playerctl previous" + + # Backlight + + ", XF86MonBrightnessDown, exec, brightnessctl set 5%-" + ", XF86MonBrightnessUp, exec, brightnessctl set 5%+" + ]; + + # Plugin configuration + plugin = { + # hy3 + hy3 = { + tabs = { + height = 24; + text_height = 9; + text_padding = 10; + padding = 2; + render_text = true; + text_font = "monospace"; + radius = config.theme.outerRadius; + + "col.active" = "rgb(${config.theme.colors.base00})"; + "col.inactive" = "rgb(${config.theme.colors.base00})"; + "col.text.active" = "rgb(${config.theme.colors.base05})"; + "col.text.inactive" = "rgb(${config.theme.colors.base05})"; + "col.border.active" = "rgb(${config.theme.accentColor})"; + "col.border.inactive" = "rgb(${config.theme.colors.base04})"; + }; + + autotile = { + enable = true; + }; + }; + }; + + # XWayland + xwayland = { + force_zero_scaling = "true"; + use_nearest_neighbor = "false"; + }; + + # Misc + misc = { + disable_hyprland_logo = true; + disable_splash_rendering = true; + key_press_enables_dpms = true; + mouse_move_enables_dpms = true; + vrr = 1; + }; + }; + }; + }; + + }; +} diff --git a/modules/programs/hypr/hyprlock.nix b/modules/programs/hypr/hyprlock.nix new file mode 100644 index 0000000..e80b020 --- /dev/null +++ b/modules/programs/hypr/hyprlock.nix @@ -0,0 +1,96 @@ +{ config, pkgs, lib, inputs, ... }: + +let + # inputs + system = pkgs.stdenv.hostPlatform.system; + hyprlock = inputs.hyprlock.packages.${system}; +in +{ + config = lib.mkIf config.desktop.enable { + + home-manager.users.${config.user} = { + programs.hyprlock = { + + enable = true; + package = hyprlock.hyprlock; + + settings = { + + background = { + monitor = ""; + path = config.wallpaper; + blur_passes = 3; + contrast = 0.8916; + brightness = 0.8172; + vibrancy = 0.1696; + vibrancy_darkness = 0.0; + }; + + general = { + no_fade_in = false; + grace = 0; + disable_loading_bar = true; + }; + + input-field = { + monitor = ""; + size = "250, 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 = "rgba(0, 0, 0, 0)"; + inner_color = "rgba(0, 0, 0, 0.5)"; + font_color = "rgb(${config.theme.colors.base05})"; + font_family = config.theme.font; + fade_on_empty = false; + placeholder_text = "<i><span foreground=\"#${config.theme.colors.base05}\">Input Password...</span></i>"; + hide_input = false; + position = "0, -120"; + halign = "center"; + valign = "center"; + }; + + label = [ + # Clock + { + monitor = ""; + text = "cmd[update:1000] echo \"$(date +\"%-H:%M:%S\")\""; + font_size = 80; + font_color = "rgb(${config.theme.colors.base05})"; + font_family = config.theme.headerFont; + position = "0, 500"; + halign = "center"; + valign = "center"; + } + + # Name + { + monitor = ""; + text = config.fullName; + font_color = "rgb(${config.theme.colors.base05})"; + font_family = config.theme.headerFont; + font_size = 25; + position = "0, 50"; + halign = "center"; + valign = "center"; + } + ]; + + # Profile image + image = { + monitor = ""; + path = config.avatar; + size = 300; + rounding = -1; + border_size = 0; + position = "0, 250"; + halign = "center"; + valign = "center"; + }; + }; + }; + }; + + }; +} diff --git a/modules/programs/hypr/hyprpaper.nix b/modules/programs/hypr/hyprpaper.nix new file mode 100644 index 0000000..1d6b0cd --- /dev/null +++ b/modules/programs/hypr/hyprpaper.nix @@ -0,0 +1,28 @@ +{ config, pkgs, lib, inputs, ... }: + +let + # inputs + system = pkgs.stdenv.hostPlatform.system; + hyprpaper = inputs.hyprpaper.packages.${system}; +in +{ + config = lib.mkIf config.desktop.enable { + + home-manager.users.${config.user} = { + services.hyprpaper = { + + enable = true; + package = hyprpaper.hyprpaper; + + settings = { + preload = config.wallpaper; + wallpaper = ",${config.wallpaper}"; + splash = false; + }; + + }; + }; + + }; +} + |