davatorium / rofi

Rofi: A window switcher, application launcher and dmenu replacement
https://davatorium.github.io/rofi/
Other
13.29k stars 613 forks source link

[Feature request] Support history in script mode #605

Open a3nm opened 7 years ago

a3nm commented 7 years ago

Hello,

I'd like to use rofi as a menu with history for various things: music tracks, PDF documents, etc. To this end, I run rofi in dmenu emulation mode, providing it a list of relevant inputs.

I would like rofi to retain history for this use case. Of course, as the history to keep depends on what inputs are provided, the right way to do this would be to be able to tell rofi on the command-line what is the history file that it should be using.

Would it be possible to support this use case? i.e., add a command-line parameter to specify which history file to use, and support history in dmenu emulation mode.

Thanks a lot!

sardemff7 commented 7 years ago

The dmenu mode is a bonus. You should definitely use the script mode for your use cases, and then, history to script modi would be a nice feature to have.

eyvindbjartiandersen commented 7 years ago

I use a script that enables history for different uses. Let me know if you're interested.

chapmanjacobd commented 6 years ago

Can you please provide that script @eyvindbjartiandersen ? I'm looking for something like this!

I just moved from windows to linux as my main OS and keypirinha is the only thing which I am missing

eyvindbjartiandersen commented 6 years ago

This search script uses sort -u to display unique hits. You can modify the history part to suit any script.

!/bin/bash

URL="http://yubnub.org/parser/parse?command="

QUERY=$(cat ~/.cache/search_history | rofi -dmenu -i -p "❯")

if [ -n "$QUERY" ]; then grep -q "$QUERY" "$HOME/.cache/search_history" echo $QUERY >> ~/.cache/search_history_temp && sort -u ~/.cache/search_history_temp > ~/.cache/search_history xdg-open "${URL}${QUERY}" 2> /dev/null fi

a3nm commented 2 years ago

Hi, after some years I'm no longer too sure of what exactly I was asking for or which use case I had in mind. Not closing myself as other people had intervened, but FYI I'm fine with this issue being closed.