Focus existing terminal with `Ctrl-Alt-T` shortcut

Hailwood

I tend to use the terminal a lot,

So I wondering if there is a way I can make Ctrl+Alt+T focus the existing terminal if there is one, otherwise create a new terminal?

zerwas

Create a small script which will raise the GNOME Terminal:

echo 'xdotool windowactivate $(xdotool search --onlyvisible --class gnome-terminal)'> ~/raiseterminal.sh && chmod +x ~/raiseterminal.sh

or if you want to check if Terminal is already running, use:

echo -e $'if ps aux | grep "[g]nome-terminal" > /dev/null\n then xdotool windowactivate $(xdotool search --onlyvisible --class gnome-terminal)\n else gnome-terminal &\nfi' > ~/raiseterminal.sh && chmod +x ~/raiseterminal.sh

This will create the script ~/raiseterminal.sh with this content:

if ps aux | grep "[g]nome-terminal" > /dev/null                                                                                                                                                                                
 then xdotool windowactivate $(xdotool search --onlyvisible --class gnome-terminal)                                                                                                                                            
 else gnome-terminal&                                                                                                                                                                                                          
fi          

Open the preferences to set up a custom keyboard shortcut and set the command to /home/$USER/raiseterminal.sh, but make sure to change $USER to your actual username.

If you only want to raise the terminal on a specific screen or desktop, see xdotool search --help for more information on how to do this.

There are also various other methods which work better with other window managers.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

gnome-terminal.desktop for key shortcut (ctrl+alt+t)

From Dev

Ubuntu 18.04 Terminal shortcut Ctrl+Alt+T is not working

From Dev

Mistyped <Ctrl>+<Alt>+<T> split existing terminal window

From Dev

Set a shortcut for opening Terminator (similar to Ctrl+Alt+T, but not replacing default terminal)

From Dev

Alt+Ctrl+T no longer opens a terminal

From Dev

Ctrl Alt T no longer opens terminal

From Dev

Ctrl-Alt-t opens root terminal instead of normal terminal

From Dev

How can I disable the default Konsole shortcut (CTRL + ALT + T)?

From Dev

Ctrl+Alt+T doesn't open a Terminal in Cinnamon 1.6

From Dev

Ctrl+Alt+T brings up Trash folder, not a Terminal?

From Dev

Set Ctrl+Alt+T to open a maximized terminal

From Dev

Set default location for Terminal window opened with Ctrl+Alt+T

From Dev

Can't freeze the terminal with the shortcut Ctrl+S on Ubuntu 17.04

From Dev

Keyboard shortcut to focus on (idle) terminal

From Dev

Keyboard shortcut to focus on (idle) terminal

From Dev

ctrl-alt-t opens new terminal window instead of new tab while gnome terminal is active window

From Dev

ctrl-alt-t opens new terminal window instead of new tab while gnome terminal is active window

From Dev

Make Ctrl-Alt-T to open a terminal tab if any terminal was open

From Dev

What does the Ctrl-Alt-+ shortcut do?

From Dev

What does the Ctrl-Alt-+ shortcut do?

From Dev

Cinnamon Getting rid of CTRL-ALT-A shortcut

From Java

IntelliJ Idea Ctrl+Alt+Left shortcut doesn't work in Ubuntu

From Dev

How to make "CTRL + ALT + T" open new Terminal window when one is already open?

From Dev

How to make "CTRL + ALT + T" open new Terminal window when one is already open?

From Dev

How do I get Ctrl + Alt + t to launch ther terminal in Linux Mint 13 MATE?

From Dev

Prevent Ctrl-Alt-T from opening a new terminal window when one already exist?

From Dev

Terminal Short-cut ctrl + alt + T, 2 terminals, different size

From Dev

Why is the shortcut Ctrl + A jumping to the start of a line in the terminal?

From Dev

CTRL+ALT+T not working

Related Related

  1. 1

    gnome-terminal.desktop for key shortcut (ctrl+alt+t)

  2. 2

    Ubuntu 18.04 Terminal shortcut Ctrl+Alt+T is not working

  3. 3

    Mistyped <Ctrl>+<Alt>+<T> split existing terminal window

  4. 4

    Set a shortcut for opening Terminator (similar to Ctrl+Alt+T, but not replacing default terminal)

  5. 5

    Alt+Ctrl+T no longer opens a terminal

  6. 6

    Ctrl Alt T no longer opens terminal

  7. 7

    Ctrl-Alt-t opens root terminal instead of normal terminal

  8. 8

    How can I disable the default Konsole shortcut (CTRL + ALT + T)?

  9. 9

    Ctrl+Alt+T doesn't open a Terminal in Cinnamon 1.6

  10. 10

    Ctrl+Alt+T brings up Trash folder, not a Terminal?

  11. 11

    Set Ctrl+Alt+T to open a maximized terminal

  12. 12

    Set default location for Terminal window opened with Ctrl+Alt+T

  13. 13

    Can't freeze the terminal with the shortcut Ctrl+S on Ubuntu 17.04

  14. 14

    Keyboard shortcut to focus on (idle) terminal

  15. 15

    Keyboard shortcut to focus on (idle) terminal

  16. 16

    ctrl-alt-t opens new terminal window instead of new tab while gnome terminal is active window

  17. 17

    ctrl-alt-t opens new terminal window instead of new tab while gnome terminal is active window

  18. 18

    Make Ctrl-Alt-T to open a terminal tab if any terminal was open

  19. 19

    What does the Ctrl-Alt-+ shortcut do?

  20. 20

    What does the Ctrl-Alt-+ shortcut do?

  21. 21

    Cinnamon Getting rid of CTRL-ALT-A shortcut

  22. 22

    IntelliJ Idea Ctrl+Alt+Left shortcut doesn't work in Ubuntu

  23. 23

    How to make "CTRL + ALT + T" open new Terminal window when one is already open?

  24. 24

    How to make "CTRL + ALT + T" open new Terminal window when one is already open?

  25. 25

    How do I get Ctrl + Alt + t to launch ther terminal in Linux Mint 13 MATE?

  26. 26

    Prevent Ctrl-Alt-T from opening a new terminal window when one already exist?

  27. 27

    Terminal Short-cut ctrl + alt + T, 2 terminals, different size

  28. 28

    Why is the shortcut Ctrl + A jumping to the start of a line in the terminal?

  29. 29

    CTRL+ALT+T not working

HotTag

Archive