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

anyway to include in config file

asked 2013-03-10 23:31:58 +0000

updated 2013-03-10 23:32:22 +0000

I am currently managing about 8 computers here and there, all using i3... and I have set of shared files and folders for stuff it can be reused in all (bash_aliases, bashrc, .vim, etc). In bash, specifically, is very convenient to use a dot to "include" other files within the executing script... I was wondering if we have (or could have) anything similar in i3 config file?

The main reason being, every time I change something in the config (happens quite often when I discover new things, or want certain windows to behave different from the default), and I have to update all files, over and over...

Any ideas?

edit retag flag offensive close merge delete

Comments

I realize you have an answer, but I'd like to suggest what I do, it works great. I sync common dot files via a github repo[1] and a cron job. The fact that they are versioned is also attractive. [1]: https://github.com/wesleywerner/dotfiles

Wesley gravatar imageWesley ( 2013-05-24 18:52:26 +0000 )edit

I would really like to advocate for adding including of files to i3. Something like being able to have a config.d directory, with small files instead of having this giant blob of text that is hard to share. Unfortunately, my skills with C is not enough to make this happen on my own :-(

gustavnikolaj gravatar imagegustavnikolaj ( 2014-03-11 12:49:16 +0000 )edit

2 answers

Sort by » oldest newest most voted
1

answered 2013-03-11 01:29:50 +0000

this post is marked as community wiki

This post is a wiki. Anyone with karma >100 is welcome to improve it.

There is no include mechanism in i3 itself. But you can create the config file everytime X starts from templates.

#!/bin/bash
cat $HOME/.config/i3/config.base \
    $HOME/.config/i3/config.local > $HOME/.config/i3/config
exec /usr/bin/i3

Something like this as a wrapper-script around i3 should work.

edit flag offensive delete link more

Comments

Yeah, that sounds like the only option at this moment. Thanks!

bruno.braga gravatar imagebruno.braga ( 2013-03-11 04:05:50 +0000 )edit
0

answered 2013-05-21 23:29:26 +0000

marc gravatar image

I have the same problem. An include function would be very nice. Another option would be if/else conditons based on environment variables like $HOSTNAME etc. Creating the config on startup is an option but forces me to recreate the config file every time I made changes and want to reload the config on the fly.

edit flag offensive delete link more

Comments

If you often reload the config file, just make your keybinding call the script + reload, or — if you reload from the commandline — create an alias which calls the script + i3-msg reload.

Michael gravatar imageMichael ( 2013-05-22 17:50:55 +0000 )edit

yes - that works - thanks!

marc gravatar imagemarc ( 2013-05-23 03:57:23 +0000 )edit

Question Tools

2 followers

Stats

Asked: 2013-03-10 23:31:58 +0000

Seen: 2,665 times

Last updated: Aug 17 '14