Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • Z zathura
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 152
    • Issues 152
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 2
    • Merge requests 2
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • pwmt
  • zathura
  • Issues
  • #56
Closed
Open
Created Dec 29, 2018 by Dream Scatter@chakravala

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.

Edited Dec 29, 2018 by Dream Scatter
Assignee
Assign to
Time tracking