I want to extract the default keybindings from my .i3config file and source it from another file

I did that like this:

#source default keybindings
. ~/.path_to_other_file

But this doesn't work. Restarting i3 causes an error "you have a syntax error in your config file!" I can't think why this wouldn't be possible, but . ~/path_to_other_file and source ~/path_to_other_file both don't work.


There is actually a simple reason why this does not work as you expect. i3's config file is not a shell script. So, the question is, why would you want to do this?

If you are hoping to be able to run commands in your i3 config specified in the script you mention, then it's not going to work. It seems like you're hoping to break down your config file into several smaller shell scripts; this will also not work. If you want i3 to be aware of a set of keybinds in any sensible way, you should put them directly in your config file.

If, on the other hand, you just want to run a shell script when starting i3, this is quite easy. All you need to do is use the well-documented exec command (I imagine it would look something like this):

exec sh /path/to/script/to/be/run
  • 1
    it's really just for segregation - i have a lot of my own keybindings defined, and the default keybindings take up a considerable amount of space and reduce readability – dax May 24 '14 at 19:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.