The i3 FAQ has migrated to https://www.reddit.com/r/i3wm/. All content here is read-only.

# bindsym not working -- command works fine in terminal

I have set this keybind in order to switch layouts with $mod+space(duh!). However, while the command works fine when run in rxvt with bash, it doesnt seem to work with the keybind.$SHELL is /bin/bash and I have disabled the other $mod+space keybind so overlapping keybinds is not the problem. bindsym$mod+space exec "setxkbmap -layout $([[$(setxkbmap -query | awk '/layout/{ print $2 }') == us ]] && echo 'gr' || echo 'us')" Running version 4.8 on Jessie. edit retag close merge delete ## 1 answer Sort by » oldest newest most voted I'm assuming the dollar signs are a problem since they will be interpreted as a variable. For scripts like this I'd usually just suggest to move it into a dedicated script and then simply execute that script from your config. more ## Comments Ah that was the problem, thanks :) ( 2015-05-29 14:34:43 +0000 )edit Why does i3 do this? If I don't use syntax, I can get around i3's internal layer of quoting usually with  exec bash -c "[comands here]"  but if my commands include [,$, or some other set of things I haven't worked out it gives an error, points at them, and doesn't explain why.

( 2015-05-31 20:02:29 +0000 )edit

I think you can escape a dollar sign by doing . Dollar signs are special because they denote variables in the config. As the docs state,there is no plans of changing this. It makes sense to put complicated commands into separate, dedicated scripts anyway. Maintaining quoted versions is horrible.

( 2015-05-31 20:45:38 +0000 )edit

I've been doing that, but it bugs me that my config is getting scattered across shell scripts. But if that's the i3 way I can adapt :)

( 2015-06-01 05:20:48 +0000 )edit

It's not really "the i3 way", but being a software developer, I actually think it's a whole lot cleaner to not put tons of shell scripts into a plain text configuration file. Just keep them in a specific directory and they're neatly organized. :)

( 2015-06-01 06:47:56 +0000 )edit