From 87c6166bf7831a5691e383a31f7a7bd3600d8923 Mon Sep 17 00:00:00 2001 From: Hadi <112569860+anotherhadi@users.noreply.github.com> Date: Wed, 5 Mar 2025 13:28:01 +0100 Subject: [PATCH] add close wofi when loose focus --- home/scripts/system/default.nix | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/home/scripts/system/default.nix b/home/scripts/system/default.nix index a1f5f76..1abb3ce 100644 --- a/home/scripts/system/default.nix +++ b/home/scripts/system/default.nix @@ -14,13 +14,18 @@ let if pgrep wofi; then pkill wofi else - wofi -p " Apps" --show drun + wofi -p " Apps" --show drun & + # Quit when not focused anymore + sleep 0.2 + while true; do + window=$(hyprctl activewindow | grep "wofi") + if [[ ! $window ]]; then + pkill wofi + break + fi + sleep 0.2 + done fi - # if pgrep tofi; then - # pkill tofi - # else - # tofi-drun --drun-launch=true - # fi ''; powermenu = pkgs.writeShellScriptBin "powermenu"