5

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...

2 Answers 2

5

You can use xdotool like that:

xdotool search  "Mozilla Firefox" windowminimize
3
  • Thanks! It worked with Mozilla Thunderbird, for example, but not with the KDE application Elisa. Can you tell why?
    – Sadi
    Jan 22, 2020 at 17:08
  • I don't know why. Show the command you're running. Jan 22, 2020 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, 2020 at 12:01
2
wmctrl -Fr "Playlists" -b add,shaded

leaves the title bar visable so I did the following but you usually have to install xdotool

xdotool search --name "Playlists" | xargs xdotool windowminimize
2
  • It would be very good to get Elisa by name etc. indeed because sometimes getactivewindow fails (probably another app window becomes active in between) but --name "Playlists" didn't do the trick in my case. How did you get "Playlists" displayed as name? I suspect it might be different in each case.
    – Sadi
    Jul 23, 2021 at 8:58
  • Replace "shaded" with "hidden" and the title bar is gone. And if you replace "add" with "toggle", you can bring it back with the same command (otherwise, change "add" to "remove"). wmctrl -Fr "Playlists" -b toggle,hidden
    – Gik
    Sep 25, 2021 at 17:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .