Add recents file for sofi.sh
This commit is contained in:
parent
ead75bbffd
commit
658e5043e1
|
@ -73,6 +73,21 @@ apps() {
|
|||
read_snap_apps
|
||||
}
|
||||
|
||||
RECENTS="$HOME/.sofi-recent"
|
||||
|
||||
recent() {
|
||||
test -f "$RECENTS" && cat "$RECENTS"
|
||||
}
|
||||
|
||||
add-recent() {
|
||||
if grep "$1" "$RECENTS"; then
|
||||
return
|
||||
fi
|
||||
echo "$1" >> "$RECENTS"
|
||||
tail -n 10 "$RECENTS" > "$RECENTS.temp"
|
||||
mv "$RECENTS.temp" "$RECENTS"
|
||||
}
|
||||
|
||||
open_app() {
|
||||
app="$(echo "$1" | cut -c 5-)"
|
||||
# shellcheck disable=SC2086
|
||||
|
@ -111,6 +126,7 @@ if [[ "$1" == "--print-only" ]]; then
|
|||
fi
|
||||
if [[ "$1" == "" ]]; then
|
||||
choice="$(cat \
|
||||
<(recent) \
|
||||
<(system_info) \
|
||||
<(windows) \
|
||||
<($HOME/.rofi-list-git-repos.py --no-icon) \
|
||||
|
@ -147,6 +163,8 @@ npm_handler() {
|
|||
setsid xdg-open "https://npmjs.com/package/$package" &> /dev/null &
|
||||
}
|
||||
|
||||
add-recent "$choice"
|
||||
|
||||
case $choice in
|
||||
git*)
|
||||
setsid "$HOME/.rofi-list-git-repos.py" "$choice" &> /dev/null &
|
||||
|
|
Loading…
Reference in New Issue