Last active
December 11, 2023 15:17
-
-
Save PedroHLC/dd053e2618cda0155947b5a73eef9911 to your computer and use it in GitHub Desktop.
Uses bash+awk+find+XDG_DATA_DIRS to launch an application by searching the first x-desktop that starts with the argument (you can use wildcards, remember to escape them)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
LAUNCH_SEARCHING="$1" | |
exec $(awk '/^Exec=/{sub(/^Exec=/, ""); print $1}' $(echo -n "$XDG_DATA_DIRS" |\ | |
xargs -d ':' -ri \ | |
find -H '{}/applications/' -iname "${LAUNCH_SEARCHING}*.desktop" 2>/dev/null |\ | |
head -n 1)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment