Monday, May 13, 2024
8
rated 0 times [  8] [ 0]  / answers: 1 / hits: 11449  / 3 Years ago, sat, june 19, 2021, 5:54:20

I installed Terminator and made it my default terminal with this solution, but now Ctrl-Alt-T opens Terminator as a root terminal. How do I get it to open Terminator as a normal terminal?



enter image description here


More From » command-line

 Answers
2

What happens ?



TL;DR #1: Basically, you spawn x-terminal-emulator and Unity searches for anything that has x-terminal-emulator in their shortcut file.




  1. You press Ctrl+Alt+T, which spawns x-terminal-emulator. In Debian Alternatives system, x-terminal-emulator is a symlink to a whatever terminal emulator app you would want to use.

  2. Unity's mechanisms search through the list of "shortcut" files in /usr/share/applications. It finds the gksu.desktop file, which has Exec=gksu /usr/bin/x-terminal-emulator line and then takes out the line Name=Root Terminal. That Root Terminal is then displayed on the Unity's panel



Why the same thing doesn't happen with gnome-terminal?



TL;DR #2: gnome-terminal is actually spawned by a wrapper script, to which the default shortcut is linked.



When you run sudo update-alternatives --config x-terminal-emulator you are presented with choices, but none of them is /usr/bin/gnome-terminal. Rather you have /usr/bin/gnome-terminal.wrapper which is a perl script that sets up gnome-terminal first ! If you read through that script, at the end it has the following line :



exec('gnome-terminal',@args);


The exec call then spawns /usr/bin/gnome-terminal , as separate app. Unity again searches /usr/share/applications/ directory and finds gnome-terminal.desktop file which has Name=Terminal line, and it shows it on the launcher.



What can be done?



TL;DR #3: reassign keyboard shortcut,use custom wrapper, or create custom .desktop file. I recommend the .desktop way.



Easiest way is to reassign the shortcut. Use gsettings for that



 gsettings set org.gnome.desktop.default-applications.terminal exec 'sakura'


But that still doesn't solve the quirk with Unity's dash. My preferred solution is to create the custom .desktop file /usr/share/applications/x-terminal-emulator.desktop with the following contents



[Desktop Entry]
Name=MY CUSTOM TERMINAL
Encoding=UTF-8
Exec=/usr/bin/x-terminal-emulator
Icon=gksu-root-terminal
StartupNotify=true
Terminal=false
Type=Application
Categories=GTK;Utility;TerminalEmulator;


That way , you don't have to change anything, but Unity will display MY CUSTOM NAME on the launcher.



Third way, if you are feeling adventurous is to write a wrapper script, something like this:



   #!/bin/sh
exec /path/to/terminal-emulator ${1+"$@"}


Then you can add it as one of the options in the alternatives system using



sudo update-alternatives   --install /path/to/wrapper name /path/to/wrapper priority 


Side note: priority is an integer, such as 10.



More info




[#22064] Sunday, June 20, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
aveerakfas

Total Points: 106
Total Questions: 148
Total Answers: 129

Location: Monaco
Member since Sun, Jan 1, 2023
1 Year ago
;