12

I'm on Ubuntu 14.04 with the old-style GNOME setting from the GDM. (I don't like the new Unity interface.) Is there a way I can create a command that I can type in my terminal window to minimize it? It would be so awesome to simply type min and the terminal prompt minimizes while I focus on something else.

Volomike
  • 2,264
  • 5
  • 21
  • 41

3 Answers3

13
  1. First, install the xdotool command:

    sudo apt-get install xdotool
    
  2. Then, create an alias to be able to run min as a command:

    echo 'alias min="xdotool getactivewindow windowminimize"' >> ~/.bashrc`
    
  3. Reload the .bashrc file:

    . ~/.bashrc
    
Seth
  • 57,282
  • 43
  • 144
  • 200
Volomike
  • 2,264
  • 5
  • 21
  • 41
8

The following python oneliner will minimize the current gnome-terminal window:

python3 -c "from gi.repository import Gdk; \
[ Gdk.Screen.get_default().get_active_window().iconify() for i in range(2)]"

Note that we need to call iconify() two times to minimize the window.

Sylvain Pineau
  • 61,564
  • 18
  • 149
  • 183
2

You can just use keybindings of Ctrl+Space to open the window menu, then press N (in an English locale) to minimize the window.

dobey
  • 40,344
  • 5
  • 56
  • 98