This repository has been archived on 2024-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/common/bin/launch

20 lines
484 B
Plaintext
Raw Normal View History

2020-05-18 15:34:35 -05:00
#!/usr/bin/env bash
LAUNCHER_HISTORY_FILE="$HOME/.local/share/lytelaunch/launch.log"
mkdir --parents "$(dirname "$LAUNCHER_HISTORY_FILE")"
2020-05-18 15:34:35 -05:00
touch "$LAUNCHER_HISTORY_FILE"
app="$(
< "$LAUNCHER_HISTORY_FILE" \
awk 'NF{NF--};1' | \
cat - <(dmenu_path) | \
sort | uniq -c | sort -nr | \
2020-10-09 22:42:12 -05:00
sd -fm '^\s+' '' | \
2020-05-18 15:34:35 -05:00
cut -d' ' -f2- | \
2020-10-09 22:53:45 -05:00
grep "\S" | \
2020-05-18 15:34:35 -05:00
fzf
)"
2021-11-29 08:25:13 -06:00
# if no app is selected, just exit
test -z "$app" && exit 1
2020-05-18 15:34:35 -05:00
echo "$app $(date +%s)" >> "$LAUNCHER_HISTORY_FILE"
echo "$app"