The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
1

ignore for_window

asked 2014-05-15 14:33:25 +0000

anonymous user

Anonymous

I have for_window to put certain apps in some certain workspace, but sometime I need to ignore this rule and open the app in the current workspace. How do I do this? Thanks.

edit retag flag offensive close merge delete

Comments

@Ikraav: I think my question is different. For e.g.: currently I let chromium at 2: browser by default, but sometime I am in 3: text editor and would like to open a browser in the same workspace, I want to ignore that for_window just for once, any command to do that?

superkappa179 gravatar imagesuperkappa179 ( 2014-05-16 02:07:57 +0000 )edit

1 answer

Sort by ยป oldest newest most voted
2

answered 2014-05-19 05:35:16 +0000

Adaephon gravatar image

There are two ways to do that - that I can think of:

  1. Depending on the application and criteria you are using, it may be possible to start the application in a way that does not trigger the rule. GTK applications for example have the --class=CLASS option, which allows changing the WM_CLASS. Titles can be changed, too, in many applications.

  2. You could keep a set of two configuration files, one with for_window statements and a copy without them, with ~/.i3/config being a link to the one currently used. For starting you then could use the following wrapper script (then use wrapper application --options instead of application --options)

#!/bin/sh
CFG="${HOME}/.i3/config"
CFGFOR="${CFG}-withfor"
CFGNOFOR="${CFG}-nofor"
# switch to configuration without for_window
ln -sf "$CFGNOFOR" "$CFG"
i3-msg reload
# start anything passed as arguments to this script
"$@" &
# wait one second for the window to be initialized
# this may need to be longer for some applications
sleep 1
# switch back configuration
ln -sf "$CFGFOR" "$CFG"
i3-msg reload

Both ways have their pros and cons. The first one does not work for every application, but if it works it does so with minimal hassle. The second method works with any application, but it disables all for_window configurations for a certain time which may not be desirable.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-05-15 14:33:25 +0000

Seen: 118 times

Last updated: May 19 '14