dotfiles/home/bin/executable_linux-app-launcher
2023-07-11 21:17:48 -07:00

27 lines
1.3 KiB
Bash

#!/usr/bin/env bash
#⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀
#⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⡀⠀⠀⠀⠀⠀⠀⠀⠀
#⠀⠀⠀⠀⠀⠀⠀⠀⣼⡏⠸⣧⠀⠀⠀⠀⠀⠀⠀⠀
#⠠⢤⣤⣤⣤⣤⣤⣴⡿⠀⠀⢻⣦⣤⣤⣤⣤⣤⡤⠄ Tyler Starr (starr-dusT)
#⠀⠀⠙⠻⣦⣄⠀⠀⠀⠀⠀⠀⠀⠀⣠⣴⠟⠋⠀⠀ https://github.com/starr-dusT/dotfiles
#⠀⠀⠀⠀⠀⠙⣿⡆⠀⠀⠀⠀⠰⣿⠋⠀⠀⠀⠀⠀ https://tstarr.us
#⠀⠀⠀⠀⠀⢰⡟⠀⣀⣴⣦⣀⠀⢻⡆⠀⠀⠀⠀⠀
#⠀⠀⠀⠀⢀⣾⣧⡾⠛⠁⠈⠙⠷⣼⣿⡀⠀⠀⠀⠀
#⠀⠀⠀⠀⡸⠟⠁⠀⠀⠀⠀⠀⠀⠈⠛⢧⠀⠀⠀⠀
#
# Launch applications with fzf.
desktop_file() {
find /usr/share/applications -name "*.desktop"
find /usr/local/share/applications -name "*.desktop"
find "$HOME/.local/share/applications" -name "*.desktop"
find /var/lib/flatpak/exports/share/applications -name "*.desktop"
find "$HOME/.local/share/flatpak/exports/share/applications" -name "*.desktop"
find /run/current-system/sw/share/applications -name "*.desktop"
}
selected="$(desktop_file | sed 's/.desktop//g' | sort | fzf -e -i -m --reverse --delimiter / --with-nth -1)"
[ -z "$selected" ] && exit
cd || return
echo "$selected" | while read -r line ; do setsid gio launch "$line".desktop ; done