Linking to a specific folder from the toolbar?

Ask for help and post your question on how to use XnView MP.

Moderators: XnTriq, helmut, xnview

laurent45654
Posts: 14
Joined: Sat Dec 21, 2024 6:54 pm

Linking to a specific folder from the toolbar?

Post by laurent45654 »

I often check the same folders on my computer from XnView, and I would like to create shortcuts to some of these in the toolbar. Do you know if it can be done? I know I can add favorites, but it requires me to click on the small favorite arrow, then to the folder. I'd just like to make that quicker if possible.
laurent45654
Posts: 14
Joined: Sat Dec 21, 2024 6:54 pm

Re: Linking to a specific folder from the toolbar?

Post by laurent45654 »

ChatGPT suggests modifying the toolbar configuration file directly - can it really be done this way or is it making things up?
User avatar
xnview
Author of XnView
Posts: 45337
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Linking to a specific folder from the toolbar?

Post by xnview »

you create a .bat and add it in your toolbar
Pierre.
laurent45654
Posts: 14
Joined: Sat Dec 21, 2024 6:54 pm

Re: Linking to a specific folder from the toolbar?

Post by laurent45654 »

Thank you, I should have mentioned I'm on macOS so a .bat is probably not going to work? I just tried with a .sh but that didn't work either. Any idea if it can be done on macOS too?
User avatar
xnview
Author of XnView
Posts: 45337
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Linking to a specific folder from the toolbar?

Post by xnview »

for example if you use

Code: Select all

#!/bin/bash

if [ $# -eq 0 ]; then
    echo "Usage: $0 filename"
    exit 1
fi

file_path=$(realpath "$1")

dir_path=$(dirname "$file_path")

open "$dir_path"
does it works?
Pierre.
laurent45654
Posts: 14
Joined: Sat Dec 21, 2024 6:54 pm

Re: Linking to a specific folder from the toolbar?

Post by laurent45654 »

Yes it kind of work, but it opens the folder in a new Finder window, instead of opening it in XnView.

I've also tried

Code: Select all

open -a /Applications/XnViewMP.app --args  /path/to/dir
but that doesn't work if XnView is already open (it does it isn't).

Is there maybe a specific XnView command line argument I could use to open the folder within the currently opened instance?
User avatar
xnview
Author of XnView
Posts: 45337
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Linking to a specific folder from the toolbar?

Post by xnview »

you would like to add a button in toolbar of XnView to open the selected file in XnView?
Pierre.
User avatar
user0
XnThusiast
Posts: 2144
Joined: Sat May 09, 2015 9:37 am

Re: Linking to a specific folder from the toolbar?

Post by user0 »

another option - add functionality to assign Shortcuts to Favorites
the same way it works for Categories and 'Open with external program'
laurent45654
Posts: 14
Joined: Sat Dec 21, 2024 6:54 pm

Re: Linking to a specific folder from the toolbar?

Post by laurent45654 »

xnview wrote: Fri Jan 17, 2025 10:45 am you would like to add a button in toolbar of XnView to open the selected file in XnView?
Yes, I would click on that button in the toolbar, and it would go to, for example /path/to/dir

I know favourites already offer this functionality but it's in a sub-menu and I frequently go to a certain number of folders so it would be easier if that could be done in a click or even keyboard shortcut.