gotbletu / shownotes

notes for videos from my youtube channel
https://www.youtube.com/user/gotbletu
GNU General Public License v3.0
911 stars 173 forks source link

The fzf-speed applauncher doesnt make sense, nor does it show applications. #44

Closed thepenguinthatwants closed 3 years ago

thepenguinthatwants commented 3 years ago

Hi, I've seeing ur video related to fzf-speed but altho I gotten other scripts to work. This applauncher doesnt make sense.

Should I create TMPFILE manually? I did create one but it didnt get any applications to show up.

TMPFILE="/tmp/fzfspeed_applauncher.txt"

https://github.com/gotbletu/shownotes/blob/master/fzf_speed/_applauncher%2C--.start.programs.in.new.window

gotbletu commented 3 years ago

it generates the app list from your $PATH variable. it will check if the TMPFILE is old or not and generate new ones every 24hrs.

i had to do this to sort the results else it would be random order and not look pretty. but its slow so i had to put the results into a TMPFILE to speed things up

so delete /tmp/fzfspeed_applauncher.txt if you want the script to generate a new one for you. it might take a few seconds initially

thepenguinthatwants commented 3 years ago

Omg you are right, Sorry for my impatience. In a way this is magic I have no clue about.

# if file does not exist then generate new database
find $(echo "$PATH" | sed 's@:@\n@g' | sed 's:/*$::' | awk '!x[$0]++' | sed ':a;N;$!ba;s/\n/\/* /g' ) -type f 2>/dev/null | 
  awk '!x[$0]++' | while read -r line
  do
    printf '%s\n' "$(basename "$line") $line"
  done | sort > "$TMPFILE"
FZF_ARG < "$TMPFILE" | awk '{print $1}'

fi