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

Why is 'for_window' not accessible from i3-msg?

asked Jun 12 '13

anonymous user

Anonymous

I'd like to have a configuration line like

i3-msg 'for_window [class="URxvt" instance="scratch"] move scratchpad; exec urxvtc -name scratch'

in my .i3/config, but trying it interactively with i3-msg, it didn't like for_window at all

ERROR: Your command: for_window [instance="scratch"] move scratchpad
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=\"scratch\"] move scratchpad","errorposition":"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"}]

2 answers

Sort by » oldest newest most voted
1

answered Jun 16 '13

I didn't understand why you need to use i3-msg within i3 config file. Why don't you just call it directly:

for_window [class="URxvt" instance="scratch"] move scratchpad 
exec urxvtc -name scratch

If you need to access i3 while it is running already (let's say, integrating with another application), then i3-msg will come handy.

Comments

because somehow it doesn't work like this in my config, only as two separate commands in the shell or concatenated with a sleep() command, may be there is a timing issue?

Steffen Hoenig gravatar imageSteffen Hoenig (Jun 17 '13)edit

could be... I have a problem like this with synergy, so I call a bash script from the config, and in the bash I run the sleep, then the command I wish to execute (sleep directly in the config does not work either).

bruno.braga gravatar imagebruno.braga (Jun 18 '13)edit
1

answered Jun 12 '13

V0id gravatar image

Remove the for_window. It is used to define behaviors for windows matching a given criteria. Here you only want to perform an action.

Comments

Interestingly, it works without for_window, but only one command by one. Maybe there is a timing issue.

Steffen Hoenig gravatar imageSteffen Hoenig (Jun 13 '13)edit

Question Tools

1 follower

Stats

Asked: Jun 12 '13

Seen: 447 times

Last updated: Jun 16 '13