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:
#!/bin/bash
I3_CONFIG="$HOME/.i3/config"
# 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
NEW_FLOAT="${2:-$1}"
# 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.