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 2013-06-12 17:53:44 +0000

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":"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"}]
edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted
1

answered 2013-06-16 23:36:03 +0000

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.

edit flag offensive delete link more

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 ( 2013-06-17 08:41:07 +0000 )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 ( 2013-06-18 14:19:48 +0000 )edit
1

answered 2013-06-12 18:04:24 +0000

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.

edit flag offensive delete link more

Comments

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

Steffen Hoenig gravatar imageSteffen Hoenig ( 2013-06-13 09:35:41 +0000 )edit

Question Tools

1 follower

Stats

Asked: 2013-06-12 17:53:44 +0000

Seen: 447 times

Last updated: Jun 16 '13