Opening terminal applications from thunar (SOLVED [hack])

This is kind of a write-up for myself, because apparently I need to learn the same things again every few years.

Man, for years and years there has always some schism between thunar / xfce and newer terminal emulators and every few years when I do a fresh install I need to go through the same hoops of

  1. installing something like alacritty
  2. See that thunar only uses xfce-terminal
  3. Uninstall xfce-terminal
  4. Now thunar uses xterm
  5. some swearing and confused poking around
  6. mime types?? something somethingā€¦

Granted, some of this must be because of using tiling window managers, so maybe some component got left out when using dwm or i3. (Could be something like this settings daemon not running or something)

Lately things got really close to fully working. Even the thunar context menu ā€œopen terminal hereā€ opens the right terminal. But until of now I still could really use thunar because if I would try to open text files in regular old vim or nvim, the terminal it would spawn would again be something random, I donā€™t even know what, but it doesnā€™t have a right click menu and I cannot find shortcuts for zooming and the font size looks like 6pt.

So future me, these are some of the things that have lead to things finally working:

  • be sure to set your TERMINAL env variable in your dotfiles
  • install xfce4-mime-settings and set terminal emulator there
  • in thunar edit menu, above ā€˜preferencesā€™ go to ā€˜configure custom actionsā€™. See that in ā€˜Open terminal hereā€™ settings the command is set to exo-open --working-directory %f --launch TerminalEmulator. If it still doesnā€™t work, you can hardcode your terminal there
  • To open text files from thunar, copy your editors .desktop file from the system side to user side cp /usr/share/applications/nvim.desktop ~/.local/share/applications/nvim.desktop. Now edit the file and change the exec=... to exec=alacritty -e nvim %F.
  • Or better yet, install neovim-remote and change the exec to exec=alacritty -e nvr -s %F so that all the opened files fill open in the same nvim instance to a new buffer.

Thanks

1 Like