From c37687b393d650e368bf352a99270cc276201f23 Mon Sep 17 00:00:00 2001 From: Erwin Boskma Date: Thu, 21 Sep 2023 23:24:46 +0200 Subject: [PATCH] Add anyrun and replace rofi --- flake.lock | 45 ++++++++- flake.nix | 5 + home-manager/modules/anyrun/default.nix | 117 ++++++++++++++++++++++++ home-manager/modules/sway/default.nix | 3 +- modules/desktop/default.nix | 3 +- users/erwin/home.nix | 2 + 6 files changed, 172 insertions(+), 3 deletions(-) create mode 100644 home-manager/modules/anyrun/default.nix diff --git a/flake.lock b/flake.lock index 03c4e91..1d5508a 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,26 @@ { "nodes": { + "anyrun": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1692476235, + "narHash": "sha256-NGUDp/24HCIVWE0xZNHIdzz3q2WDk7MQz1wC7ub/e2U=", + "owner": "Kirottu", + "repo": "anyrun", + "rev": "76af3eb198f376303194c31a83f2399a043acf1b", + "type": "github" + }, + "original": { + "owner": "Kirottu", + "repo": "anyrun", + "type": "github" + } + }, "caddy-with-plugins": { "inputs": { "flake-parts": [ @@ -170,6 +191,27 @@ } }, "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "anyrun", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1685662779, + "narHash": "sha256-cKDDciXGpMEjP1n6HlzKinN0H+oLmNpgeCTzYnsA2po=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "71fb97f0d875fd4de4994dfb849f2c75e17eb6c3", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { "inputs": { "nixpkgs-lib": "nixpkgs-lib" }, @@ -519,11 +561,12 @@ }, "root": { "inputs": { + "anyrun": "anyrun", "caddy-with-plugins": "caddy-with-plugins", "disko": "disko", "emacs-overlay": "emacs-overlay", "eww": "eww", - "flake-parts": "flake-parts", + "flake-parts": "flake-parts_2", "flake-utils": "flake-utils", "ha-now-playing": "ha-now-playing", "home-manager": "home-manager", diff --git a/flake.nix b/flake.nix index 24ced1d..a674ceb 100644 --- a/flake.nix +++ b/flake.nix @@ -86,6 +86,11 @@ }; }; + anyrun = { + url = "github:Kirottu/anyrun"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + caddy-with-plugins = { url = "github:eboskma/caddy-with-plugins"; inputs = { diff --git a/home-manager/modules/anyrun/default.nix b/home-manager/modules/anyrun/default.nix new file mode 100644 index 0000000..8ffbf2f --- /dev/null +++ b/home-manager/modules/anyrun/default.nix @@ -0,0 +1,117 @@ +{ pkgs, config, lib, flake-inputs, ... }: +with lib; +let + cfg = config.eboskma.programs.anyrun; + anyrunPkgs = flake-inputs.anyrun.packages."${pkgs.system}"; +in +{ + options.eboskma.programs.anyrun = { enable = mkEnableOption "anyrun"; }; + + config = mkIf cfg.enable { + programs.anyrun = { + enable = true; + config = { + plugins = with anyrunPkgs; [ + applications + dictionary + rink + stdin + shell + symbols + translate + ]; + width = { fraction = 0.3; }; + x = { fraction = 0.5; }; + y = { absolute = 60; }; + layer = "overlay"; + }; + + extraConfigFiles = { + "applications.ron".text = '' + Config( + desktop_actions: true, + max_entries: 0, + terminal: Some("${config.wayland.windowManager.sway.config.terminal}") + ) + ''; + }; + extraCss = '' + window { + background: transparent; /* rgba(0, 0, 0, 0.8);*/ + } + + #match, + #entry, + #plugin, + #main { + background: transparent; + } + + #match.activatable { + padding: 12px 14px; + border-radius: 12px; + + color: white; + margin-top: 4px; + border: 2px solid transparent; + transition: all 0.3s ease; + } + + #match.activatable:not(:first-child) { + border-top-left-radius: 0; + border-top-right-radius: 0; + border-top: 2px solid rgba(255, 255, 255, 0.1); + } + + #match.activatable #match-title { + font-size: 1.3rem; + } + + #match.activatable:hover { + border: 2px solid rgba(255, 255, 255, 0.4); + } + + #match-title, #match-desc { + color: inherit; + } + + #match.activatable:hover, #match.activatable:selected { + border-top-left-radius: 12px; + border-top-right-radius: 12px; + } + + #match.activatable:selected + #match.activatable, #match.activatable:hover + #match.activatable { + border-top: 2px solid transparent; + } + + #match.activatable:selected, #match.activatable:hover:selected { + background: rgba(255,255,255,0.1); + border: 2px solid #333333; + border-top: 2px solid #333333; + } + + #match, #plugin { + box-shadow: none; + } + + #entry { + color: white; + box-shadow: none; + border-radius: 12px; + border: 2px solid #333333; + } + + box#main { + background: rgba(36, 39, 58, 0.7); + border-radius: 16px; + padding: 8px; + box-shadow: 0px 2px 33px -5px rgba(0, 0, 0, 0.5); + } + + row:first-child { + margin-top: 6px; + } + ''; + }; + }; +} diff --git a/home-manager/modules/sway/default.nix b/home-manager/modules/sway/default.nix index 6fce419..dd68c84 100644 --- a/home-manager/modules/sway/default.nix +++ b/home-manager/modules/sway/default.nix @@ -127,7 +127,8 @@ in input = cfg.input; output = cfg.output; - menu = "${pkgs.rofi}/bin/rofi -show drun -no-lazy-grab"; + # menu = "${pkgs.rofi}/bin/rofi -show drun -no-lazy-grab"; + menu = "${config.programs.anyrun.package}/bin/anyrun"; keybindings = { "${mod}+Return" = "exec ${config.wayland.windowManager.sway.config.terminal}"; diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix index d23ec13..754924f 100644 --- a/modules/desktop/default.nix +++ b/modules/desktop/default.nix @@ -87,7 +87,8 @@ in QT_QPA_PLATFORM = "wayland"; QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; QT_QPA_PLATFORMTHEME = "qt5ct"; - SDL_VIDEODRIVER = "wayland"; + # SDL_VIDEODRIVER = "wayland"; + AMD_VULKAN_ICD = "RADV"; NIXOS_OZONE_WL = "1"; }) ]; diff --git a/users/erwin/home.nix b/users/erwin/home.nix index dd3e189..cdd8d45 100644 --- a/users/erwin/home.nix +++ b/users/erwin/home.nix @@ -22,6 +22,7 @@ in eboskma = { programs = { alacritty.enable = false; + anyrun.enable = true; atuin.enable = true; bat.enable = true; cargo = { @@ -308,6 +309,7 @@ in imports = [ ../../modules/options + inputs.anyrun.nixosModules.home-manager ] ++ (map (mod: (../../home-manager/modules + "/${mod}")) (builtins.attrNames (builtins.readDir ../../home-manager/modules))); };