I've been trying to execute vim with alacritty as default. I have alacritty set as my default terminal emulator already, and in my vim.desktop I changed exec=vim %F
with exec=alacritty -e vim %F
. The problem is that when I open a file it first executes the command in gnome terminal and then launches vim in alacritty, the thing is that the gnome terminal stays open. I have also tried creating an script:
#!/bin/bash
alacritty -e vim & disown | exit
this does not work at all. I don't know what else to do and I cant find anything online. Thanks in advance!
Is it possible to change the default terminal that runs the Exec=
command? so that just by writing Exec=vim %F
would run it in alacritty
muru helped me clarify what was going on, thank you! The problem was that my .desktop file:
Had the argument
Terminal=true
. What this does is that it executes theExec=
command in a terminal, opening a terminal to do so. If you setTerminal=false
this will prevent any terminal from opening and it will just execute the command without opening the terminal.I've posted an answer to a similar question on U&L
TL;DR -
prepend_terminal_to_vector()
prefersgnome-terminal
the most. Create a wrapper script/usr/local/bin/gnome-terminal
which invokes the actual terminal emulator based on what$#
$@
it receives.Edit: this does not work sometimes, I don't know what is controlling what terminal emulator is used when you open vim.
I just found another work-around for this problem: create a symlink named
xterm
in your$PATH
to your own terminal emulator. I can not guarantee this works for everyone though.The advantage of this work-around is you don't need to change any desktop entry files. All .desktop with
Terminal=true
will use the new terminal emulator.When trying to exec a desktop entry with
exo-open
(similar toxdg-open
, from xfce), there is a warning messageSo I guess
xterm
is hard-coded in the program to open .desktop files. Then I tried to make this symlinkand it works perfectly.
However the actual command spawned is probably based on
xterm
's arguments, so only the terminal emulators which use the same argument to specify the start-up command works. One counter example istermite
, since it requires the whole command to be quoted in the-e
option.