hellosiyan / Viewnior

Elegant Image Viewer
https://siyanpanayotov.com/project/viewnior/
GNU General Public License v3.0
319 stars 55 forks source link

show full /path/to/file in titlebar instead of basename - how to? #105

Closed Lew-Rockwell-Fan closed 2 years ago

Lew-Rockwell-Fan commented 3 years ago

Can someone tell me what file I'd need to modify to show the /path/to/basename and only that in the title bar? It would be great if I could put something like title="$(realpath $file) in viewnior.conf but I realize this must be hard coded and I'll need to compile.

This is just a path to my real objective, which is to be able add a custom menu to act on the file being displayed. There are many ways I could do this in principle, and I've posted feature requests relating to several. The ideal thing would be to be able to hand edit the main context menu to add at least one extra item. Maybe just by putting entries in viewnior.conf. I can force a script to appear in the open-with submenu, but that submenu gradually adds everything I've ever opened an image with and it gets way too busy. Maybe somebody has already fixed this in one of the many forks of this, but if any of the forkers explain what they are trying to do differently, I don't see where they do it and it would be way too much work to try them all blind.

hellosiyan commented 2 years ago

@Lew-Rockwell-Fan The window's title is set by calling gtk_window_set_title. For Viewnior's main window (since there is also the Properties window, which I assume is not what you need) these calls are made in vnr-window.c and there are three of them - two to set the title to "Viewnior" on open and close, and one called on zoom change (which itself is called "all" the time, also when navigating through images) in zoom_changed_cb. What you would need to change is this line: https://github.com/hellosiyan/Viewnior/blob/1f1cc05505ef06a8a8551031833414266e54ce8f/src/vnr-window.c#L1142 to something like buf = g_strdup_printf ("%s", VNR_FILE(window->file_list->data)->path);

Hope this helps :smile: