Files
omarchy/dot_local/bin/executable_cp-appid
Prad Nukala b18729f4a0 Initial import: chezmoi source for Omarchy (Hyprland)
Imported from prdlk/dotfiles master (efdd827), which supersedes the omarchy
branch (3031416). Drops the Umbriel, Noctalia, niri, CachyOS, macOS, and Blume
docs-site layers; docs/ is plain Markdown.
2026-11-02 09:14:11 -05:00

44 lines
1.2 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/sh
# Fuzzy-pick a desktop app ID and copy to clipboard.
existing_dirs=""
for d in /usr/share/applications \
/usr/local/share/applications \
"$HOME/.local/share/applications" \
/var/lib/flatpak/exports/share/applications \
"$HOME/.local/share/flatpak/exports/share/applications" \
/var/lib/snapd/desktop/applications; do
[ -d "$d" ] && existing_dirs="$existing_dirs $d"
done
if [ -z "$existing_dirs" ]; then
echo "No application directories found." >&2
exit 1
fi
# word splitting of $existing_dirs is intended
# shellcheck disable=SC2086
chosen=$(
fd --type f --extension desktop . $existing_dirs \
| while IFS= read -r f; do
app_id=$(basename "$f" .desktop)
name=$(sed -n 's/^Name=//p' "$f" | head -n1)
[ -z "$name" ] && name=$app_id
printf '%s\t%s\n' "$name" "$app_id"
done \
| sort -u -t "$(printf '\t')" -k1 \
| fzf \
--delimiter='\t' \
--with-nth=1,2 \
--prompt="App ID › " \
--height=50% \
--layout=reverse \
--border=rounded \
--info=inline
)
[ -n "$chosen" ] || exit 0
app_id=$(printf '%s\n' "$chosen" | cut -f2)
printf '%s' "$app_id" | wl-copy
echo "Copied: $app_id"