Instead of configuring a bunch of for_window in the i3 config to set various options on windows, i3-event-handler let's you set this up in a JSON file instead. The program listens on the events generated by i3 via its IPC socket, especially the one for "new window", to accomplish this task.
i3-event-handler was specifically created to improve marking of windows, in a case such as this:
for_window [class="^Firefox-esr$"] mark web
This marks the browser window with "web" once it gets opened, but if you open an addtional browser window, that new window will take over the mark. Perhaps there's a way to configure it some how differently to avoid this. This is resolved using i3-event-handler, as it won't reuse a mark that is already in use by another window.
Besides the "mark feature", one can configure one or multiple commands to run per matched window.
A nice side effect is that configuring these things using this program makes the i3 config smaller, and you probably won't need to reload i3 as often, instead, just restart i3-event-handler.
This might work for you, might not :)
git clone https://github.com/phiekl/i3-event-handler.gitcd i3-event-handlerpip3 install --user .i3-event-handler --help(you might need to add ~/.local/bin to your PATH).mkdir -p ~/.config/i3 ~/.config/systemd/usercp systemd/i3-event-handler.service ~/.config/systemd/user/cp config/event_handler.json ~/.config/i3/vim ~/.config/i3/event_handler.jsoni3-event-handlerto try it outsystemctl --user start i3-event-handlerto try it out via systemd- Finally you would probably want to add something like this to the i3 config to start the service when i3 is launched (and reloaded):
exec_always --no-startup-id systemctl --user restart i3-event-handler.service`