Skip to content

Latest commit

 

History

History
39 lines (29 loc) · 1.95 KB

README.md

File metadata and controls

39 lines (29 loc) · 1.95 KB

i3-event-handler

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.

Installation

This might work for you, might not :)

  1. git clone https://github.com/phiekl/i3-event-handler.git
  2. cd i3-event-handler
  3. pip3 install --user .
  4. i3-event-handler --help (you might need to add ~/.local/bin to your PATH).
  5. mkdir -p ~/.config/i3 ~/.config/systemd/user
  6. cp systemd/i3-event-handler.service ~/.config/systemd/user/
  7. cp config/event_handler.json ~/.config/i3/
  8. vim ~/.config/i3/event_handler.json
  9. i3-event-handler to try it out
  10. systemctl --user start i3-event-handler to try it out via systemd
  11. 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`