No description
Find a file
2023-10-15 15:13:52 +02:00
src Add signal processing, more logs. 2023-10-15 14:41:02 +02:00
.gitignore Initial rust rewrite commit, still wip. 2023-10-14 00:26:34 +02:00
Cargo.toml Add signal processing, more logs. 2023-10-15 14:41:02 +02:00
README.md Add readme. 2023-10-15 15:13:52 +02:00

i3toolwait

Launch a program and move it to the correct workspace.

Usage

i3toolwait -c FILE

Optionally start multiple programs and wait for their windows to appear. Once these windows appeared a custom i3 command can be specified.

Example

---
timeout: 10000
init: |
  (begin
    (define i3_path ".container.window_properties.class")
    (define sway_path ".container.app_id")
    (defun idmatch (name) (== (if (has-key sway_path) (load sway_path) (load i3_path)) name))
    (defun match (name) (and (== (load ".change") "new") (idmatch name)))
    (defun match-load (name) (if (match name) (load ".container.id") F))
  )  
cmd: 'workspace 1'
programs:
- run: 'exec gtk-launch librewolf'
  cmd: 'for_window [con_id="{result}"] focus; move container to workspace 1'
  match: '(match-load "LibreWolf")'
- run: 'exec gtk-launch nheko || gtk-launch io.element.Element'
  cmd: 'for_window [con_id="{result}"] focus; move container to workspace 2'
  match: '(if (or (match "Electron") (match "nheko")) (load ".container.id") F)'
- run: 'exec gtk-launch thunderbird'
  cmd: 'for_window [con_id="{result}"] focus; move container to workspace 3'
  match: '(match-load "thunderbird")'
- run: 'exec nm-applet --indicator'
- run: 'exec blueman-applet'
- run: 'exec gtk-launch org.kde.kdeconnect.nonplasma'
- run: 'exec gtk-launch syncthing-gtk'

Configuration

The configuration file is in YAML format.

Configuration

timeout: int

Optional Default 3000

Total program timeout in ms.

init: String

Optional Default ""

Initialization program; Used to initialize the environment, useful to define custom functions which should be available everywhere.

cmd: String

Optional Default ""

A final i3 command to be executed before exiting.

programs: List[Union[Program, Signal]]

Optional Default []

A list of programs to execute.

Program

Launch all programs using run and execute cmd once match matches a window.

match: String

Required

A lisp program which analyzes the i3 window event and returns a value. If the return value is false the window does not match and no further processing occurs. Otherwise the i3 command cmd. will be executed.

cmd: String

Required

A i3 command. Can contain a format {result} which gets replaced by the output of the match command.

Example:

for_window [con_id="{result}"] focus; move container to window 1

run: String

Optional Default null

A i3 command which is run at program startup, can be used to launch programs.

Example:

exec gtk-launch firefox

Signal

Programs are launched in order and only advance after timeout or after receiving signal SIGUSR1.

run: String

Optional Default null

A i3 command.

timeout: int

Optional Default 500

How long to wait for the signal in ms.