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

How to tell i3 how to decorate new_windows via i3-msg?

asked 2014-11-23 21:52:20 +0000

ptnobel gravatar image

In my config file I have the line:new_window pixel; However, I'm trying to write a script that changes the way windows are decorated. It changes all current windows with the command i3-msg '[ class=".*" ] border normal' but how do I tell i3 to decorate all new windows with border normal via i3-msg?

Should I just write while true ; do sleep 30 && i3-msg '[ class=".*" ] border normal' ; done?

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2014-11-24 10:02:13 +0000

Adaephon gravatar image

You cannot set the value for new_window (or new_float) with i3-msg because this is a configuration option and i3-msg can only run commands.

In order to change the style for new windows it is best to change the settings in the configuration file and than reload the configuration. This could be done with a script. Something like this for example:



# 1st argument is used for tiled windows, defaults to "normal 2"
NEW_WINDOW="${1:-normal 2}"
# 2nd argument is used for floating windows, defaults to the same as tiled

# set configuration for tiled windows
sed "s/^new_window .*/new_window $NEW_WINDOW/" -i "$I3_CONFIG"
# set configuration for floating windows
sed "s/^new_float .*/new_float $NEW_FLOAT/" -i "$I3_CONFIG"

# reload i3
i3-msg reload

Note: this will also change the style of existing windows, but only if their style was not changed with the border command. (Sometimes it is necessary to shift focus in order to update all borders)

Warning: this script modifies your i3 configuration (obviously). It may be a good idea to have a backup.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2014-11-23 21:52:20 +0000

Seen: 1,054 times

Last updated: Nov 24 '14