7

When I try to open console/terminal in any folder by drop-down menu in the Thunar, the konsole is opened in /home/user folder.

How to configure "Open Terminal Here" shortcut to open new terminal window correctly?

UPD:

  1. Opening the /home/user/Downloads folder
  2. There is folder named "FOLDER"
  3. Right mouse click on folder "FOLDER"
  4. From drop-down menu choosing the "Open Terminal Here" option
  5. New terminal (konsole) is running in the /home/user/ , but should be in /home/user/Downloads
4
  • Xubuntu does not use Konsole, it uses xfce4-terminal. Try with it.
    – GTRONICK
    Mar 10, 2017 at 16:03
  • 1
    @GTRONICK Yes, using the xfce4-terminal it is working fine, but I want to use konsole as default.
    – XuMuK
    Mar 10, 2017 at 16:09
  • 1
    If this is what you want make your question clearer. Mar 10, 2017 at 16:28
  • @JuanAntonio I have a little update about what I am doing and what I am getting.
    – XuMuK
    Mar 13, 2017 at 8:41

3 Answers 3

11

I found solution!!! In Thunar Edit>Configure custom actions... then edit "Open Terminal Here"

and replace:

exo-open --working-directory %f --launch TerminalEmulator

with this:

konsole --workdir %f
0
1

By default, Thunar uses the exo-open command, which is configured in the XFCE settings. If you do not have the XFCE settings app installed, you can instead configure it in ~/.config/xfce4/helpers.rc:

TerminalEmulator=konsole
TerminalEmulatorDismissed=true

or, another example,

TerminalEmulator=kitty
TerminalEmulatorDismissed=true
0

This works when you've selected nothing, folders with blank space, a file, a selection of files, etc.

{ [ -d %f ] && exo-open --working-directory %f --launch TerminalEmulator ; } || { exo-open --working-directory %d --launch TerminalEmulator ; }

Available command parameters in thunar Custom Actions:

List of valid command parameter variables
Variable    Usage
%f  The path of the first selected file.
%F  The paths to all selected files.
%u  The URI of the first selected file (using the file:-URI scheme).
%U  The URIs of all selected files (using the file:-URI scheme).
%d  The directory of the first selected file.
%D  The directories to all selected files.
%n  The name of the first selected file (without the path).
%N  The names of all selected files (without the paths).

The above is equivalent to:


if [[ -d %f ]]; then

    exo-open --working-directory %f --launch TerminalEmulator
else

    exo-open --working-directory %d --launch TerminalEmulator
fi

Or in pseudo-code:

# if the path of the first selected file or directory is a directory
    # open a terminal in the directory of the first file selected
    # or open a terminal in the directory selected
1
  • Welcome to AskUbuntu and thank you for your contribution. Please take the tour. Feb 5 at 6:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.