Results 1 to 4 of 4

Thread: minimizing (terminal) window from command line

  1. #1
    Join Date
    Apr 2011
    Location
    Hong Kong
    Beans
    20
    Distro
    Ubuntu

    minimizing (terminal) window from command line

    Hello,

    Geek question be prepared...

    I use Ubuntu and sometimes OSX. I took a stupid geek habit with OSX, I wrote a little command line script to be able to minimize my Terminal window with a command. I can do that fairly easily with OSX because I can invoke an AppleScript code directly from the command line with the command osascript. In real terms what does it mean? I dont need the mouse to minimize my term window, I type the name of my script and "swoosh" the term minimizes.

    Sorry for the long intro, here comes my question: can I do the same with Ubuntu?

    What I mean is, let's assume I am logged in, Gnome is launched, etc. I have an open Terminal window (inside Gnome), can I write a script that will actually minimize the terminal window (not close nor kill the window -> only minimize it)?

    I am actually clueless bc. obviously I cannot use Apple script...

    I dont even know what language I can use for the script (?), Bash will not be able to act on a window insode Gnome (maybe I am wrong, please correct me), I know a bit of Perl... but it does not seems like a Perl job at all...

    Please let me know your perspective on this geek question, and if you have a hack -> that'd be great

    Thanks

  2. #2
    Join Date
    Nov 2011
    Location
    /dev/root
    Beans
    Hidden!

    Re: minimizing (terminal) window from command line

    Browsing the internet with the search string bash minimize window I found

    Code:
    xdotool windowminimize $(xdotool getactivewindow)
    according to the tip in this link

    http://askubuntu.com/questions/31806...ize-a-terminal

    You can make an alias of it, for example

    Code:
    alias min='xdotool windowminimize $(xdotool getactivewindow)'
    that you enter into your ~/.bashrc file and after that it will be enough to type

    Code:
    min
    to minimize the window.
    Last edited by sudodus; March 31st, 2014 at 07:57 AM. Reason: with the search string

  3. #3
    Join Date
    Apr 2011
    Location
    Hong Kong
    Beans
    20
    Distro
    Ubuntu

    Re: minimizing (terminal) window from command line

    Absolutely brilliant ! worked like a charm, thank you Sudodus!

  4. #4
    Join Date
    Apr 2012
    Beans
    7,256

    Re: minimizing (terminal) window from command line

    fyi I think you can actually chain the 2 xdotool commands in one (instead of running xdotool twice)

    Code:
    xdotool getactivewindow windowminimize

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •