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

How to assign whole commands to variables?

asked 2013-03-15 14:20:58 +0000

Profpatsch gravatar image

The screenshot part of my config:

set $ftsc jpg
set $selsc import $SCREENSHOT.$ftsc
set $selfsc import -window root $SCREENSHOT.$ftsc
set $editsc pinta $SCREENSHOT.$ftsc
set $uplsc imup $SCREENSHOT.$ftsc | loliclip -c
set $kselfsc Control
set $keditsc Shift
set $kuplsc Mod1

bindsym Print $selsc
bindsym $keditsc+Print $selsc && $editsc
bindsym $kselfsc+Print $selfsc
bindsym $kselfsc+$keditsc+Print $selfsc && $editsc
bindsym $kuplsc+Print $selsc && $uplsc
bindsym $kuplsc+$kselfsc+Print $selfsc && $uplsc

Only problem: It doesn’t work:

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'
ERROR: Your command: import $SCREENSHOT.$ftsc
ERROR:               ^^^^^^^^^^^^^^^^^^^^^^^^

This looks suspiciously like variables can’t take any spaces, which is rather unfortunate.

Is there any way to do this? I want to keep this DRY.

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2013-03-15 14:27:37 +0000

Michael gravatar image

You are missing “exec” in your bindsym.

You have:

bindsym $kselfsc+Print $selfsc

You meant:

bindsym $kselfsc+Print exec $selfsc
edit flag offensive delete link more

Comments

Indeed. So the variables are assigned correctly?

Profpatsch gravatar imageProfpatsch ( 2013-03-16 17:45:34 +0000 )edit

Question Tools

Stats

Asked: 2013-03-15 14:20:58 +0000

Seen: 208 times

Last updated: Mar 15 '13