aboutsummaryrefslogtreecommitdiffstats
path: root/modules/scripts
diff options
context:
space:
mode:
authorArpit Chakladar <arpitchakladar@proton.me>2026-04-14 18:40:28 +0530
committerArpit Chakladar <arpitchakladar@proton.me>2026-04-14 18:40:28 +0530
commit5e51e6c642767bf6fef80a6a28dc5cd57a649cfa (patch)
treef936aa72ea085212428a4a3dff198db92a1bf4bf /modules/scripts
parentf7f5e84cf2bcae79e703bf5bdab39619c62ea198 (diff)
downloadhome-manager-config-5e51e6c642767bf6fef80a6a28dc5cd57a649cfa.tar.gz
home-manager-config-5e51e6c642767bf6fef80a6a28dc5cd57a649cfa.zip
fixed the fzf-launcher script to properly show all launchable applications
Diffstat (limited to 'modules/scripts')
-rw-r--r--modules/scripts/fzf-launcher.sh17
1 files changed, 15 insertions, 2 deletions
diff --git a/modules/scripts/fzf-launcher.sh b/modules/scripts/fzf-launcher.sh
index 79853f1..5654d80 100644
--- a/modules/scripts/fzf-launcher.sh
+++ b/modules/scripts/fzf-launcher.sh
@@ -12,30 +12,42 @@ for dir in "${DIRS[@]}"; do
for f in "$dir"/*.desktop; do
[[ -f "$f" ]] || continue
+ # Skip hidden entries
grep -q "^NoDisplay=true" "$f" && continue
grep -q "^Hidden=true" "$f" && continue
+
+ # Only GUI apps
grep -q "^Type=Application" "$f" || continue
grep -q "^Terminal=true" "$f" && continue
+ # Skip ONLY actual junk categories (not System!)
categories=$(grep -m1 "^Categories=" "$f" | cut -d= -f2-)
if [[ -n "$categories" ]]; then
- echo "$categories" | grep -qE "(Settings|System|Screensaver|DesktopSettings|PackageManager)" && continue
+ echo "$categories" | grep -qE "(Settings|Screensaver|DesktopSettings)" && continue
fi
+ # Get name (handle localized fallback)
name=$(grep -m1 "^Name=" "$f" | cut -d= -f2-)
+ if [[ -z "$name" ]]; then
+ name=$(grep -m1 -E "^Name\[.*\]=" "$f" | cut -d= -f2-)
+ fi
+
+ # Get exec
exec=$(grep -m1 "^Exec=" "$f" | cut -d= -f2-)
[[ -z "$name" || -z "$exec" ]] && continue
- # Remove field codes properly
+ # Remove field codes like %U %F etc.
exec=$(echo "$exec" | sed -E 's/ ?%[a-zA-Z]//g')
entries+="$name"$'\t'"$exec"$'\n'
done
done
+# Deduplicate + sort
entries=$(printf '%s' "$entries" | sort -fu -t$'\t' -k1,1)
+# FZF selection
chosen=$(printf '%s' "$entries" | "$FZF" \
--prompt='Launch: ' \
--layout=reverse \
@@ -47,5 +59,6 @@ chosen=$(printf '%s' "$entries" | "$FZF" \
exec_cmd=$(printf '%s' "$chosen" | cut -d$'\t' -f2)
+# Launch safely
eval "$exec_cmd" &>/dev/null &
disown