The i3 FAQ has migrated to https://www.reddit.com/r/i3wm/. All content here is read-only.
Ask Your Question
1

Is it possible to match a window based on the window type? (NORMAL, DIALOG etc.)

asked 2015-04-14 10:34:59 +0000

Tomas Sandven gravatar image

updated 2015-04-14 10:36:56 +0000

Shutter is a pretty awesome screenshot tool, but it doesn't have any distinctive instance names or window roles for its various windows. This makes it impossible to write i3 criteria to match the main window of the application, since it has the same role, class and instance as all the other windows.

The only distinctive feature I can find about the main window is that the window type is set to "normal":

_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL

While the other windows are "dialogs".

There doesn't seem to be a way to match window types using just the criteria though, so do you guys know of a different way to match the main window?


Currently I am doing this:

# Shutter
set $shutter [class="Shutter" title="^Session"]
set $prtscr 107
for_window $shutter move scratchpad
bindcode $prtscr $shutter scratchpad show

This causes the Shutter main window to get hidden in the scratchpad when launched, and I can summon it using the PrtScr key. The problem is that the Shutter window title only starts with "Session" when there are no screenshots in the Shutter session. As soon as I actually grab a screenshot, the window title changes and this configuration stops working.

I am experimenting with using marks to solve this, but I haven't had any luck yet.

I have filed a bug report:

edit retag flag offensive close merge delete

Comments

NB: I tried to all lots of useful links to relevant parts of the documentation, but apparently my karma is too low

Tomas Sandven gravatar imageTomas Sandven ( 2015-04-14 10:35:37 +0000 )edit

2 answers

Sort by » oldest newest most voted
1

answered 2015-04-14 11:11:00 +0000

Adaephon gravatar image

At the moment it is not possible to have window types as criteria.


But in this case it may not be necessary. As you can (reliably?) identify the window in question at least in its initial state, you can use mark to give it an unique identifier and then use that instead of class and title:

set $shutter "THIS_IS_SHUTTER"
set $prtscr 107
for_window [class="Shutter" title="^Session"] mark $shutter, move scratchpad
bindcode $prtscr [con_mark=$shutter] scratchpad show

This marks the Shutter window and than moves it to scratchpad in one go. The mark is than used with the con_mark criterion.

Note that it is important to use , to separate the mark and move commands instead of ;, else the criterion would only be applied for the first command.

edit flag offensive delete link more

Comments

I just tried that, and it doesn't work. Or rather, it works just like the solution I'm currently using. It turns out the main window closes while I take a screenshot, then reopens with a title that doesn't match the criteria.

Tomas Sandven gravatar imageTomas Sandven ( 2015-04-14 11:58:57 +0000 )edit

Also, do you know if window types as a criteria is planned, or has it been rejected for some reason?

Tomas Sandven gravatar imageTomas Sandven ( 2015-04-14 12:07:21 +0000 )edit

Sorry, I do not use Shutter, so I did not actually test it with that. As for plans about this feature: at least in the [i3 bug tracker](https://github.com/i3/i3/issues) I could not find anything about that. If you want you can open an feature request there.

Adaephon gravatar imageAdaephon ( 2015-04-14 12:38:27 +0000 )edit
1

answered 2015-04-29 12:22:43 +0000

Airblader gravatar image

updated 2015-04-29 20:05:05 +0000

It's worth mentioning that based off of this thread, the feature to use window types as criteria has been added to i3 now. The syntax is

for_window [window_type="normal"] …

A variety of types are supported: normal, dialog, utility, toolbar, splash, menu, dropdown_menu, popup_menu, tooltip.

The feature will be available with the first non-bugfix release after 4.10.2 which will either be 4.11 or 5.0, I would expect.

edit flag offensive delete link more

Comments

Great news and thanks for implementing this feature. Can you please add a bit of information on how to use it? It would make for a much better answer than my ugly workaround.

Adaephon gravatar imageAdaephon ( 2015-04-29 19:23:08 +0000 )edit

I've updated it a little. :)

Airblader gravatar imageAirblader ( 2015-04-29 20:03:45 +0000 )edit

Question Tools

Stats

Asked: 2015-04-14 10:34:59 +0000

Seen: 808 times

Last updated: Apr 29