Closed Kabouik closed 2 years ago
I've hacked together somehting that implements this, if you last closed Rofi by opening a file in File Browser Extended. I don't know how to do the same if you just hide Rofi by pressing Esc
.
It's not elegant, especially not so as I don't know C and can't figure out how to pass $HOME to get the user home directory nicely, so you have to replace username
with your username.
It just saves the directory you're in when you open a file to a file, the content of which you can then pass as an argument next time you open the file browser.
Assuming you've done
cd $HOME
git clone https://github.com/marvinkreis/rofi-file-browser-extended
edit $HOME/rofi-file-browser-extended/src/filemanager.c
and find the line
helper_execute_command ( current_dir, complete_cmd, false, NULL );
Immediately before it, insert
FILE *datf = fopen("/home/username/.config/rofi/file-browser_last-dir", "w");
if( !datf )
{
perror( "fopen to write getenv(/home/username/.config/rofi/file-browser_last-dir failed");
exit( EXIT_FAILURE );
}
fprintf(datf, current_dir);
fclose(datf);
Now compile, install and create the file that will store the last directory:
touch $HOME/.config/rofi/file-browser_last-dir
If you then run Rofi with
rofi -show file-browser-extended -file-browser-dir $(cat $HOME/.config/rofi/file-browser_last-dir)
the file browser will open to the last directory from which you opened a file.
Hi. I pushed some changes to implement this. You can use -file-browser-resume
to enable resuming and -file-browser-resume-file
to choose a custom resume file if necessary.
(Also, sorry for not reacting to this issue for so long. I haven't been working on the project for a while.)
Uhh,and even where the location when one Esc
out is saved! Perfect! Thank you so much!
It would be great if we could call rofi, navigate to a directory with the files of interest, then close rofi to work on those files and then have rofi-file-browser-extended remember where it was the last time it was called. This would save browsing multiple times to the same location when repeatedly using file-browser for one task.
Would an extra option for that be possible? Possible variations could be "remember location from previous rofi call - system wide" and "remember location from previous rofi call - per focused application".