Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for tiled/floating in swallow criteria for saved layouts #3647

Open
Hubro opened this Issue Mar 17, 2019 · 3 comments

Comments

Projects
None yet
4 participants
@Hubro
Copy link

commented Mar 17, 2019

I'm submitting a…

[ ] Bug
[x] Feature Request
[ ] Documentation Request
[ ] Other (Please describe in detail)

Current Behavior

There's no way to only target tiled windows (ignore floating windows) when writing swallow criteria for saved layouts.

Desired Behavior

It should be possible to set up swallow criteria to ignore floating windows.

Many applications have a floating "splash screen" that shows up while the application is loading. Examples include Slack, Discord and Hiri. Simply specifying the right class name in the swallow criteria will cause i3 to swallow the splash screen instead of the main application. (Actually, i3 will currently simply crash, see #3610, but presumably that will be fixed soon.)

In most cases, it's probably possible to specify additional criteria that will only match the main window. In the case of Slack and Discord, the class name, instance name and window type of the splash screen is identical to the main window, but fortunately the titles differ. If the titles were identical too, I don't know how I would make the layout ignore the splash screen.

i3 is pretty good at automatically identifying which windows should be floating, however. Quoting Airblader:

We float it upon managing the window if it's not a dock window and any of the following is true:

  1. The window type is dialog, utility, toolbar or splash
  2. The window indicates that it wants to be sticky.
  3. The window is transient for another window.

If saved layouts added support for floating and tiled like the user config does, it would be trivial to make saved layout ignore splash screens, since they are floating by default. Example:

"swallows": [
   {
       "class": "^Slack$",
       "tiled": true
   }
]

@i3bot i3bot added the enhancement label Mar 17, 2019

@Hubro

This comment has been minimized.

Copy link
Author

commented Mar 21, 2019

Already on my second layout attempt, I found an application where it's impossible to distinguish between the splash screen and the main window: Steam. In other words, it's currently impossible to include Steam in a saved layout.

Adding the tiled criteria would fix this.

@Airblader

This comment has been minimized.

Copy link
Member

commented Mar 21, 2019

It would, but it's also something where Steam should just provide better information on the windows. Like the proper window type on the splash window.

@orestisf1993

This comment has been minimized.

Copy link
Member

commented Mar 21, 2019

This will be non-trivial to implement because match.c checks for floating through the window's container:

i3/src/match.c

Lines 220 to 223 in a4309cb

if ((con = con_by_window_id(window->id)) == NULL)
return false;
const bool floating = (con_inside_floating(con) != NULL);

but swallowing happens before the window is assigned a container:

i3/src/manage.c

Lines 247 to 249 in 3aa42cf

/* See if any container swallows this new window */
Match *match = NULL;
Con *nc = con_for_window(search_at, cwindow, &match);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.