diff --git a/flake.lock b/flake.lock index 1541b54..e60ffe3 100644 --- a/flake.lock +++ b/flake.lock @@ -237,6 +237,24 @@ "type": "github" } }, + "flake-utils_3": { + "inputs": { + "systems": "systems_5" + }, + "locked": { + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "fromYaml": { "flake": false, "locked": { @@ -402,6 +420,27 @@ "type": "github" } }, + "home-manager_4": { + "inputs": { + "nixpkgs": [ + "tritanium-shell", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1730837930, + "narHash": "sha256-0kZL4m+bKBJUBQse0HanewWO0g8hDdCvBhudzxgehqc=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "2f607e07f3ac7e53541120536708e824acccfaa8", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, "homepage": { "flake": false, "locked": { @@ -561,15 +600,15 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1736798957, - "narHash": "sha256-qwpCtZhSsSNQtK4xYGzMiyEDhkNzOCz/Vfu4oL2ETsQ=", - "owner": "NixOS", + "lastModified": 1730785428, + "narHash": "sha256-Zwl8YgTVJTEum+L+0zVAWvXAGbWAuXHax3KzuejaDyo=", + "owner": "nixos", "repo": "nixpkgs", - "rev": "9abb87b552b7f55ac8916b6fc9e5cb486656a2f3", + "rev": "4aa36568d413aca0ea84a1684d2d46f55dbabad7", "type": "github" }, "original": { - "owner": "NixOS", + "owner": "nixos", "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" @@ -589,7 +628,8 @@ "nixos-generators": "nixos-generators", "nixpkgs": "nixpkgs", "nixpkgs-stable": "nixpkgs-stable", - "stylix": "stylix" + "stylix": "stylix", + "tritanium-shell": "tritanium-shell" } }, "stylix": { @@ -604,7 +644,9 @@ "git-hooks": "git-hooks", "gnome-shell": "gnome-shell", "home-manager": "home-manager_3", - "nixpkgs": "nixpkgs_2", + "nixpkgs": [ + "nixpkgs-stable" + ], "systems": "systems_4", "tinted-foot": "tinted-foot", "tinted-kitty": "tinted-kitty", @@ -685,6 +727,21 @@ "type": "github" } }, + "systems_5": { + "locked": { + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" + } + }, "tinted-foot": { "flake": false, "locked": { @@ -751,6 +808,26 @@ "type": "github" } }, + "tritanium-shell": { + "inputs": { + "flake-utils": "flake-utils_3", + "home-manager": "home-manager_4", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1738888826, + "narHash": "sha256-xjUMyq7fTidbTwVqKEZ16SZSKECNx7mVDFicQswuZh8=", + "owner": "baduhai", + "repo": "tritanium-shell", + "rev": "d788a288ffc49847849d691824c2f46999b9b864", + "type": "github" + }, + "original": { + "owner": "baduhai", + "repo": "tritanium-shell", + "type": "github" + } + }, "utils": { "inputs": { "systems": "systems_2" diff --git a/flake.nix b/flake.nix index 81e961a..56c9561 100644 --- a/flake.nix +++ b/flake.nix @@ -48,8 +48,12 @@ inputs.nixpkgs.follows = "nixpkgs-stable"; }; - stylix.url = "github:danth/stylix"; + stylix = { + url = "github:danth/stylix"; + inputs.nixpkgs.follows = "nixpkgs-stable"; + }; + tritanium-shell.url = "github:baduhai/tritanium-shell"; }; outputs = @@ -68,6 +72,7 @@ nix-minecraft, nixos-generators, stylix, + tritanium-shell, ... }: { diff --git a/hosts/desktops/common/home-manager.nix b/hosts/desktops/common/home-manager.nix index 6e88ad7..6046b3a 100644 --- a/hosts/desktops/common/home-manager.nix +++ b/hosts/desktops/common/home-manager.nix @@ -1,10 +1,15 @@ -{ ... }: +{ inputs, ... }: { home-manager = { useGlobalPkgs = true; useUserPackages = true; backupFileExtension = "bkp"; - users.user = import ../../../users/desktops/user.nix; + users.user = { + imports = [ + ../../../users/desktops/user.nix + inputs.tritanium-shell.homeManagerModules.default + ]; + }; }; } diff --git a/hosts/desktops/common/packages.nix b/hosts/desktops/common/packages.nix index 842e9a1..6fb9738 100644 --- a/hosts/desktops/common/packages.nix +++ b/hosts/desktops/common/packages.nix @@ -1,4 +1,4 @@ -{ inputs, pkgs, ... }: +{ pkgs, ... }: let kdepkgs = with pkgs.kdePackages; [ ark @@ -30,7 +30,6 @@ in aspellDicts.en-computers aspellDicts.pt_BR bat - bitwarden-desktop clonehero deploy-rs distrobox @@ -38,6 +37,7 @@ in firefox freecad-wayland fzf + ghostty gimp heroic inkscape @@ -103,6 +103,7 @@ in kdeconnect.enable = true; partition-manager.enable = true; gamemode.enable = true; + hyprland.enable = true; nix-index-database.comma.enable = true; appimage = { enable = true; @@ -120,6 +121,7 @@ in corefonts noto-fonts-cjk-sans roboto + nerd-fonts.jetbrains-mono ]; }; diff --git a/hosts/desktops/common/stylix.nix b/hosts/desktops/common/stylix.nix index 3c862db..f1760b1 100644 --- a/hosts/desktops/common/stylix.nix +++ b/hosts/desktops/common/stylix.nix @@ -4,8 +4,8 @@ stylix = { enable = true; image = pkgs.fetchurl { - url = "https://images.unsplash.com/photo-1701453831008-ea11046da960?ixlib=rb-4.0.3&q=85&fm=jpg&crop=entropy&cs=srgb&dl=nat-uN9OSpSsw4A-unsplash.jpg"; - sha256 = "sha256-89o5VYI4cMP/O33oCaHi61hUYmIWEdyr8uGf/b2DMUk="; + url = "https://w.wallhaven.cc/full/dp/wallhaven-dpwvl3.jpg"; + sha256 = "sha256-h9UeYj8jSRgSv8XL+zgds4KtooLlJ+IqwxZbQEXdCh4="; }; base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-mocha.yaml"; cursor = { diff --git a/users/desktops/common/default.nix b/users/desktops/common/default.nix index 5ef9e0a..eb72910 100644 --- a/users/desktops/common/default.nix +++ b/users/desktops/common/default.nix @@ -3,5 +3,6 @@ { imports = [ ./programs.nix + ./hyprland.nix ]; } diff --git a/users/desktops/common/hyprland.nix b/users/desktops/common/hyprland.nix new file mode 100644 index 0000000..49bcd56 --- /dev/null +++ b/users/desktops/common/hyprland.nix @@ -0,0 +1,294 @@ +{ lib, pkgs, ... }: + +let + heightfittr = pkgs.writeShellApplication { + name = "heightfittr"; + runtimeInputs = with pkgs; [ + socat + hyprland + ]; + text = '' + function handle { + case "$1" in + *openwindow*) + hyprctl dispatch scroller:fitheight all > /dev/null + ;; + *closewindow*) + hyprctl dispatch scroller:fitheight all > /dev/null + ;; + esac + } + socat - "UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock" | while read -r line; do + handle "$line" + done + ''; + }; + + scrollermodetoggle = pkgs.writeShellApplication { + name = "scrollermodetoggle"; + runtimeInputs = with pkgs; [ hyprland ]; + text = '' + if [ -f "$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/colmode" ]; then + rm "$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/colmode" + hyprctl --batch 'dispatch scroller:setmode row; notify 2 1000 0 "Row Mode"' + else + touch "$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/colmode" + hyprctl --batch 'dispatch scroller:setmode col; notify 2 1000 0 "Column Mode"' + fi + ''; + }; +in + +{ + wayland.windowManager.hyprland = { + enable = true; + plugins = with pkgs.hyprlandPlugins; [ hyprscroller ]; + extraConfig = '' + ################ + ### MONITORS ### + ################ + monitor=,preferred,auto,auto + + ################# + ### AUTOSTART ### + ################# + exec-once = ulauncher --hide-window + exec-once = ${lib.getExe heightfittr} + env = XCURSOR_SIZE,24 + env = HYPRCURSOR_SIZE,24 + + ##################### + ### LOOK AND FEEL ### + ##################### + general { + gaps_in = 5 + gaps_out = 20 + border_size = 2 + resize_on_border = true + allow_tearing = false + layout = scroller + } + misc { + font_family = Inter + } + plugin { + scroller { + column_default_width = onethird + focuswrap = false + column_widths = onethird onehalf twothirds + center_row_if_space_available = true + } + } + decoration { + rounding = 10 + rounding_power = 2 + dim_inactive = true + dim_strength = 0.3 + shadow { + enabled = true + range = 4 + render_power = 3 + } + blur { + enabled = true + size = 8 + passes = 1 + vibrancy = 0.1696 + } + } + animations { + enabled = yes, please :) + bezier = easeOutQuint,0.23,1,0.32,1 + bezier = easeInOutCubic,0.65,0.05,0.36,1 + bezier = linear,0,0,1,1 + bezier = almostLinear,0.5,0.5,0.75,1.0 + bezier = quick,0.15,0,0.1,1 + animation = global, 1, 1, default + animation = border, 1, 1, easeOutQuint + animation = windows, 1, 1, easeOutQuint + animation = windowsIn, 1, 1, easeOutQuint, popin 87% + animation = windowsOut, 1, 1, linear, popin 87% + animation = fadeIn, 1, 1, almostLinear + animation = fadeOut, 1, 1, almostLinear + animation = fade, 1, 1, quick + animation = layers, 1, 1, easeOutQuint + animation = layersIn, 1, 1, easeOutQuint, fade + animation = layersOut, 1, 1, linear, fade + animation = fadeLayersIn, 1, 1, almostLinear + animation = fadeLayersOut, 1, 1, almostLinear + animation = workspaces, 1, 1, almostLinear, slidevert + } + misc { + force_default_wallpaper = 0 + disable_hyprland_logo = true + } + + ############# + ### INPUT ### + ############# + input { + kb_layout = us + kb_variant = altgr-intl + follow_mouse = 1 + sensitivity = 0 + accel_profile = flat + natural_scroll = true + touchpad { + natural_scroll = true + clickfinger_behavior = true + } + } + + ################### + ### KEYBINDINGS ### + ################### + $mainMod = SUPER + $terminal = ghostty + $menu = ulauncher-toggle + # APP SHORTCUTS + bind = ALT, SPACE, exec, $menu + bind = $mainMod, RETURN, exec, $terminal + # SESSION MANAGEMENT + bind = CTRL ALT, DELETE, exit, + bind = $mainMod, mouse_up, exec, hyprnome + bind = $mainMod, mouse_down, exec, hyprnome --previous + bind = CTRL ALT, j, exec, hyprnome + bind = CTRL ALT, k, exec, hyprnome --previous + bind = $mainMod CTRL ALT, j, exec, hyprnome --move + bind = $mainMod CTRL ALT, k, exec, hyprnome --move --previous + bindel = ,XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+ + bindel = ,XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- + bindel = ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle + bindel = ,XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle + bindel = ,XF86MonBrightnessUp, exec, brightnessctl s 10%+ + bindel = ,XF86MonBrightnessDown, exec, brightnessctl s 10%- + bindl = , XF86AudioNext, exec, playerctl next + bindl = , XF86AudioPause, exec, playerctl play-pause + bindl = , XF86AudioPlay, exec, playerctl play-pause + bindl = , XF86AudioPrev, exec, playerctl previous + bind = CTRL ALT SHIFT, a, exec, bash /home/user/.local/bin/toggle-audio-output.sh + # WINDOW MANAGEMENT + bind = ALT, F4, killactive, + bind = $mainMod, space, togglefloating, + bind = $mainMod, f, fullscreen + bindm = $mainMod, mouse:272, movewindow + bindm = $mainMod, mouse:273, resizewindow + bind = SUPER, h, movefocus, l + bind = SUPER, l, movefocus, r + bind = SUPER, k, movefocus, u + bind = SUPER, j, movefocus, d + bind = $mainMod CTRL, h, movewindow, l + bind = $mainMod CTRL, l, movewindow, r + bind = $mainMod CTRL, k, movewindow, u + bind = $mainMod CTRL, j, movewindow, d + bind = $mainMod, v, exec, ${lib.getExe scrollermodetoggle} + bind = $mainMod, r, scroller:cyclewidth, next + bind = $mainMod CTRL, r, scroller:cyclewidth, prev + bind = $mainMod, p, scroller:pin, + bind = $mainMod, c, scroller:alignwindow, center + bind = $mainMod CTRL, f, scroller:fitsize, all + + #################### + ### WINDOW RULES ### + #################### + windowrulev2 = suppressevent maximize, class:.* + windowrulev2 = nofocus,class:^$,title:^$,xwayland:1,floating:1,fullscreen:0,pinned:0 + # ulauncher + windowrule = float, ulauncher + windowrule = pin, ulauncher + windowrule = noborder, ulauncher + windowrule = noshadow, ulauncher + windowrule = nomaxsize, ulauncher + windowrule = noblur, ulauncher + windowrulev2 = animation slide top, class:^(ulauncher)$ + # firefox + windowrulev2 = plugin:scroller:columnwidth onehalf, class:(firefox) + ''; + }; + + services = { + tritanium-shell = { + enable = true; + integrations.hyprland.enable = true; + settings = { + vertical = true; + animations.activeWorkspace = "smooth"; + minWorkspaces = 1; + lockCommand = "hyprlock"; + bar.modules.workspacesIndicator.reverseScrollDirection = true; + }; + }; + swaync = { + enable = true; + settings = { + positionX = "left"; + positionY = "top"; + layer = "overlay"; + control-center-layer = "top"; + layer-shell = true; + cssPriority = "application"; + control-center-margin-top = 20; + control-center-margin-bottom = 20; + control-center-margin-right = 20; + control-center-margin-left = 20; + notification-2fa-action = true; + notification-inline-replies = false; + notification-icon-size = 64; + notification-body-image-height = 100; + notification-body-image-width = 200; + timeout = 10; + timeout-low = 5; + timeout-critical = 0; + fit-to-screen = true; + relative-timestamps = true; + control-center-width = 500; + control-center-height = 600; + notification-window-width = 500; + keyboard-shortcuts = true; + image-visibility = "when-available"; + transition-time = 200; + hide-on-clear = false; + hide-on-action = true; + script-fail-notify = true; + widgets = [ + "inhibitors" + "title" + "dnd" + "notifications" + "mpris" + ]; + widget-config = { + inhibitors = { + text = "Inhibitors"; + button-text = "Clear All"; + clear-all-button = true; + }; + title = { + text = "Notifications"; + clear-all-button = true; + button-text = "Clear All"; + }; + dnd = { + text = "Do Not Disturb"; + }; + mpris = { + image-size = 96; + image-radius = 12; + }; + }; + }; + }; + }; + + programs = { + hyprlock.enable = true; + }; + + home.packages = with pkgs; [ + brightnessctl + hyprnome + playerctl + swaynotificationcenter + ulauncher + ]; +}