diff --git a/flake.lock b/flake.lock index 412444d..e76cd07 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,28 @@ { "nodes": { + "anyrun": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems" + }, + "locked": { + "lastModified": 1733604390, + "narHash": "sha256-i1V+K46e0OSu3T9q2QsZ3GqpIrSIZx39sRpfcDPa6wU=", + "ref": "plugins-application-preprocess-exec", + "rev": "f9ef5665febcabd03ad2f0ce561c79974194a953", + "revCount": 197, + "type": "git", + "url": "https://git.pvv.ntnu.no/oysteikt/anyrun" + }, + "original": { + "ref": "plugins-application-preprocess-exec", + "type": "git", + "url": "https://git.pvv.ntnu.no/oysteikt/anyrun" + } + }, "dotfiles": { "flake": false, "locked": { @@ -33,9 +56,30 @@ "type": "github" } }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "anyrun", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1727826117, + "narHash": "sha256-K5ZLCyfO/Zj9mPFldf3iwS6oZStJcU4tSpiXTMYaaL0=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "3d04084d54bedc3d6b8b736c70ef449225c361b1", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "flake-utils": { "inputs": { - "systems": "systems" + "systems": "systems_2" }, "locked": { "lastModified": 1681202837, @@ -53,7 +97,7 @@ }, "flake-utils_2": { "inputs": { - "systems": "systems_2" + "systems": "systems_3" }, "locked": { "lastModified": 1681202837, @@ -240,6 +284,7 @@ }, "root": { "inputs": { + "anyrun": "anyrun", "dotfiles": "dotfiles", "home-manager": "home-manager", "matrix-synapse-next": "matrix-synapse-next", @@ -274,6 +319,21 @@ } }, "systems": { + "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_2": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", @@ -288,7 +348,7 @@ "type": "github" } }, - "systems_2": { + "systems_3": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", diff --git a/flake.nix b/flake.nix index 91e57bf..302e9cc 100644 --- a/flake.nix +++ b/flake.nix @@ -52,6 +52,11 @@ url = "github:nix-community/nixos-vscode-server"; inputs.nixpkgs.follows = "nixpkgs"; }; + + anyrun = { + url = "git+https://git.pvv.ntnu.no/oysteikt/anyrun?ref=plugins-application-preprocess-exec"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = inputs@{ @@ -68,6 +73,7 @@ osuchan, sops-nix, vscode-server, + anyrun, # website }: let system = "x86_64-linux"; @@ -174,6 +180,7 @@ sharedModules = [ inputs.sops-nix.homeManagerModules.sops + inputs.anyrun.homeManagerModules.default ]; users.h7x4.imports = [ diff --git a/home/programs/anyrun/default.nix b/home/programs/anyrun/default.nix new file mode 100644 index 0000000..b2e817f --- /dev/null +++ b/home/programs/anyrun/default.nix @@ -0,0 +1,36 @@ +{ pkgs, lib, inputs, ... }: +{ + programs.anyrun = { + enable = true; + + config = { + y.fraction = 0.3; + width.fraction = 0.25; + plugins = [ + inputs.anyrun.packages.${pkgs.system}.applications + ]; + hidePluginInfo = true; + closeOnClick = true; + }; + + extraCss = builtins.readFile (./. + "/style.css"); + + extraConfigFiles."applications.ron".text = let + preprocess_script = pkgs.writeShellApplication { + name = "anyrun-preprocess-application-exec"; + runtimeInputs = [ ]; + text = '' + shift # Remove term|no-term + echo "uwsm app -- $*" + ''; + }; + in '' + Config( + desktop_actions: false, + max_entries: 10, + preprocess_exec_script: Some("${lib.getExe preprocess_script}"), + terminal: Some("${lib.getExe pkgs.alacritty}"), + ) + ''; + }; +} diff --git a/home/programs/anyrun/style.css b/home/programs/anyrun/style.css new file mode 100644 index 0000000..17a8dd5 --- /dev/null +++ b/home/programs/anyrun/style.css @@ -0,0 +1,48 @@ +* { + all: unset; + font-size: 1.2rem; +} + +#window, +#match, +#entry, +#plugin, +#main { + background: transparent; +} + +#match.activatable { + border-radius: 8px; + margin: 4px 0; + padding: 4px; + /* transition: 100ms ease-out; */ +} +#match.activatable:first-child { + margin-top: 12px; +} +#match.activatable:last-child { + margin-bottom: 0; +} + +#match:hover { + background: rgba(255, 255, 255, 0.05); +} +#match:selected { + background: rgba(255, 255, 255, 0.1); +} + +#entry { + background: rgba(255, 255, 255, 0.05); + border: 1px solid rgba(255, 255, 255, 0.1); + border-radius: 8px; + padding: 4px 8px; +} + +box#main { + background: rgba(0, 0, 0, 0.5); + box-shadow: + inset 0 0 0 1px rgba(255, 255, 255, 0.1), + 0 30px 30px 15px rgba(0, 0, 0, 0.5); + border-radius: 20px; + padding: 12px; +}