From 34055eb96b4cbcf34771cf979d1d763ed78150c1 Mon Sep 17 00:00:00 2001 From: KaitoTLex Date: Tue, 27 May 2025 11:44:46 -0700 Subject: [PATCH] added hyprscroller.nix --- flake.lock | 111 ++++---- flake.nix | 4 + modules/wm/default.nix | 2 +- pkgs/vendored/hyprscroller.nix | 48 ++++ users/kaitotlex/default.nix | 2 +- .../desktop-environment/hyprland/default.nix | 252 +++++++++--------- 6 files changed, 237 insertions(+), 182 deletions(-) create mode 100644 pkgs/vendored/hyprscroller.nix diff --git a/flake.lock b/flake.lock index 77c4b8f..dcf6bdc 100644 --- a/flake.lock +++ b/flake.lock @@ -70,17 +70,17 @@ "cpu-microcodes": { "flake": false, "locked": { - "lastModified": 1746370478, - "narHash": "sha256-3mpvHkDiQcpXrAS1lNJe2oYbKLTQnCbAkSmIWNF5l98=", + "lastModified": 1747081695, + "narHash": "sha256-nnim3432n3+iwD2alY1cigQE7GKnI8BkyZDJTzood+E=", "owner": "platomav", "repo": "CPUMicrocodes", - "rev": "71092548b863438bf630ba54290002694da05655", + "rev": "2bcc2d8cb648c3397ea7381ca6887a9e3fdd6164", "type": "github" }, "original": { "owner": "platomav", "repo": "CPUMicrocodes", - "rev": "71092548b863438bf630ba54290002694da05655", + "rev": "2bcc2d8cb648c3397ea7381ca6887a9e3fdd6164", "type": "github" } }, @@ -171,7 +171,6 @@ "inputs": { "nixpkgs-lib": [ "stylix", - "nur", "nixpkgs" ] }, @@ -189,27 +188,6 @@ "type": "github" } }, - "flake-utils": { - "inputs": { - "systems": [ - "stylix", - "systems" - ] - }, - "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "fromYaml": { "flake": false, "locked": { @@ -299,16 +277,16 @@ "gnome-shell": { "flake": false, "locked": { - "lastModified": 1732369855, - "narHash": "sha256-JhUWbcYPjHO3Xs3x9/Z9RuqXbcp5yhPluGjwsdE2GMg=", + "lastModified": 1744584021, + "narHash": "sha256-0RJ4mJzf+klKF4Fuoc8VN8dpQQtZnKksFmR2jhWE1Ew=", "owner": "GNOME", "repo": "gnome-shell", - "rev": "dadd58f630eeea41d645ee225a63f719390829dc", + "rev": "52c517c8f6c199a1d6f5118fae500ef69ea845ae", "type": "github" }, "original": { "owner": "GNOME", - "ref": "47.2", + "ref": "48.1", "repo": "gnome-shell", "type": "github" } @@ -320,11 +298,11 @@ ] }, "locked": { - "lastModified": 1747367409, - "narHash": "sha256-JUcfcXCsoerQNQDhujj6LNBI/9LOkjUrLNR0tjcU0Gc=", + "lastModified": 1748227609, + "narHash": "sha256-SaSdslyo6UGDpPUlmrPA4dWOEuxCy2ihRN9K6BnqYsA=", "owner": "nix-community", "repo": "home-manager", - "rev": "a1a72d18ee75ce4559b5f59296a7b2d37f608c1c", + "rev": "d23d20f55d49d8818ac1f1b2783671e8a6725022", "type": "github" }, "original": { @@ -341,11 +319,11 @@ ] }, "locked": { - "lastModified": 1747279714, - "narHash": "sha256-UdxlE8yyrKiGq3bgGyJ78AdFwh+fuRAruKtyFY5Zq5I=", + "lastModified": 1747763032, + "narHash": "sha256-9j3oCbemeH7bTVXJ3pDWxOptbxDx2SdK1jY2AHpjQiw=", "owner": "nix-community", "repo": "home-manager", - "rev": "954615c510c9faa3ee7fb6607ff72e55905e69f2", + "rev": "29dda415f5b2178278283856c6f9f7b48a2a4353", "type": "github" }, "original": { @@ -354,6 +332,22 @@ "type": "github" } }, + "hyprscroller-src": { + "flake": false, + "locked": { + "lastModified": 1748269327, + "narHash": "sha256-UfkU8YJCIp5NwW6e+qoRgxZVJYcc6+aRVTdSaHvskTQ=", + "owner": "cpiber", + "repo": "hyprscroller", + "rev": "5b3cdd1fc26be1a0b1936fc36065b2eba84948f4", + "type": "github" + }, + "original": { + "owner": "cpiber", + "repo": "hyprscroller", + "type": "github" + } + }, "lanzaboote": { "inputs": { "crane": "crane", @@ -427,11 +421,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1747179050, - "narHash": "sha256-qhFMmDkeJX9KJwr5H32f1r7Prs7XbQWtO0h3V0a0rFY=", + "lastModified": 1748190013, + "narHash": "sha256-R5HJFflOfsP5FBtk+zE8FpL8uqE7n62jqOsADvVshhE=", "owner": "nixos", "repo": "nixpkgs", - "rev": "adaa24fbf46737f3f1b5497bf64bae750f82942e", + "rev": "62b852f6c6742134ade1abdd2a21685fd617a291", "type": "github" }, "original": { @@ -480,7 +474,10 @@ }, "nur": { "inputs": { - "flake-parts": "flake-parts_2", + "flake-parts": [ + "stylix", + "flake-parts" + ], "nixpkgs": [ "stylix", "nixpkgs" @@ -563,6 +560,7 @@ "root": { "inputs": { "home-manager": "home-manager", + "hyprscroller-src": "hyprscroller-src", "lanzaboote": "lanzaboote", "nixpkgs": "nixpkgs_2", "nixvim": "nixvim", @@ -602,11 +600,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1747355848, - "narHash": "sha256-WpOTfGuObhpaI38+uHgaOwnMAjHMrdLrfs6D35fKwjk=", + "lastModified": 1748147548, + "narHash": "sha256-9IaAQkgyF4PFtVyui8vF6oJah0iVcO9DaOefjdTMthE=", "owner": "Gerg-L", "repo": "spicetify-nix", - "rev": "a2bc0d49449fc61ca2eb364d6189179059394483", + "rev": "f0595e3b59260457042450749eaec00a5a47db35", "type": "github" }, "original": { @@ -623,7 +621,7 @@ "base16-vim": "base16-vim", "firefox-gnome-theme": "firefox-gnome-theme", "flake-compat": "flake-compat_2", - "flake-utils": "flake-utils", + "flake-parts": "flake-parts_2", "git-hooks": "git-hooks", "gnome-shell": "gnome-shell", "home-manager": "home-manager_2", @@ -639,11 +637,11 @@ "tinted-zed": "tinted-zed" }, "locked": { - "lastModified": 1747365543, - "narHash": "sha256-r5HRe9CRFe6qvy7KLkTX9WySTqkNmvlobTR8g5AHLHA=", + "lastModified": 1748369100, + "narHash": "sha256-rZO2WC1cVIpmwtBKxkex4lJAM7zqut3+5QKZltBkG5U=", "owner": "danth", "repo": "stylix", - "rev": "7566bc015064ed3eb50b436f2225ddab06132beb", + "rev": "dedf5de5792af6c16560f9cc8864be73ae535251", "type": "github" }, "original": { @@ -702,17 +700,16 @@ "tinted-kitty": { "flake": false, "locked": { - "lastModified": 1716423189, - "narHash": "sha256-2xF3sH7UIwegn+2gKzMpFi3pk5DlIlM18+vj17Uf82U=", + "lastModified": 1735730497, + "narHash": "sha256-4KtB+FiUzIeK/4aHCKce3V9HwRvYaxX+F1edUrfgzb8=", "owner": "tinted-theming", "repo": "tinted-kitty", - "rev": "eb39e141db14baef052893285df9f266df041ff8", + "rev": "de6f888497f2c6b2279361bfc790f164bfd0f3fa", "type": "github" }, "original": { "owner": "tinted-theming", "repo": "tinted-kitty", - "rev": "eb39e141db14baef052893285df9f266df041ff8", "type": "github" } }, @@ -791,11 +788,11 @@ "cpu-microcodes": "cpu-microcodes" }, "locked": { - "lastModified": 1746447632, - "narHash": "sha256-h/9skHfT2+bHBUXX0CGZROknobw7/+X8bAa+kDv0rkE=", + "lastModified": 1747656938, + "narHash": "sha256-LE5jjWIN3xzL24ph8U2CwzTPrCxS+uGzXCpSh6b+UPk=", "owner": "e-tho", "repo": "ucodenix", - "rev": "355238cbd87e5bf9cbc23ae65b90740eb10e8d56", + "rev": "86d47e4b5790cc68b3af14ec9969ef8128524d43", "type": "github" }, "original": { @@ -827,11 +824,11 @@ ] }, "locked": { - "lastModified": 1747282003, - "narHash": "sha256-UlCfXNncIYwUvPxHngoH6pY4fiZlU8Z2Ve/gUEn6h+o=", + "lastModified": 1748059546, + "narHash": "sha256-e0jy8RU8ofOdeS5gF9Hir+M5Wn0q7D8MkpeQXsOJdu4=", "owner": "youwen5", "repo": "zen-browser-flake", - "rev": "952ca99903f19a7096a3709f2938d9c7840a5f91", + "rev": "716a5af28d686d67146d01b14112c919b6133a84", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index f37dc33..6f8262e 100644 --- a/flake.nix +++ b/flake.nix @@ -32,6 +32,10 @@ lanzaboote = { url = "github:nix-community/lanzaboote/v0.4.2"; }; + hyprscroller-src = { + url = "github:cpiber/hyprscroller"; + flake = false; + }; }; outputs = diff --git a/modules/wm/default.nix b/modules/wm/default.nix index 9435185..8aa658f 100644 --- a/modules/wm/default.nix +++ b/modules/wm/default.nix @@ -4,7 +4,7 @@ enable = true; settings = { default_session = { - command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd Hyprland --asterisks"; + command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd Hyprland --asterisks --remember"; # --remember tuigreet --time --cmd Hyprland --remember --asterisks --greeting 'Access granted for those who don't touch grass' user = "greeter"; }; diff --git a/pkgs/vendored/hyprscroller.nix b/pkgs/vendored/hyprscroller.nix new file mode 100644 index 0000000..d3261b2 --- /dev/null +++ b/pkgs/vendored/hyprscroller.nix @@ -0,0 +1,48 @@ +{ + lib, + hyprland, + pkg-config, + cmake, + src, + version, +}: +let + mkHyprlandPlugin = + hyprland: + args@{ pluginName, ... }: + hyprland.stdenv.mkDerivation ( + args + // { + pname = "${pluginName}"; + nativeBuildInputs = [ pkg-config ] ++ args.nativeBuildInputs or [ ]; + buildInputs = [ hyprland ] ++ hyprland.buildInputs ++ (args.buildInputs or [ ]); + meta = args.meta // { + description = args.meta.description or ""; + longDescription = + (args.meta.longDescription or "") + + "\n\nPlugins can be installed via a plugin entry in the Hyprland NixOS or Home Manager options."; + }; + } + ); +in +mkHyprlandPlugin hyprland { + inherit src version; + pluginName = "hyprscroller"; + + nativeBuildInputs = [ cmake ]; + + installPhase = '' + runHook preInstall + mkdir -p $out/lib + mv hyprscroller.so $out/lib/libhyprscroller.so + runHook postInstall + ''; + + meta = { + homepage = "https://github.com/cpiber/hyprscroller"; + description = "Hyprland layout plugin providing a scrolling layout like PaperWM"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ youwen5 ]; + platforms = lib.platforms.linux; + }; +} diff --git a/users/kaitotlex/default.nix b/users/kaitotlex/default.nix index 1ff4145..42f8144 100644 --- a/users/kaitotlex/default.nix +++ b/users/kaitotlex/default.nix @@ -6,6 +6,6 @@ ./desktop-environment ]; - liminalOS.formFactor = "desktop"; + liminalOS.formFactor = "laptop"; liminalOS.powersave = false; } diff --git a/users/kaitotlex/desktop-environment/hyprland/default.nix b/users/kaitotlex/desktop-environment/hyprland/default.nix index 12ff053..53dc1f6 100644 --- a/users/kaitotlex/desktop-environment/hyprland/default.nix +++ b/users/kaitotlex/desktop-environment/hyprland/default.nix @@ -3,6 +3,7 @@ config, lib, osConfig, + inputs, ... }: let @@ -98,139 +99,144 @@ in hyprland-qtutils ]; - wayland.windowManager.hyprland = { - enable = true; - plugins = [ - (pkgs.hyprlandPlugins.hyprscroller.overrideAttrs { - version = "0-unstable-2025-03-28"; - src = pkgs.fetchFromGitHub { - owner = "dawsers"; - repo = "hyprscroller"; - rev = "3f86916f3e9a583154b1be0af4e8a1ef1f7435b2"; - hash = "sha256-mgYq3vc4JtIzVuAKTWdALOynImYyNZEXh7tiVPvMZg4="; - }; - }) - ]; - settings = { - exec-once = [ - "hyprctl dispatch workspace 100000" - ]; - "$mod" = "SUPER"; - "$Left" = "H"; - "$Right" = "L"; - "$Up" = "K"; - "$Down" = "J"; - env = ( - lib.optionals cfg.gtkUseOpenGL [ - "GSK_RENDERER,ngl" - ] - ); - layerrule = [ - "blur,rofi" - "ignorezero,rofi" - "animation slide bottom 0.2 0.2 wind,rofi" - "blur,notifications" - "ignorezero,notifications" - "blur,swaync-notification-window" - "animation slide right 0.5 0.5,swaync-control-center" - "animation slide right 0.5 0.5,notifications" - "animation slide right 0.5 0.5,swaync-notification-window" - "ignorezero,swaync-notification-window" - "blur,swaync-control-center" - "ignorezero,swaync-control-center" - "blur,logout_dialog" - ]; - dwindle = { - pseudotile = "yes"; - preserve_split = "yes"; + wayland.windowManager.hyprland = + let + hyprscroller = pkgs.callPackage ./pkgs/vendored/hyprscroller.nix { + src = inputs.hyprscroller-src; + version = inputs.hyprscroller-src.lastModified; }; - animations = { - enabled = "yes"; - bezier = [ - "wind, 0.05, 0.9, 0.1, 1.05" - "winIn, 0.1, 1.1, 0.1, 1.1" - "winOut, 0.3, -0.3, 0, 1" - "liner, 1, 1, 1, 1" - "windup, 0.05, 0.9, 0.1, 1.05" + in + { + enable = true; + plugins = [ hyprscroller ]; + settings = { + input.touchpad = lib.mkIf (config.liminalOS.formFactor == "laptop") { + natural_scroll = true; + disable_while_typing = true; + clickfinger_behavior = true; + tap-to-click = false; + scroll_factor = 0.15; + }; + + exec-once = [ + "hyprctl dispatch workspace 100000" ]; - animation = - [ - "windows, 1, 6, wind, slide" - "windowsIn, 1, 6, winIn, slide" - "windowsOut, 1, 5, winOut, slide" - "windowsMove, 1, 5, wind, slide" - "fade, 1, 10, default" - # "layers, 1, 8, default, slide" - "workspaces, 1, 5, wind, slidefadevert" + "$mod" = "SUPER"; + "$Left" = "H"; + "$Right" = "L"; + "$Up" = "K"; + "$Down" = "J"; + env = ( + lib.optionals cfg.gtkUseOpenGL [ + "GSK_RENDERER,ngl" ] - ++ (lib.optionals (!osConfig.liminalOS.powersave) [ - "border, 1, 1, liner" - "borderangle, 1, 30, liner, loop" - ]); - }; - - general = - let - inherit (config.lib.stylix) colors; - in - { - gaps_in = "3"; - gaps_out = "8"; - border_size = "2"; - # "col.active_border" = pkgs.lib.mkForce "rgba(ca9ee6ff) rgba(f2d5cfff) 45deg"; - # "col.inactive_border" = pkgs.lib.mkForce "rgba(b4befecc) rgba(6c7086cc) 45deg"; - "col.active_border" = "rgba(${colors.base0A}ff) rgba(${colors.base09}ff) 45deg"; - "col.inactive_border" = "rgba(${colors.base01}cc) rgba(${colors.base02}cc) 45deg"; - layout = "scroller"; - resize_on_border = "true"; + ); + layerrule = [ + "blur,rofi" + "ignorezero,rofi" + "animation slide bottom 0.2 0.2 wind,rofi" + "blur,notifications" + "ignorezero,notifications" + "blur,swaync-notification-window" + "animation slide right 0.5 0.5,swaync-control-center" + "animation slide right 0.5 0.5,notifications" + "animation slide right 0.5 0.5,swaync-notification-window" + "ignorezero,swaync-notification-window" + "blur,swaync-control-center" + "ignorezero,swaync-control-center" + "blur,logout_dialog" + ]; + dwindle = { + pseudotile = "yes"; + preserve_split = "yes"; }; - - misc = { - disable_hyprland_logo = true; - disable_splash_rendering = true; - }; - - cursor = { - hide_on_key_press = true; - }; - - decoration = { - rounding = "10"; - dim_special = "0.3"; - blur = { + animations = { enabled = "yes"; - size = "6"; - passes = "3"; - new_optimizations = "on"; - ignore_opacity = "on"; - xray = "false"; - special = true; + bezier = [ + "wind, 0.05, 0.9, 0.1, 1.05" + "winIn, 0.1, 1.1, 0.1, 1.1" + "winOut, 0.3, -0.3, 0, 1" + "liner, 1, 1, 1, 1" + "windup, 0.05, 0.9, 0.1, 1.05" + ]; + animation = + [ + "windows, 1, 6, wind, slide" + "windowsIn, 1, 6, winIn, slide" + "windowsOut, 1, 5, winOut, slide" + "windowsMove, 1, 5, wind, slide" + "fade, 1, 10, default" + # "layers, 1, 8, default, slide" + "workspaces, 1, 5, wind, slidefadevert" + ] + ++ (lib.optionals (!osConfig.liminalOS.powersave) [ + "border, 1, 1, liner" + "borderangle, 1, 30, liner, loop" + ]); }; - shadow = { - enabled = false; + + general = + let + inherit (config.lib.stylix) colors; + in + { + gaps_in = "3"; + gaps_out = "8"; + border_size = "2"; + # "col.active_border" = pkgs.lib.mkForce "rgba(ca9ee6ff) rgba(f2d5cfff) 45deg"; + # "col.inactive_border" = pkgs.lib.mkForce "rgba(b4befecc) rgba(6c7086cc) 45deg"; + "col.active_border" = "rgba(${colors.base0A}ff) rgba(${colors.base09}ff) 45deg"; + "col.inactive_border" = "rgba(${colors.base01}cc) rgba(${colors.base02}cc) 45deg"; + layout = "scroller"; + resize_on_border = "true"; + }; + + misc = { + disable_hyprland_logo = true; + disable_splash_rendering = true; }; + + cursor = { + hide_on_key_press = true; + }; + + decoration = { + rounding = "10"; + dim_special = "0.3"; + blur = { + enabled = "yes"; + size = "6"; + passes = "3"; + new_optimizations = "on"; + ignore_opacity = "on"; + xray = "false"; + special = true; + }; + shadow = { + enabled = false; + }; + }; + input = { + sensitivity = "-0.25"; + }; + plugin.scroller = { + column_widths = "onethird onehalf twothirds one"; + column_heights = "onethird onehalf twothirds one"; + }; + experimental.xx_color_management_v4 = true; }; - input = { - sensitivity = "-0.25"; - }; - plugin.scroller = { - column_widths = "onethird onehalf twothirds one"; - column_heights = "onethird onehalf twothirds one"; - }; - experimental.xx_color_management_v4 = true; }; - }; - - wayland.windowManager.hyprland.settings.input.touchpad = - lib.mkIf (config.liminalOS.formFactor == "laptop") - { - natural_scroll = true; - disable_while_typing = true; - clickfinger_behavior = true; - tap-to-click = false; - scroll_factor = 0.15; - }; + # wayland.windowManager.hyprland.settings.input.touchpad = + # lib.mkIf (config.liminalOS.formFactor == "laptop") + # { + # natural_scroll = true; + # disable_while_typing = true; + # clickfinger_behavior = true; + # tap-to-click = false; + # scroll_factor = 0.15; + # }; + # assertions = [ { assertion =