Can I minimize a window from the command line?

In Kubuntu 12.04 I use the following command to minimize the active window:

xdotool windowminimize $(xdotool getactivewindow)

I suspect you may replace the $(xdotool getactivewindow) with a string identifying any window that you need to minimize.


You can kind of do this with WMCtrl. It's a tool that allows you to control the window manager from the command line. You can find it in the repositories.

It's compatible with Metacity and KWin (The defaults for Gnome and Kde).

You can use this command to get a list of currently open windows. This will include the window name:

wmctrl -l

Once you have the window name, you can use this command to shade a window:

wmctrl -r "windowname" -b toggle,shaded

I don't think minimization is supported because it's not covered by the EWMH spec, but you can do shading and maximization so it might suit your needs.


to minimize the active window

xdotool getactivewindow windowminimize

works on gnome3.24 shell extension such as custom hot corner, "xdotool windowminimize $(xdotool getactivewindow)" won't.