Thunar "open with" doesn't work for terminal applications

Right-clicking on a text file gives me an "Open With" option in the context menu. If the application selected to open the file runs in the terminal - ex. Neovim, Vim, Ranger - it won't open or print anything.

Can anyone reproduce this bug? I remember this working on an earlier version of Thunar, but don't know whether the issue is with Thunar itself or a confounding program.

My terminal is kitty. Opening terminal programs from rofi and other launchers work.

Versions
thunar 1.8.12 (Xfce 4.14)

Copyright (c) 2004-2019
	The Thunar development team. All rights reserved.

Written by Benedikt Meurer <benny@xfce.org>.

Please report bugs to <https://bugzilla.xfce.org/>.
kitty 0.16.0 created by Kovid Goyal

I'm not sure if this is a bug, but I can reproduce this behaviour after installing kitty and uninstalling xfce4-terminal.


To workaround the issue, create the directory ~/.local/share/applications/ (if it doesn't already exist) and copy the .desktop files of Vim, NeoVim and ranger from /usr/share/applications/ to this directory.

cp /usr/share/applications/vim.desktop ~/.local/share/applications/
cp /usr/share/applications/nvim.desktop ~/.local/share/applications/
cp /usr/share/applications/ranger.desktop ~/.local/share/applications/

Then, open the .desktop files in the ~/.local/share/applications/ directory and replace the line beginning with Exec as follows.

For the vim.desktop file:

Exec=kitty sh -c "vim %F"

For the nvim.desktop file:

Exec=kitty sh -c "nvim %F"

For the ranger.desktop file:

Exec=kitty sh -c "ranger %f"

Also, in all three .desktop files replace this line

Terminal=true

with

Terminal=false

After doing that text files should open in Vim/NeoVim in kitty and directories should open in ranger using kitty.


Another option would be to create three Thunar custom actions using the above mentioned commands in the Exec entries of the .desktop files.

2 Likes

I have the same problem with Xfce4-terminal or with Terminator, I created a custom action for this.

Name: Run in Terminator
Command: terminator -x %f

File pattern: *.sh;*.*
Appears if selection contains: Other files

Works like a charm. :smile:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by