rename file and update history
Hi, I would like to be able to conveniently rename files with zathura. My work around is using a script, which I call rename_file
:
#!/bin/bash
name=$1
RENAME=`zenity --file-selection --save --filename="$name"`
mv "$name" "$RENAME"
sed -i.bak s%$name%$RENAME%g ~/.local/share/zathura/history
sh -c "zathura '${RENAME}'"
The script also updates the history
file to keep the view settings after renaming the file.
Then I use this in the zathurarc
configuration
map <C-r> feedkeys ":exec rename_file '$FILE' &<Return>"
You can see I am using zenity
as a rename file dialog box, I'm not necessarily looking for a GUI solution, it just happens to be convenient here. Specifically, I want to be able to rename the file while viewing the document, the filenames I want to choose require seeing the documents while typing.
However, there is a minor issue with this method. The script opens a new zathura window with the renamed file, but the previous zathura window cannot be automatically closed, as far as I was able to figure out.
Of course, I can just manually close the previous zathura window; however, it would be good if zathura had a built-in feature for renaming files and also updating the history. It would also be good if I could use an input command in zathura to enter the new filename, and automatically have the history file updated also, as well as reload the newly named document.
Strangely, I haven't found any linux document viewers which have a rename file feature, like SumatraPDF viewer.
Please let me know if you could suggest any improvements to my method or if you could please add this feature.