I have a startup application that has no option to "start minimized" or "close to system tray" etc. and therefore would like to use a startup script that will first start the application and then minimize its window.

Actually, I already have a startup script that closes the window of an application which luckily has a sort of "close to system tray" option:

wmctrl -ic $(wmctrl -l | grep "AppWindowTitle" | cut -d ' ' -f 1)

I should ideally be able to minimize the window with a command like this:

wmctrl -ir $(wmctrl -l | grep "AppWindowTitle" | cut -d ' ' -f 1) -b toggle,minimized

But there is not such option available in wmctrl. Options for the first argument are: add, remove, toggle. And options for the second argument are: modal, sticky, shaded, skip_taskbar, skip_pager, hidden, fullscreen, above, below, maximized_vert, maximized_horz

These seem to work and I would expect the argument hidden could be the one I need but it's not hiding the window.

I wonder if there's some other way of achieving this...


You can use xdotool like that:

xdotool search  "Mozilla Firefox" windowminimize
| improve this answer | |
  • Thanks! It worked with Mozilla Thunderbird, for example, but not with the KDE application Elisa. Can you tell why? – Sadi Jan 22 at 17:08
  • I don't know why. Show the command you're running. – Arkadiusz Drabczyk Jan 22 at 21:09
  • I think there's a problem with window title. It works with some KDE app windows, but not all. However, this helped me find a solution: adding the command xdotool windowminimize $(xdotool getactivewindow) 2 secs after starting Elisa did the trick. Thanks! – Sadi Jan 23 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.