diff options
| author | Arpit Chakladar <arpitchakladar@proton.me> | 2026-04-14 18:32:28 +0530 |
|---|---|---|
| committer | Arpit Chakladar <arpitchakladar@proton.me> | 2026-04-14 18:32:28 +0530 |
| commit | f7f5e84cf2bcae79e703bf5bdab39619c62ea198 (patch) | |
| tree | 017dc5cca02f006ffa99b4740017c2ecd542e01d /modules/scripts/fzf-launcher.sh | |
| parent | 52a666f1979d68a84b3d5f59a30c90b549cb17a3 (diff) | |
| download | home-manager-config-f7f5e84cf2bcae79e703bf5bdab39619c62ea198.tar.gz home-manager-config-f7f5e84cf2bcae79e703bf5bdab39619c62ea198.zip | |
replaced rofi with a fzf script for launching desktop applications
Diffstat (limited to 'modules/scripts/fzf-launcher.sh')
| -rw-r--r-- | modules/scripts/fzf-launcher.sh | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/modules/scripts/fzf-launcher.sh b/modules/scripts/fzf-launcher.sh index 592dd1e..79853f1 100644 --- a/modules/scripts/fzf-launcher.sh +++ b/modules/scripts/fzf-launcher.sh @@ -8,19 +8,15 @@ entries="" for dir in "${DIRS[@]}"; do [[ -d "$dir" ]] || continue + for f in "$dir"/*.desktop; do [[ -f "$f" ]] || continue grep -q "^NoDisplay=true" "$f" && continue - grep -q "^Hidden=true" "$f" && continue - - # only keep Type=Application entries + grep -q "^Hidden=true" "$f" && continue grep -q "^Type=Application" "$f" || continue + grep -q "^Terminal=true" "$f" && continue - # skip terminal-only apps (no GUI window) - grep -q "^Terminal=true" "$f" && continue - - # skip entries that are purely settings/mime handlers/background services categories=$(grep -m1 "^Categories=" "$f" | cut -d= -f2-) if [[ -n "$categories" ]]; then echo "$categories" | grep -qE "(Settings|System|Screensaver|DesktopSettings|PackageManager)" && continue @@ -31,21 +27,25 @@ for dir in "${DIRS[@]}"; do [[ -z "$name" || -z "$exec" ]] && continue - exec=$(echo "$exec" | sed 's/ %[fFuUickdDnNvm]//g') + # Remove field codes properly + exec=$(echo "$exec" | sed -E 's/ ?%[a-zA-Z]//g') entries+="$name"$'\t'"$exec"$'\n' done done -chosen=$(printf '%s' "$entries" | sort -f -t$'\t' -k1,1 | "$FZF" \ +entries=$(printf '%s' "$entries" | sort -fu -t$'\t' -k1,1) + +chosen=$(printf '%s' "$entries" | "$FZF" \ --prompt='Launch: ' \ --layout=reverse \ --info=inline \ - --with-nth=1 \ - --delimiter=$'\t') + --delimiter=$'\t' \ + --with-nth=1) [[ -z "$chosen" ]] && exit 0 exec_cmd=$(printf '%s' "$chosen" | cut -d$'\t' -f2) -setsid bash -c "$exec_cmd" &>/dev/null & + +eval "$exec_cmd" &>/dev/null & disown |
