2

I have st installed in my $PATH (in /usr/local/bin). But still, I don't see st present in Prefered Applications list, nor is it present as an option when I run sudo update-alternatives --config x-terminal-emulator in my terminal. How do I set it as default?

3 Answers 3

3

If st is not listed by sudo update-alternatives --config x-terminal-emulator you can use

gsettings set org.cinnamon.desktop.default-applications.terminal exec <path_to_st>

where <path_to_st> can be found using which stterm1. On my system you can find it at /usr/bin/stterm. In the following, I am going to assume you have the same location.

The Vim issue

After using the above command, the keybinding for the terminal (Ctrl+Alt+t by default) will open st. But calling Vim from a file manager or anything else using desktop entries will still use the old terminal. For the sake of example, let us consider it is gnome-terminal found at /usr/bin/gnome-terminal.

You can try to solve that by editing Vim's desktop entry:

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

vim.desktop
-----------
#TryExec=vim
#Exec=vim %F
#Terminal=True
Exec=stterm -e "vim %F"
Terminal=False

On my system it works but st closes instantly. I tried to replace stterm by another terminal emulators and it works so I believe st has issues dealing with desktop entries.

The brutal solution

Since some programs still use the old gnome-terminal the best way to get around the problem is to symlink it to stterm:

mkdir ~/.local/bin
ln -s /usr/bin/ssterm ~/.local/bin/gnome-terminal

This solves all problems but is not an elegant solution. Don't forget to rm ~/.local/share/applications/vim.desktop if you try this solution after the previous one.


1on Debian and Ubuntu based systems, st is packaged as stterm.

12
  • Although Ctrl-alt-T opens st now, part of the problem still remains. It could be a different problem, but I use vim and vim is the default for certain files. I did whatever you suggested but still when I click on files vim opens them in the old terminal. How do I make all applications use st terminal?
    – mahbubweb
    Commented Jun 22, 2020 at 15:36
  • Another example, when I run xdg-open `fzf` the selected file opens in old terminal. Thats not desirable as well.
    – mahbubweb
    Commented Jun 22, 2020 at 17:09
  • For vim you need probably need to edit the vim desktop entry /usr/share/applications/vim.desktop by creating a copy in .local/share/applications/. I think xdg-open use x-terminal-emulator that we can not modify since st is not listed by update-alternatives.
    – user413007
    Commented Jun 22, 2020 at 22:37
  • A non-elegant but general solution would be to link the old terminal to the new one: ln -s /usr/bin/st ~/.local/bin/old-terminal (logout needed to take effect).
    – user413007
    Commented Jun 22, 2020 at 22:43
  • I don't at all know how to edit the vim.desktop entry, I looked into the file there didn't seem to an option to set a terminal. Maybe need to add new code, didn't find anything online about this. How do I edit it?
    – mahbubweb
    Commented Jun 23, 2020 at 10:43
1

If st is not present as an option if you run sudo update-alternatives --config x-terminal-emulator you can add it to the update-alternatives with the following command: sudo update-alternatives --install <link> <name> <path> <priority>.

In my case it looks like this: sudo update-alternatives --install /usr/bin/x-terminal-emulator x-terminal-emulator /usr/local/bin/st 100.

After you executed the command you should be able to see and select st if you now run sudo update-alternatives --config x-terminal-emulator.

1
  • This was helpful, thank you.
    – Mossab
    Commented Mar 19, 2023 at 23:54
0

My solution was to change the XTERM variable from /etc/alternatives/x-terminal-emulator to st

My x-terminal-emulator is pointing to lxterm

You must log in to answer this question.

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