You are not logged in.
I like to toggle certain application windows using the command-
# show
xdotool search --class <process-name> windowmap %@ windowraise %@
# hide
xdotool search --onlyvisible --class <process-name> windowunmap %@
But how do you start applications hidden by default?
Best I can do is to start the application, wait for 1-2 seconds (to make sure it has finished starting up and is running, xdotool doesn't work otherwise), then hide it. But then the application shows up briefly before moving into the hidden state.
Last edited by desperado (2021-08-15 17:40:40)
Offline
If %application% doesn't support that, your best chance is a window manager rule (which will depend on the %windowmanger% at use)
Online
I'm using bspwm.
Offline
Online
I prefer a wm independent solution if there is one. Thanks anyway.
Offline
I prefer if we don't play this down in 20 questions…
What are you *actually* trying to achieve? What exact application do you want to start hidden and why?
You'll not be able to keep a certain window from being mapped unless either the client or the WM support that.
You've to either make the client not issue a map request or the WM not honor it.
That's it.
You can make xdotool wait smarter if you can isolate the client eg. by class (see "man xdotool" for the --sync example), but you'll still have to wait for the window to unmap it after it was mapped.
Online
I asked for a wm independent solution because I sometimes switch WMs just to experiment on a few things. I omitted some of the details for the sake of brevity and to keep it general (guess that backfired).
From what I understand, --sync makes xdotool wait until the map/unmap was finished instead of returning immediately. I doubt this is what I need.
The applcation in question is lxqt-panel (yes, I use it in conjunction with bspwm because polybar isn't as simple). But lxqt-panel doesn't have the option to start unmapped the way some other bars do.
I'll just put the exact script I'm using right now.
lxqt-panel &
sleep 2
xdotool search --onlyvisible --class lxqt-panel windowunmap %@
lxqt-panel blocks as long as it runs, which is why it needs to be pushed to the background. If xdotool is run immediately after sending it to the background, xdotool might finish before lxqt-panel is even mapped in which case xdotool totally ignores lxqt-panel and exits.
Edit: I didn't know search had a sync option too. Maybe this will do
Edit2: This is the script I tried.
lxqt-panel &
xdotool search --sync --class lxqt-panel windowunmap --sync %@
The panel still shows for a moment
Last edited by desperado (2021-08-15 17:05:05)
Offline
Yup, will.
QApplication doesn't support such feature, nor does LxQtApplication or the panel (afaics, briefly looked at the code), so if you don't handle this through the WM, the --sync search to windowunmap is the best it will get.
(Depending on WM and compositor you'll still briefly see the window, but at least not rely on a random timeout)
Online