nix/scripts/common/bin/launch

20 lines
483 B
Plaintext
Raw Normal View History

2023-09-05 13:52:52 -05:00
#!/usr/bin/env bash
LAUNCHER_HISTORY_FILE="$HOME/.local/share/lytelaunch/launch.log"
mkdir --parents "$(dirname "$LAUNCHER_HISTORY_FILE")"
touch "$LAUNCHER_HISTORY_FILE"
app="$(
< "$LAUNCHER_HISTORY_FILE" \
awk 'NF{NF--};1' | \
cat - <(dmenu_path) | \
sort | uniq -c | sort -nr | \
sd -fm '^\s+' '' | \
cut -d' ' -f2- | \
grep "\S" | \
sk
)"
# if no app is selected, just exit
test -z "$app" && exit 1
echo "$app $(date +%s)" >> "$LAUNCHER_HISTORY_FILE"
echo "$app"