The i3 FAQ has migrated to All content here is read-only.
Ask Your Question

Changing colors dynamically (dark/light theme)

asked 2012-09-30 20:55:36 +0000

weinzierl gravatar image

I would like to switch between a dark and a light theme, preferably with a single keybinding that toggles between the two.

Using any color configuration statements, like client.unfocused, in a bindsym didn't work. I guess that's because client.unfocused is not command and bindsym requires a command.

Is there a way to change colors dynamically?

My current workaround

I have split my config files in my ~/.i3 directory into several files, like 00config and 01theme. The latter really is a symlink to the current theme file. I reload my config like this:

bindsym $mod+Shift+R  exec "cat ~/.i3/[0-9][0-9]* >~/.i3/config && i3-msg reload"

This works, but I wondered if there is an easier, simpler way to do it.

edit retag flag offensive close merge delete


Interesting, can I do the same for xterms only?

lzap gravatar imagelzap ( 2012-10-01 13:22:33 +0000 )edit

@Izap: You could set up something similar for xterm. You would build up either ~/.Xdefaults or ~/.Xresources from fragment files and then instead of reloading i3 you would xrdb load .Xresources or .Xdefaults respectively.

weinzierl gravatar imageweinzierl ( 2012-10-01 19:10:03 +0000 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2012-09-30 20:56:54 +0000

Michael gravatar image

Your "workaround" is the intended way to do this until we implement setting (parts of) the config at runtime.

edit flag offensive delete link more


Just to be sure if I understand correctly: There are commands (what is described in "6. List of commands" in the manual) and there are other things, let's call them statements. Commands can be used in bindsym and sent with i3-msg, statements are read only when the configuration is loaded.

weinzierl gravatar imageweinzierl ( 2012-09-30 21:17:10 +0000 )edit

Correct, there are commands and configuration directives. For the variables, you might need to change the order. But please open a new question for each problem/question you are having.

Michael gravatar imageMichael ( 2012-10-01 10:27:30 +0000 )edit

Many thanks. Posted the question about variable names under

weinzierl gravatar imageweinzierl ( 2012-10-01 19:05:51 +0000 )edit

Question Tools



Asked: 2012-09-30 20:55:36 +0000

Seen: 1,083 times

Last updated: Sep 30 '12