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

Why doesn't for_window work in i3-msg?

asked Oct 22 '13

npostavs gravatar image

Is reloading config the only way to set for_window commands?

 i3-msg 'for_window [instance="^floatme$"] floating enable'
ERROR: Your command: for_window [instance="^floatme$"] floating enable
ERROR:               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ERROR: Expected one of these tokens: <end>, '[', 'move', 'exec', 'exit', 'restart', 'reload', 'border', 'layout', 'append_layout', 'workspace', 'focus', 'kill', 'open', 'fullscreen', 'split', 'floating', 'mark', 'resize', 'rename', 'nop', 'scratchpad', 'mode'
[{"success":false,"parse_error":true,"error":"Expected one of these tokens: <end>, '[', 'move', 'exec', 'exit', 'restart', 'reload', 'border', 'layout', 'append_layout', 'workspace', 'focus', 'kill', 'open', 'fullscreen', 'split', 'floating', 'mark', 'resize', 'rename', 'nop', 'scratchpad', 'mode'","input":"for_window [instance=\"^floatme$\"] floating enable","errorposition":"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"}]

1 answer

Sort by » oldest newest most voted
2

answered Oct 22 '13

Adaephon gravatar image

updated Oct 22 '13

With i3-msg for_window is not needed. Just prepending the criteria is sufficient:

i3-msg '[instance="^floatme$"] floating enable'

This will enable floating mode for any matching and existing window. But it will not change the behavior of windows that are created later.

On the other hand, adding a for_window instruction to the configuration file and reloading will not change any already existing window but only affect new windows.

Depending on what your goal is, you may have to do both.

Comments

You mean 'without reloading', as per your initial question? As far as I can tell, there is indeed no way to change the configuration (as in initial settings) without reloading it from file.

Adaephon gravatar imageAdaephon (Oct 22 '13)edit

Right I meant 'without'. And the system just ate my comment when I tried to edit...

npostavs gravatar imagenpostavs (Oct 23 '13)edit

Question Tools

Stats

Asked: Oct 22 '13

Seen: 555 times

Last updated: Oct 22 '13