From 4271d20f44a74d7388112c25391af9c8bdb159a4 Mon Sep 17 00:00:00 2001 From: biscuit Date: Mon, 30 Jun 2025 13:05:11 -0500 Subject: [PATCH] major DESKTOP changes --- config.nix | 3 +- home/desktop.nix | 2 + hosts/desktop/configuration.nix | 16 ++- modules/desktop.nix | 12 +- packages/hypridle/default.nix | 38 ++++++ packages/hyprland/default.nix | 221 ++++++++++++++++++++++++++++++++ packages/hyprlock/default.nix | 7 + packages/matugen/default.nix | 11 ++ packages/rofi/default.nix | 8 ++ packages/swww/default.nix | 3 + system/wayland.nix | 1 + 11 files changed, 311 insertions(+), 11 deletions(-) create mode 100644 packages/hypridle/default.nix create mode 100644 packages/hyprland/default.nix create mode 100644 packages/hyprlock/default.nix create mode 100644 packages/matugen/default.nix create mode 100644 packages/rofi/default.nix create mode 100644 packages/swww/default.nix diff --git a/config.nix b/config.nix index 57841bf..d10d163 100644 --- a/config.nix +++ b/config.nix @@ -79,7 +79,8 @@ Monitor = [ # hyprctl monitors all # monitor, resolution@refreshrate, position (e.g., 0x0 is middle, 0x1080 is top), scale - ",highres@highrr,auto,auto" + "DP-1,highres@165,0x1080,auto" + "DP-2,highres@highrr,0x0,auto" ]; }; }; diff --git a/home/desktop.nix b/home/desktop.nix index 44e6a1d..5097739 100644 --- a/home/desktop.nix +++ b/home/desktop.nix @@ -1,5 +1,7 @@ {myConfig, ...}: { imports = [ + ../../modules/desktop.nix + ../../modules/terminal.nix ]; programs.home-manager.enable = true; diff --git a/hosts/desktop/configuration.nix b/hosts/desktop/configuration.nix index c976776..09d0242 100644 --- a/hosts/desktop/configuration.nix +++ b/hosts/desktop/configuration.nix @@ -2,14 +2,18 @@ pkgs, myConfig, inputs, + lib, ... }: { - imports = [ - inputs.sops-nix.nixosModules.sops - ./hardware-configuration.nix - ../../modules/linuxDev.nix - ../../modules/system.nix - ]; + imports = + [ + inputs.sops-nix.nixosModules.sops + ./hardware-configuration.nix + ../../modules/linuxDev.nix + ../../modules/system.nix + ] + ++ lib.optionals (myConfig.linux.apps.gaming == true) [ + ]; environment.systemPackages = []; diff --git a/modules/desktop.nix b/modules/desktop.nix index e279b2b..e6d2926 100644 --- a/modules/desktop.nix +++ b/modules/desktop.nix @@ -3,8 +3,12 @@ myConfig, ... }: { - imports = - [ - ] - ++ [lib.optionals (myConfig.linux.apps.gaming == true)]; + imports = [ + ../packages/hyprland/default.nix + ../packages/hypridle/default.nix + ../packages/hyprlock/default.nix + ../packages/rofi/default.nix + ../packages/matugen/default.nix + ../packages/swww/default.nix + ]; } diff --git a/packages/hypridle/default.nix b/packages/hypridle/default.nix new file mode 100644 index 0000000..27f8489 --- /dev/null +++ b/packages/hypridle/default.nix @@ -0,0 +1,38 @@ +{...}: { + services.hypridle = { + enable = true; + settings = { + general = { + lock_cmd = "pidof hyprlock || hyprlock"; # avoid starting multiple hyprlock instances. + before_sleep_cmd = "loginctl lock-session"; # lock before suspend. + after_sleep_cmd = "hyprctl dispatch dpms on && agu"; # avoid needing to press a key twice to turn on the display. + }; + + listener = [ + { + timeout = 150; + on-timeout = "brightnessctl -s set 10"; # set monitor backlight to minimum, avoid 0 on OLED monitor. + on-resume = "brightnessctl -r"; # restore monitor backlight. + } + { + timeout = 150; + on-timeout = "brightnessctl -sd rgb:kbd_backlight set 0"; # turn off keyboard backlight. + on-resume = "brightnessctl -rd rgb:kbd_backlight"; # turn on keyboard backlight. + } + { + timeout = 300; + on-timeout = "loginctl lock-session"; # lock screen when timeout has passed. + } + { + timeout = 330; + on-timeout = "hyprctl dispatch dpms off"; # screen off after 5.5min. + on-resume = "hyprctl dispatch dpms on && brightnessctl -r"; # screen on and restore brightness on resume. + } + { + timeout = 500; + on-timeout = "systemctl suspend"; # suspend PC after 30min. + } + ]; + }; + }; +} diff --git a/packages/hyprland/default.nix b/packages/hyprland/default.nix new file mode 100644 index 0000000..fed2223 --- /dev/null +++ b/packages/hyprland/default.nix @@ -0,0 +1,221 @@ +{myConfig, ...}: { + wayland.windowManager.hyprland = { + enable = true; + xwayland.enable = true; + settings = { + "$mod" = "SUPER"; + "$term" = "kitty --single-instance"; + "$browser" = "firefox"; + + monitor = myConfig.linux.hyprconf.monitor; + + exec-once = [ + "[workspace 20 silent] kitty --single-insance --hold fastfetch" + "[workspace 20 silent] firefox" + "[workspace 1] kitty --single-instance --hold fastfetch" + "pkill gjs & ags run" + # "matugen image /home/${username}/.config/nixos/assets/wallpapers/ultrawide-nixos-default.png" + "hyprctl setcursor Bibata-Original-Classic 24" + "solaar -w hide" + ]; + + general = { + gaps_in = 2; + gaps_out = 5; + border_size = 2; + # col.active_border = "#0DB7D4FF"; + # col.inactive_border = "#31313600"; + # col = { + # "inactive_border" = "rgba(595959aa)"; + # "active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg"; + # }; + resize_on_border = false; + allow_tearing = false; + layout = "dwindle"; + }; + decoration = { + rounding = 0; + rounding_power = 2; + active_opacity = 1.0; + inactive_opacity = 1.0; + + dim_inactive = true; + dim_strength = 0.1; + dim_special = 0.8; + + shadow = { + enabled = true; + range = 4; + render_power = 3; + color = "rgba(1a1a1aee)"; + }; + + blur = { + enabled = true; + size = 3; + passes = 1; + vibrancy = 0.1696; + }; + }; + + animations = { + enabled = true; + bezier = [ + "linear, 0, 0, 1, 1" + "md3_standard, 0.2, 0, 0, 1" + "md3_decel, 0.05, 0.7, 0.1, 1" + "md3_accel, 0.3, 0, 0.8, 0.15" + "overshot, 0.05, 0.9, 0.1, 1.1" + "crazyshot, 0.1, 1.5, 0.76, 0.92" + "hyprnostretch, 0.05, 0.9, 0.1, 1.0" + "menu_decel, 0.1, 1, 0, 1" + "menu_accel, 0.38, 0.04, 1, 0.07" + "easeInOutCirc, 0.85, 0, 0.15, 1" + "easeOutCirc, 0, 0.55, 0.45, 1" + "easeOutExpo, 0.16, 1, 0.3, 1" + "softAcDecel, 0.26, 0.26, 0.15, 1" + "md2, 0.4, 0, 0.2, 1" + ]; + + animation = [ + "windows, 1, 3, md3_decel, popin 60%" + "windowsIn, 1, 3, md3_decel, popin 60%" + "windowsOut, 1, 3, md3_accel, popin 60%" + "border, 1, 10, default" + "fade, 1, 3, md3_decel" + "layersIn, 1, 3, menu_decel, slide" + "layersOut, 1, 1.6, menu_accel" + "fadeLayersIn, 1, 2, menu_decel" + "fadeLayersOut, 1, 0.5, menu_accel" + "workspaces, 1, 7, menu_decel, slide" + "specialWorkspace, 1, 3, md3_decel, slidevert" + ]; + }; + + dwindle = { + pseudotile = true; + preserve_split = true; + }; + + master = { + new_status = "master"; + }; + + misc = { + force_default_wallpaper = -1; + disable_hyprland_logo = true; + }; + + input = { + kb_layout = "us"; + follow_mouse = 1; + sensitivity = 0; + force_no_accel = true; + repeat_delay = 250; + repeat_rate = 35; + + touchpad = { + natural_scroll = false; + }; + + numlock_by_default = true; + }; + + gestures = { + workspace_swipe = false; + }; + + binds = { + workspace_back_and_forth = true; + scroll_event_delay = 0; + }; + + device = [ + { + name = "epic-mouse-v1"; + sensitivity = -0.5; + } + ]; + + bind = + [ + "$mod, Return, exec, $term" + "$mod, Q, killactive," + "$mod, M, exit," + "$mod, E, exec, $fileManager" + "$mod, V, togglefloating," + "$mod, R, exec, $menu" + "$mod, P, pseudo," + "$mod, B, togglesplit," + "$mod, W, exec, $browser" + + "$mod, H, movefocus, l" + "$mod, L, movefocus, r" + "$mod, K, movefocus, u" + "$mod, J, movefocus, d" + + "$mod SHIFT, K, movewindow, u" + "$mod SHIFT, J, movewindow, d" + "$mod SHIFT, H, movewindow, l" + "$mod SHIFT, L, movewindow, r" + + "$mod CTRL, K, resizeactive, 0 -50" + "$mod CTRL, J, resizeactive, 0 50" + "$mod CTRL, H, resizeactive, -50 0" + "$mod CTRL, L, resizeactive, 50 0" + + "$mod, S, togglespecialworkspace, magic" + "$mod SHIFT, S, movetoworkspace, special:magic" + + "$mod, mouse_down, workspace, e+1" + "$mod, mouse_up, workspace, e-1" + + "$mod, F, fullscreen, 0" + + "$mod, Space, exec, pkill rofi || rofi -show drun" + "$mod, C, exec, pkill rofi || rofi -show calc -modi calc -no-show-match -no-sort" + ] + ++ ( + # workspaces + builtins.concatLists (builtins.genList ( + i: let + ws = i + 1; + in [ + "$mod, ${toString ws}, workspace, ${toString ws}" + "$mod SHIFT, ${toString ws}, movetoworkspace, ${toString ws}" + ] + ) + 9) + ) + ++ [ + "$mod, 0, workspace, 10" + "$mod, 0, movetoworkspace, 10" + ]; + + bindm = [ + "$mod, mouse:272, movewindow" + "$mod, mouse:273, resizewindow" + ]; + + 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%-" + ]; + + bindl = [ + ",XF86AudioNext, exec, playerctl next" + ",XF86AudioPause, exec, playerctl play-pause" + ",XF86AudioPlay, exec, playerctl play-pause" + ",XF86AudioPrev, exec, playerctl previous" + ]; + env = [ + "HYPRCURSOR_THEME, Bibata-Original-Classic" + "HYPRCURSOR_SIZE, 24" + ]; + }; + }; +} diff --git a/packages/hyprlock/default.nix b/packages/hyprlock/default.nix new file mode 100644 index 0000000..3658ee1 --- /dev/null +++ b/packages/hyprlock/default.nix @@ -0,0 +1,7 @@ +{...}: { + programs.hyprlock = { + enable = true; + settings = { + }; + }; +} diff --git a/packages/matugen/default.nix b/packages/matugen/default.nix new file mode 100644 index 0000000..6d3d98d --- /dev/null +++ b/packages/matugen/default.nix @@ -0,0 +1,11 @@ +{ + pkgs, + inputs, + system, + ... +}: { + imports = [inputs.matugen.nixosModules.default]; + home.file.".config/matugen/config.toml" = { + source = builtins.toPath ./custom/config.toml; + }; +} diff --git a/packages/rofi/default.nix b/packages/rofi/default.nix new file mode 100644 index 0000000..729125b --- /dev/null +++ b/packages/rofi/default.nix @@ -0,0 +1,8 @@ +{pkgs, ...}: { + programs.rofi = { + enable = true; + plugins = with pkgs; [ + rofi-calc + ]; + }; +} diff --git a/packages/swww/default.nix b/packages/swww/default.nix new file mode 100644 index 0000000..4b1bfe2 --- /dev/null +++ b/packages/swww/default.nix @@ -0,0 +1,3 @@ +{...}: { + services.swww.enable = true; +} diff --git a/system/wayland.nix b/system/wayland.nix index de04502..b53457d 100644 --- a/system/wayland.nix +++ b/system/wayland.nix @@ -7,6 +7,7 @@ wl-clipboard hypridle hyprlock + brightnessctl ]; programs.hyprland = { enable = true;