The i3 FAQ has migrated to All content here is read-only.
Ask Your Question

How do I use an exclude regex in i3 config

asked 2012-07-11 14:37:55 +0000

By being a Perl based regular expression, I was wondering if there is any extra command to do the opposite of a matching criteria (as PCRE actually do not provide an easy solution for that - thus applications such as grep offer -v option for example).

I basically want to force floating mode for all Pidgin chat windows, besides the main window. The reason for it is simple: I never leave finished chat windows opened, and I want them to call more attention.

# the main window has the title: "Buddy List", and any other chat
# windows has the contact nickname/name on it
for_window [class="^Pidgin$" title="^XXXXXXX$"] floating enable

By forcing an exclude match criteria on "Buddy List", I reckon a contact with this name would fall in the same rule, then being left as tiled window, but this is unlikely, and IMO, acceptable.

If such setting is not possible, would it be worth it to implement it? Something like having the same options implemented with a preceding "v" for invert-match:

for_window [class="^Pidgin$" vtitle="^Buddy List$"] floating enable
edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2012-07-11 14:58:11 +0000

Looks like I could answer my own question (still, the exclude regex would be a nice one though)...

It looks like the decision to place the window is executed in sequence as defined in the config file, so by placing something like:

for_window [class="^Pidgin$"] floating enable
for_window [class="^Pidgin$" title="^Buddy List$"] floating disable

I was able to achieve what I was looking for.

edit flag offensive delete link more

answered 2012-10-23 15:49:42 +0000

Philippe gravatar image

Here is another solution to your problem:

for_window [class="(?i)firefox" instance="^(?!Navigator$)"] floating enable

But it seems that you have to put those ^ and $ to have it working, so there is no way to express "instance does not contain 'Navigator'".

edit flag offensive delete link more


Yes, not-match is unnatural for regular expressions :-(

bruno.braga gravatar imagebruno.braga ( 2012-11-01 07:35:09 +0000 )edit

actually works, I have Gnote search window on scratchpad, but individual note windows set to float with for_window [.... title="^(?!Search All Notes$))"] floating enable

virtualeyes gravatar imagevirtualeyes ( 2013-03-08 00:05:52 +0000 )edit

Question Tools


Asked: 2012-07-11 14:37:55 +0000

Seen: 892 times

Last updated: Oct 23 '12