From 59fc8328f7dde753629d4b8174a828841034f32c Mon Sep 17 00:00:00 2001 From: "Gustavo \"Guz\" L. de Mello" Date: Mon, 8 Jan 2024 18:42:40 -0300 Subject: [PATCH] feat: install Hyprland --- hosts/desktop/shared-configuration.nix | 30 +++++- hosts/desktop/shared-home.nix | 130 +++++++++++++++++++++++++ 2 files changed, 156 insertions(+), 4 deletions(-) diff --git a/hosts/desktop/shared-configuration.nix b/hosts/desktop/shared-configuration.nix index 27f90cd..c98c27e 100644 --- a/hosts/desktop/shared-configuration.nix +++ b/hosts/desktop/shared-configuration.nix @@ -1,7 +1,3 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page -# and in the NixOS manual (accessible by running ‘nixos-help’). - { config, pkgs, inputs, lib, ... }: { @@ -12,6 +8,31 @@ ./hardware-configuration.nix ]; + programs.hyprland = { + enable = true; + xwayland.enable = true; + }; + + xdg.portal.enable = true; + xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-hyprland ]; + + environment.sessionVariables = { + WLR_NO_HARDWARE_CURSORS = "1"; + NIXOS_OZONE_WL = "1"; + }; + + environment.systemPackages = with pkgs; [ + kitty + rofi-wayland + dunst + libnotify + swww + ]; + + hardware = { + opengl.enable = true; + }; + # Enable the X11 windowing system. services.xserver.enable = true; @@ -54,3 +75,4 @@ } + diff --git a/hosts/desktop/shared-home.nix b/hosts/desktop/shared-home.nix index 060b756..b7a1e20 100644 --- a/hosts/desktop/shared-home.nix +++ b/hosts/desktop/shared-home.nix @@ -6,6 +6,135 @@ ../../modules/home-manager/config/terminal.nix ]; + wayland.windowManager.hyprland.enable = true; + wayland.windowManager.hyprland.settings = { + + "$monitor1" = "HDMI-A-1"; + "$monitor2" = "DVI-D-1"; + + monitor = [ + "$monitor1,2560x1080@60,0x0,1" + "$monitor2,1920x1080@60,2560x0,1" + ]; + + env = [ + "XCURSOR_SIZE,24" + "MOZ_ENABLE_WAYLAND,1" + ]; + + windowrulev2 = [ + "opacity 0.0 override 0.0 override,class:^(xwaylandvideobridge)$" + "noanim,class:^(xwaylandvideobridge)$" + "nofocus,class:^(xwaylandvideobridge)$" + "noinitialfocus,class:^(xwaylandvideobridge)$" + ]; + + input = { + kb_layout = "br"; + kb_variant = "abnt2"; + + follow_mouse = "1"; + + sensitivity = "0"; + }; + + general = { + gaps_in = "5"; + gaps_out = "10"; + border_size = "0"; + "col.active_border" = "rgba(ffffff99) rgba(ffffff33) 90deg"; + "col.inactive_border" = "rgba(18181800)"; + layout = "dwindle"; + }; + + decoration = { + rounding = "5"; + + dim_inactive = "true"; + dim_strength = "0.2"; + dim_around = "0.4"; + + blur = { + enabled = "false"; + size = "20"; + }; + }; + + 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" + "borderangle, 1, 8, default" + "fade, 1, 7, default" + "workspaces, 1, 6, default" + ]; + }; + + dwindle = { + pseudotile = "yes"; + preserve_split = "yes"; + }; + + master = { + new_is_master = "true"; + }; + + gestures = { + workspace_swipe = "off"; + }; + + "$mod" = "SUPER"; + + workspace = [ + "1,monitor:$monitor1,default:true" + "2,monitor:$monitor1" + "3,monitor:$monitor1" + + "4,monitor:$monitor2,default:true" + "5,monitor:$monitor2" + "6,monitor:$monitor2" + ]; + + bind = [ + "$mod, Q, exec, ${pkgs.wezterm}/bin/wezterm" + "$mod, C, killactive" + "$mod, M, exit" + "$mod, E, exec, ${pkgs.gnome.nautilus}/bin/nautilus" + "$mod, V, togglefloating" + "$mod, F, fullscreen" + "$mod, Z, togglesplit" + "$mod, S, exec, ${pkgs.rofi}/bin/rofi -show drun -show-icons" + + "$mod, 1, workspace, 1" + "$mod, 2, workspace, 2" + "$mod, 3, workspace, 3" + "$mod + SHIFT, 1, movetoworkspace, 1" + "$mod + SHIFT, 2, movetoworkspace, 2" + "$mod + SHIFT, 3, movetoworkspace, 3" + + "$mod, 8, workspace, 4" + "$mod, 9, workspace, 5" + "$mod, 0, workspace, 6" + "$mod + SHIFT, 8, movetoworkspace, 4" + "$mod + SHIFT, 9, movetoworkspace, 5" + "$mod + SHIFT, 0, movetoworkspace, 6" + + "$mod, H, movefocus, l" + "$mod, L, movefocus, r" + "$mod, K, movefocus, u" + "$mod, J, movefocus, d" + ]; + bindm = [ + "$mod, mouse:272, movewindow" + "$mod, mouse:273, resizewindow" + ]; + }; + programs.bash = { enable = true; initExtra = '' @@ -72,3 +201,4 @@ # EDITOR = "emacs"; }; } +