tdrop
tdrop copied to clipboard
Can I show/hide multiple windows with the same bind?
When I use a program like qjackctl I'll often need both the main window and one two more windows. The workflow of this program lends itself well to have it floating, showing it when needed and hiding it when not.
I made this bind
super + q
tdrop -ma -n qjackctl -w 440 -h 100 qjackctl
but this only applies to the main window and not whichever other qjack window I might open afterwards.
Is there a way to make tdrop "grab" this new window and hide/show it simoultaneously with the main window?
If not I think I can make something work with bspwm itself.
It would be possible to add this functionality, but it doesn't exist right now. I have to think about whether this makes sense to have as part of tdrop. Either all windows of a program could be toggled, or all windows associated with a process could be toggled (all wids for xdotool search --pid <qjackctl pid>
).
When toggling floating windows, I'm not sure how the resizing options would make sense. Do you only want to set the size of the main window? The size of all windows? Should there be an option to not change the geometry of anything and just hide/show? This might not work great with the current commandline flags; it might make more sense to add one or more subcommands for handling multiple windows if I were to add this.
Didn't think about the resizing. I think this would be a case where a config file would be the best solution.
Could you give me some specific examples of the behavior you would want?
Yes. I'll try to boil it down to the simplest terms. This is qjackctl:
That is the main window and I can show/hide it with super + q
.
If I click connect
another window opens:
If I now press super + q
the main window will hide. What I want is for the 2nd window to also hide and also be shown when I press it again.
I haven't given much thought to size and position. In my mind, it would be fine if things reappear in the size and position that you left them, which would allow you to move things manually according to what windows might be tiled and keep it that way.
A little more detail about my usage: I have a sxhkd bind to hide/show all floating windows because things can get a little hectic with music production. This sometimes interferes with tdrop. For example if the qjackctl window is visible and I use that bind, it will be hidden along with every other floating window, but then super + q
will not bring it back.
This led me to think if grouping windows was a feature in tdrop, but like I mentioned before perhaps it's something I should implement on bspwm itself through scripting. What do you think?
I could hypothetically add a way to configure the layout for multiple windows, but it would be pretty complicated to do and is already possible with bspwm external rules, for example. It would probably make sense to handle positioning through bspwm.
You could piggy back off of tdrop for hiding/showing all qjackctl windows at once like this (would be different for programs you have multiple instances of):
tdrop --post-map-hook 'xdotool search --classname qjackctl windowmap %@' \
--post-unmap-hook 'xdotool search --classname qjackctl windowunmap %@' qjackctl
Or you could write your own script to toggle (though that would involve a little extra work).
If you don't mind using two programs that do the same thing, you can bind two tdrops to one hotkey.
KEYBIND = tdrop -n 1 -mat kitty && tdrop -n 1 -mat rvxt
Drops and hides them both beautifully.