From 658e5043e1dfdc9726caf0844bb6c8d2728e8b3e Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Sun, 17 Mar 2024 19:56:50 -0400 Subject: [PATCH] Add recents file for sofi.sh --- fake_home/.sofi.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/fake_home/.sofi.sh b/fake_home/.sofi.sh index d7a11e0..572ab68 100755 --- a/fake_home/.sofi.sh +++ b/fake_home/.sofi.sh @@ -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 &