I’m experiencing an odd behavior when toggling floating mode. The first time it appears to be working kinda fine, but with the floating window randomly placed; subsequent times every app gets a different treatment, it usually floats centered in the screen but with random sizes, including filling the whole screen.
Yet I have this line in my config:
If there are no recent changes (that you know of), the way I usually debug configs, when I have no clue why it’s doing what it’s doing, is to comment out large chunks of the config file and see if it still happens. Then reduce the size of the commented parts. You usually find the troublesome config/interaction quite quickly this way.
I commented out everything related to windows and now the issue seems to be confined to Kitty and Firefox only, I guess something in their configurations messes with the floating commands.
Even at first glance, I already see a potential for a race condition here.
Configs like these are why some of your apps do not follow the 640 x 480 rule. Because the actual behavior will depend on i3’s internal implementation (e.g: which ones of those for_window statements get executed last)
I see, so the question becomes: can I set a standard custom floating size, allowing for some apps to be smaller than that? It seems the issue remains independently of the order given in the config file.
Try this first (no guarantees that it’ll work but, but it’s worth a try):
for_window [class="Galculator" instance="galculator"] floating enable, resize set 320 320
for_window [class="gnome-calculator" instance="gnome-calculator"] floating enable, resize set 320 320
Note the , i’ve added to define the chain of commands. This help separate floating enable resize set 320 320 into two commands among which an order of execution can be defined.
For example, if we look at:
for_window[class="Galculator"...] floating enable, resize set 320 320
This means that as soon as Galculator is launched, it will first change it into a floating window (which will automatically trigger the default size for floating windows 640 480), which will then be resized to 320 320.
Depending on system performance, the window resize operation may or may not be noticeable on the screen (a flicker).
Make those changes in your i3 config, reload the config and test it out. Let me know how it goes.
mh, it still won’t work properly (it only works the second time I toggle the floating command).
If I dispense with the custom standard size, the following works (it avoids the issue but at least I can use the terminal floating centered (a “zen mode” of sorts for prose writing, note-taking, etc.), and that matters most.
for_window [floating class="Alacritty"] resize set 680 600
for_window [floating] move position center
## tiling exceptions
for_window [window_role="About"] floating enable
for_window [class="Galculator" instance="galculator"] floating enable, resize set 320 320
for_window [class="gnome-calculator" instance="gnome-calculator"] floating enable, resize set 320 320
for_window [class="Pavucontrol" instance="pavucontrol"] floating enable, resize set 1000 720
for_window [class="Syncthing GTK"] floating enable, resize set 1000 720
Just to clarify. Do you mean that when you launch Galculator for the first time after reloading the config, the resulting window will be size 640 x 480. But subsequent launches of Galculator will be 320 x 320?
What if you replace the line to set the default floating window size with this:
floating_maximum_size 680 x 680
Caveat:
This will only work if the default window size of a particular application is larger than 680 x 680. Applications with window sizes smaller than 680 x 680 will still open in their own sizes; on the other hand, applications with larger default window sizes will be forced to shrink down to 680 x 680.
correct ( when I launch Galculator for the first time after reloading the config, the resulting window will be size 640 x 480. But subsequent launches of Galculator will be 320 x 320); and as for your second solution below, it works as a workaround although it indeed shrinks down larger default window sizes.
I just thought of another alternative. Instead of using a generic, for_window [floating] to set the default, you can use a regular expression to exclude Galculator, gnome-calculator, etc. from the defaults.
for_window [class="...some regular expression to exclude other apps..."] resize set 640 480
That way, the default floating size will be applied to every other floating window except Galculator, gnome-calculator, etc.
Note that the regular expression used for the command criteria must be perl-compatible. You might want to refer to a manual for the exact syntax.
well, yes, all the apps I use in floating mode behave properly with this solution; in fact, every app behaves now, even those that make no sense in a small floating mode, like Gimp, but it’s ok, it just nagged me that they behaved erratically.
Yeah. It should because floating_maximum_size is a command itself, whereas for_window is a directive that will execute only when specific windows are encountered. Setting the default dimensions with floating_maximum_size will eliminate the race condition I mentioned above.