Add history file to launch-menu

This commit is contained in:
Jeena 2025-09-11 13:49:20 +09:00
parent 4ba91b1753
commit 1b9fff48b1
2 changed files with 9 additions and 4 deletions

View file

@ -1,10 +1,11 @@
#!/usr/bin/env bash
SCRIPTS="$HOME/.config/hypr/menu.list"
HISTORY_FILE="$HOME/.cache/tofi/launch-menu.txt"
# Kill existing tofi instance if running
pkill -x tofi || {
chosen=$(cut -d'=' -f1 "$SCRIPTS" | tofi)
chosen=$(cut -d'=' -f1 "$SCRIPTS" | tofi --history-file="$HISTORY_FILE" --history=true --require-match=true --fuzzy-match=true)
if [ -n "$chosen" ]; then
script=$(awk -F= -v sel="$chosen" '$1==sel {print $2}' "$SCRIPTS")
[ -n "$script" ] && eval "$script" &