diff --git a/flake.lock b/flake.lock index 360b87e..8e067cc 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,49 @@ { "nodes": { + "anyrun": { + "inputs": { + "anyrun-provider": "anyrun-provider", + "flake-parts": "flake-parts", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems" + }, + "locked": { + "lastModified": 1778513621, + "narHash": "sha256-zo+sQJQ1eqZdoEtIsdxRnchpxQMgK022UnWZdSq6NRw=", + "owner": "anyrun-org", + "repo": "anyrun", + "rev": "a338930f02ab4627cead5105b3d1fbce5a370aa8", + "type": "github" + }, + "original": { + "owner": "anyrun-org", + "repo": "anyrun", + "type": "github" + } + }, + "anyrun-provider": { + "inputs": { + "nixpkgs": [ + "anyrun", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1764705714, + "narHash": "sha256-4rN2vWicM6Pn6eTo3Nu7IB5isbkc9u4arNMnY2+S8iM=", + "owner": "anyrun-org", + "repo": "anyrun-provider", + "rev": "88a786e6029733a4c02c2c6b1024f65029b0b9cf", + "type": "github" + }, + "original": { + "owner": "anyrun-org", + "repo": "anyrun-provider", + "type": "github" + } + }, "aquamarine": { "inputs": { "hyprutils": [ @@ -182,6 +226,27 @@ } }, "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "anyrun", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1763759067, + "narHash": "sha256-LlLt2Jo/gMNYAwOgdRQBrsRoOz7BPRkzvNaI/fzXi2Q=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "2cccadc7357c0ba201788ae99c4dfa90728ef5e0", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { "inputs": { "nixpkgs-lib": "nixpkgs-lib" }, @@ -199,7 +264,7 @@ "type": "github" } }, - "flake-parts_2": { + "flake-parts_3": { "inputs": { "nixpkgs-lib": [ "stylix", @@ -387,7 +452,7 @@ "hyprwire": "hyprwire", "nixpkgs": "nixpkgs", "pre-commit-hooks": "pre-commit-hooks", - "systems": "systems", + "systems": "systems_2", "xdph": "xdph" }, "locked": { @@ -640,7 +705,7 @@ "cachyos-kernel": "cachyos-kernel", "cachyos-kernel-patches": "cachyos-kernel-patches", "flake-compat": "flake-compat_2", - "flake-parts": "flake-parts", + "flake-parts": "flake-parts_2", "nixpkgs": "nixpkgs_2" }, "locked": { @@ -837,6 +902,7 @@ }, "root": { "inputs": { + "anyrun": "anyrun", "home-manager": "home-manager", "home-manager-stable": "home-manager-stable", "hyprland": "hyprland", @@ -855,11 +921,11 @@ "base16-helix": "base16-helix", "base16-vim": "base16-vim", "firefox-gnome-theme": "firefox-gnome-theme", - "flake-parts": "flake-parts_2", + "flake-parts": "flake-parts_3", "gnome-shell": "gnome-shell", "nixpkgs": "nixpkgs_5", "nur": "nur", - "systems": "systems_2", + "systems": "systems_3", "tinted-kitty": "tinted-kitty", "tinted-schemes": "tinted-schemes", "tinted-tmux": "tinted-tmux", @@ -895,6 +961,21 @@ } }, "systems_2": { + "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" + } + }, + "systems_3": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", diff --git a/flake.nix b/flake.nix index bb2e3e9..54f32b2 100644 --- a/flake.nix +++ b/flake.nix @@ -33,6 +33,11 @@ # upstream needs newer stdenv than 25.11 ships. hyprland.url = "github:hyprwm/Hyprland"; + anyrun = { + url = "github:anyrun-org/anyrun"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + stylix.url = "github:nix-community/stylix"; }; outputs = @@ -44,6 +49,7 @@ , zen-browser , nix-cachyos-kernel , hyprland + , anyrun , stylix , proton-cachyos-nix , ... diff --git a/settings/hyprland.nix b/settings/hyprland.nix index 7150eed..f32bd2c 100644 --- a/settings/hyprland.nix +++ b/settings/hyprland.nix @@ -2,6 +2,7 @@ { config, pkgs, lib, inputs, ... }: let hyprland-pkgs = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}; + anyrun-pkgs = inputs.anyrun.packages.${pkgs.stdenv.hostPlatform.system}; isMacbook = config.networking.hostName == "FredOS-Macbook"; isGaming = !isMacbook; @@ -94,6 +95,15 @@ in polkit_gnome ]; + # Use upstream anyrun flake's HM module instead of the built-in one + # for working daemon mode. + home-manager.sharedModules = [ + ({ modulesPath, ... }: { + disabledModules = [ "${modulesPath}/programs/anyrun.nix" ]; + }) + inputs.anyrun.homeManagerModules.default + ]; + home-manager.users.fred = { config, lib, pkgs, inputs, ... }: let c = config.lib.stylix.colors; @@ -201,16 +211,20 @@ in extraConfig = let powerMenu = pkgs.writeShellScript "power-menu" '' + # Standalone stdin mode conflicts with the daemon. + ${anyrun-pkgs.anyrun}/bin/anyrun quit 2>/dev/null || true choice=$(printf '%s\n' \ $'\uf023 Lock' \ $'\uf08b Logout' \ $'\uf01e Reboot' \ $'\uf011 Shutdown' \ - | ${pkgs.anyrun}/bin/anyrun \ - --plugins "${pkgs.anyrun}/lib/libstdin.so" \ + | ${anyrun-pkgs.anyrun}/bin/anyrun \ + --plugins "${anyrun-pkgs.stdin}/lib/libstdin.so" \ --show-results-immediately true \ --hide-plugin-info true \ --close-on-click true) + # Restart the daemon. + ${anyrun-pkgs.anyrun}/bin/anyrun daemon & case "$choice" in *Lock) ${pkgs.hyprlock}/bin/hyprlock ;; *Logout) hyprctl dispatch exit ;; @@ -261,6 +275,7 @@ in hl.exec_cmd("wl-paste --type image --watch cliphist store") hl.exec_cmd("hyprctl setcursor Bibata-Modern-Ice 24") hl.exec_cmd("swayosd-server") + hl.exec_cmd("anyrun daemon") ${lib.optionalString isMacbook ''hl.exec_cmd("hypridle")''} end) @@ -286,7 +301,7 @@ in -- Apps hl.bind(mod .. " + T", hl.dsp.exec_cmd("ghostty")) hl.bind(mod .. " + E", hl.dsp.exec_cmd("nemo")) - hl.bind(mod .. " + R", hl.dsp.exec_cmd("killall anyrun || anyrun")) + hl.bind(mod .. " + R", hl.dsp.exec_cmd("anyrun close || anyrun")) hl.bind(mod .. " + Q", hl.dsp.window.close()) hl.bind(mod .. " + SHIFT + E", hl.dsp.exit()) @@ -305,8 +320,8 @@ in hl.bind(mod .. " + K", hl.dsp.focus({ direction = "up" })) hl.bind(mod .. " + J", hl.dsp.focus({ direction = "down" })) - -- Power menu — toggle: kills anyrun if already open - hl.bind(mod .. " + L", hl.dsp.exec_cmd("killall anyrun || ${powerMenu}")) + -- Power menu — dismiss launcher if open, then show menu + hl.bind(mod .. " + L", hl.dsp.exec_cmd("anyrun close 2>/dev/null; ${powerMenu}")) -- Move windows hl.bind(mod .. " + SHIFT + left", hl.dsp.window.move({ direction = "left" })) @@ -372,7 +387,7 @@ in programs.anyrun = { enable = true; config = { - plugins = [ "${pkgs.anyrun}/lib/libapplications.so" ]; + plugins = [ "${anyrun-pkgs.applications}/lib/libapplications.so" ]; x.fraction = 0.5; y.fraction = 0.25; width.absolute = 350;