4

Are there any command line options that can launch Thunar with different display options for that instance?

I sometimes want Thunar to use the directory tree sidebar view instead of the usual shortcuts view. Is there an option I could use so I can create a launcher for each view?

man thunar and thunar --help weren't helpful in this regard.

2 Answers 2

7

Thunar & command line

Like you, I could not find any direct command to open a new window in either treeview or shortcuts (left) pane. I doubt if they are available.

There is however a workaround, but I don't know if you want it to be "pure", or if your goal is mainly to make it functional via command line, so that you can make a starter. If the last is the case, there is a pretty straightforward solution in xdotool.

Using xdotool to create a command

The side pane view in Thunar is set by key combinations. You can simulate these key combinations with xdotool in a command. xdotool is not installed by default, so you have to install it first:

sudo apt-get install xdotool

To generate a working command which you can use in a starter, you need to know that the key combinations to set the tree/shortcut view are:

ctrl+e
ctrl+b

The command to open a new Thunar window in tree view:

thunar; xdotool key ctrl+b; xdotool key ctrl+e

enter image description here

or shortcut view:

thunar; xdotool key ctrl+e; xdotool key ctrl+b

enter image description here

To make a double xdotool command seems odd, but that is necessary to prevent Thunar from cycling through the options, and hide the side pane.

if you want the window to open in a specific directory; add the directory to the command:

thunar /path; xdotool key ctrl+e; xdotool key ctrl+b

Other Thunar options

No need to say that you can use other options in Thunar in a similar way, just look at the key combination(s) after the menu options.

2
  • Thanks for the detailed answer and for introducing me to xdotool. Looks like an interesting tool.
    – Sean
    Apr 15, 2014 at 20:33
  • I think it is! for situations you have to make a workaround ;) Apr 15, 2014 at 20:34
5

xfce save thunar setting in

~/.config/xfce4/xfconf/xfce-perchannel-xml/thunar.xml

For example, to change an attribute of the window, as the width of the sidebar, type:

xfconf-query --channel thunar --property /last-separator-position --set 400

you can create a shell script that changes the values ​​first and then run thunar.
ie, create a file thunar.sh as:

#!/bin/bash

xfconf-query --channel thunar --property /last-side-pane --set ThunarTreePane
xfconf-query --channel thunar --property /last-separator-position --set 200
thunar &

and run it by typing:

sh thunar.sh

With a little modification you can select the type of left pane by passing the argument "tree" to the script:

#!/bin/bash
PANE="ThunarShortcutsPane"
if [ $# -eq 1 ] && [ "$1" = "tree" ]; then
   PANE="ThunarTreePane"
fi
xfconf-query --channel thunar --property /last-side-pane --set "$PANE"
thunar &

so, for open thunar with treeview pane, type:

sh thunar.sh tree

or, for shortcut pane:

sh thunar.sh

refer to xfce thunar doc page for more setting and help.

2
  • Thanks for the reply. Using this method would require two scripts, one for each side pane setting. I appreciate the info, I can probably modify this to my needs.
    – Sean
    Apr 15, 2014 at 20:47
  • 1
    I made ​​a small change to my answer by adding a simple script to toggle between the two views.
    – girardengo
    Apr 15, 2014 at 21:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .