Tomas-M / xlunch

Graphical app launcher for X with minimal dependencies
http://xlunch.org
GNU General Public License v3.0
219 stars 37 forks source link

Suggestion: Remember last choice and present first next time #133

Closed axgkl closed 3 years ago

axgkl commented 3 years ago

Maybe its possible already right now but I could not find the way:

When I narrowed the options down so that only a few are visible - then select one of the remaining via mouse or arrow keys: Can we remember what I selected for a narrowing combo? Maybe even with something like a weight and then sort remaining options by weight - so next time the option I select most of the time for given narrowing keys is the first in the list?

Example: Narrowing keys 'st' leave 12 options visible, I always select the 8th which is st - the terminal emulator (in this example I could not even make it the only option by narrowing further, so I have to select with arrow keys or mouse). That selection becomes a bit annoying after a while - and there are many such situations.

PS: Just checked how they do it in another launcher: No complex weighing but they remember the last selected one and next time they do not sort differently but simply highlight the previous selected one for a given key combo. So that I just have to hit enter and get it.

PMunch commented 3 years ago

I use xlunch in this way, but it requires you to wrap it in a little script. Essentially xlunch is just a way to show the menu, how you feed the menu is up to you. Basically I have a file in $HOME/.config/xlunch/recent.dsv (stored in $output_file) that I feed into xlunch with -i. Then I get the command to be run ($cmd) and have this simple logic to move it to the top of the list:

if ! [ -z "$cmd" ]; then
  echo "$(grep ";$cmd$" "$output_file")" > $output_file$$
    echo "$(grep -v ";$cmd$" "$output_file")" >> $output_file$$
    mv $output_file$$ $output_file
fi
eval $cmd
axgkl commented 3 years ago

Nifty! Many thanks and sorry for the delayed ack.