From bfbb2316b3e4a439babee3bed40ab28b636d4691 Mon Sep 17 00:00:00 2001 From: zackartz Date: Sun, 28 Apr 2024 21:34:12 -0400 Subject: [PATCH] 502 current 2024-04-28 21:34:01 24.05.20240428.30ddacc 6.8.6-zen1 * --- flake.lock | 57 +++++++++++-- flake.nix | 2 + modules/home-manager/default.nix | 12 +++ modules/rice/anyrun/cfg/applications.ron | 5 ++ modules/rice/anyrun/cfg/shell.ron | 3 + modules/rice/anyrun/cfg/websearch.ron | 13 +++ modules/rice/anyrun/default.nix | 102 +++++++++++++++++++++++ modules/rice/hyprland/binds.nix | 2 +- modules/rice/hyprland/default.nix | 17 +++- 9 files changed, 201 insertions(+), 12 deletions(-) create mode 100644 modules/rice/anyrun/cfg/applications.ron create mode 100644 modules/rice/anyrun/cfg/shell.ron create mode 100644 modules/rice/anyrun/cfg/websearch.ron create mode 100644 modules/rice/anyrun/default.nix diff --git a/flake.lock b/flake.lock index d3576cf..fc554c1 100644 --- a/flake.lock +++ b/flake.lock @@ -18,6 +18,27 @@ "type": "github" } }, + "anyrun": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1713259062, + "narHash": "sha256-WTO84hUL8IlNuHDK2yOCeJ38EewFzGt5E0kzBjNWxa8=", + "owner": "Kirottu", + "repo": "anyrun", + "rev": "f9d30e34fa4ccb2797c6becec37e8bcff6585d39", + "type": "github" + }, + "original": { + "owner": "Kirottu", + "repo": "anyrun", + "type": "github" + } + }, "catppuccin": { "locked": { "lastModified": 1713895615, @@ -115,6 +136,27 @@ } }, "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "anyrun", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1696343447, + "narHash": "sha256-B2xAZKLkkeRFG5XcHHSXXcP7To9Xzr59KXeZiRf4vdQ=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "c9afaba3dfa4085dbd2ccb38dfade5141e33d9d4", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { "inputs": { "nixpkgs-lib": [ "lanzaboote", @@ -135,7 +177,7 @@ "type": "github" } }, - "flake-parts_2": { + "flake-parts_3": { "inputs": { "nixpkgs-lib": [ "neovim-nightly-overlay", @@ -156,7 +198,7 @@ "type": "github" } }, - "flake-parts_3": { + "flake-parts_4": { "inputs": { "nixpkgs-lib": [ "neovim-nightly-overlay", @@ -177,7 +219,7 @@ "type": "indirect" } }, - "flake-parts_4": { + "flake-parts_5": { "inputs": { "nixpkgs-lib": "nixpkgs-lib" }, @@ -309,7 +351,7 @@ }, "hercules-ci-effects": { "inputs": { - "flake-parts": "flake-parts_3", + "flake-parts": "flake-parts_4", "nixpkgs": [ "neovim-nightly-overlay", "nixpkgs" @@ -555,7 +597,7 @@ "inputs": { "crane": "crane", "flake-compat": "flake-compat", - "flake-parts": "flake-parts", + "flake-parts": "flake-parts_2", "flake-utils": "flake-utils_2", "nixpkgs": [ "nixpkgs" @@ -605,7 +647,7 @@ "neovim-nightly-overlay": { "inputs": { "flake-compat": "flake-compat_2", - "flake-parts": "flake-parts_2", + "flake-parts": "flake-parts_3", "hercules-ci-effects": "hercules-ci-effects", "neovim-flake": "neovim-flake", "nixpkgs": [ @@ -793,7 +835,7 @@ }, "rio-term": { "inputs": { - "flake-parts": "flake-parts_4", + "flake-parts": "flake-parts_5", "nixpkgs": [ "nixpkgs" ], @@ -817,6 +859,7 @@ "root": { "inputs": { "ags": "ags", + "anyrun": "anyrun", "catppuccin": "catppuccin", "home-manager": "home-manager", "hyprcontrib": "hyprcontrib", diff --git a/flake.nix b/flake.nix index 3143e7d..62183c4 100644 --- a/flake.nix +++ b/flake.nix @@ -18,6 +18,8 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + anyrun.url = "github:Kirottu/anyrun"; + anyrun.inputs.nixpkgs.follows = "nixpkgs"; ags.url = "github:Aylur/ags"; nixos-generators = { diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index 7bc6094..c46aa3f 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -19,6 +19,7 @@ in { ../rice/kitty.nix # ../rice/waybar # ../rice/dunst.nix + ../rice/anyrun ../rice/rio.nix ../rice/wofi.nix ../shell @@ -101,6 +102,17 @@ in { git push origin main popd '') + (pkgs.writeShellScriptBin "powermenu" '' + chosen=$(printf " Power Off\n Restart\n Suspend\n Lock\n󰍃 Log Out" | anyrun --plugins libstdin.so --show-results-immediately true) + + case "$chosen" in + " Power Off") systemctl poweroff;; + " Restart") systemctl reboot;; + " Lock") swaylock;; + "󰍃 Log Out") hyprctl dispatch exit;; + *) exit 1 ;; + esac + '') ]; home.sessionVariables = { diff --git a/modules/rice/anyrun/cfg/applications.ron b/modules/rice/anyrun/cfg/applications.ron new file mode 100644 index 0000000..4742d01 --- /dev/null +++ b/modules/rice/anyrun/cfg/applications.ron @@ -0,0 +1,5 @@ +Config( + desktop_actions: false, + max_entries: 5, + terminal: Some("Kitty"), +) diff --git a/modules/rice/anyrun/cfg/shell.ron b/modules/rice/anyrun/cfg/shell.ron new file mode 100644 index 0000000..926bd7a --- /dev/null +++ b/modules/rice/anyrun/cfg/shell.ron @@ -0,0 +1,3 @@ +Config( + prefix: ">", +) diff --git a/modules/rice/anyrun/cfg/websearch.ron b/modules/rice/anyrun/cfg/websearch.ron new file mode 100644 index 0000000..ca1f92e --- /dev/null +++ b/modules/rice/anyrun/cfg/websearch.ron @@ -0,0 +1,13 @@ +Config( + prefix: "", + // Options: Google, Ecosia, Bing, DuckDuckGo, Custom + // + // Custom engines can be defined as such: + // Custom( + // name: "Searx", + // url: "searx.be/?q={}", + // ) + // + // NOTE: `{}` is replaced by the search query and `https://` is automatically added in front. + engines: [DuckDuckGo] +) diff --git a/modules/rice/anyrun/default.nix b/modules/rice/anyrun/default.nix new file mode 100644 index 0000000..eddb7ee --- /dev/null +++ b/modules/rice/anyrun/default.nix @@ -0,0 +1,102 @@ +{ + inputs, + pkgs, + ... +}: { + imports = [inputs.anyrun.homeManagerModules.default]; + + programs.anyrun = { + enable = true; + config = { + plugins = [ + inputs.anyrun.packages.${pkgs.system}.applications + inputs.anyrun.packages.${pkgs.system}.shell + inputs.anyrun.packages.${pkgs.system}.websearch + inputs.anyrun.packages.${pkgs.system}.rink + inputs.anyrun.packages.${pkgs.system}.stdin + ]; + x = {fraction = 0.5;}; + y = {absolute = 0;}; + hideIcons = false; + ignoreExclusiveZones = false; + layer = "overlay"; + hidePluginInfo = true; + closeOnClick = true; + showResultsImmediately = false; + maxEntries = null; + }; + extraCss = '' + *{ + all: unset; + color: #cdd6f4; + font-family: "JetBrainsMono Nerd Font"; + font-weight: bold; + } + #window{ + background-color: transparent; + } + #entry{ + background-color: #1e1e2e; + border-radius: 15px; + border: 3px solid #11111b; + font-size: 16px; + margin-top: 10px; + padding: 1px 15px; + } + #match { + margin-bottom: 2px; + margin-top: 2px; + padding: 1px 15px; + } + #match-desc{ + color: #bac2de; + font-size: 12px; + font-weight: normal; + } + #match:selected { + background: #313244; + border-radius: 15px; + } + #plugin{ + background-color: #1e1e2e; + border-radius: 15px; + border: 3px solid #11111b; + margin-top:10px; + padding: 10px 1px; + } + #plugin > *{ + all:unset; + } + ''; + + extraConfigFiles."applications.ron".text = '' + Config( + desktop_actions: false, + max_entries: 5, + terminal: Some("Kitty"), + ) + ''; + + extraConfigFiles."shell.ron".text = '' + Config( + prefix: ">", + ) + ''; + + extraConfigFiles."websearch.ron".text = '' + Config( + prefix: "", + // Options: Google, Ecosia, Bing, DuckDuckGo, Custom + // + // Custom engines can be defined as such: + // Custom( + // name: "Searx", + // url: "searx.be/?q={}", + // ) + // + // NOTE: `{}` is replaced by the search query and `https://` is automatically added in front. + engines: [DuckDuckGo] + ) + ''; + }; +} diff --git a/modules/rice/hyprland/binds.nix b/modules/rice/hyprland/binds.nix index df36b3e..ea243a0 100644 --- a/modules/rice/hyprland/binds.nix +++ b/modules/rice/hyprland/binds.nix @@ -25,7 +25,7 @@ in { [ ''${mod},RETURN,exec,kitty'' - "${mod},D,exec,wofi --show drun" + "${mod},D,exec,killall anyrun || anyrun" "${mod},Q,killactive" "${mod},M,exit" "${mod},P,pseudo" diff --git a/modules/rice/hyprland/default.nix b/modules/rice/hyprland/default.nix index b8fdbe8..5d64535 100644 --- a/modules/rice/hyprland/default.nix +++ b/modules/rice/hyprland/default.nix @@ -34,12 +34,21 @@ in { }; }; + # systemd.user.services = { + # swaybg = mkService { + # Unit.Description = "Wallpaper chooser"; + # Service = { + # ExecStart = "${lib.getExe pkgs.swaybg} -i ${theme.wallpaper}"; + # Restart = "always"; + # }; + # }; + # }; + systemd.user.services = { - swaybg = mkService { - Unit.Description = "Wallpaper chooser"; + swww = mkService { + Unit.Description = "Wallpaper Daemon"; Service = { - ExecStart = "${lib.getExe pkgs.swaybg} -i ${theme.wallpaper}"; - Restart = "always"; + ExecStart = "${pkgs.swww}/bin/swww-daemon"; }; }; };