The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
1

how to define a command to kill all terminals in current workspace

asked Oct 21 '14

sylecn gravatar image

Sometimes I want to kill all terminals in one workspace. When there are only terminals in the workspace, I keep pressing kill windows's hotkey repeatly.

Is there a programmable interface to define such command myself? Find windows matching some condition (class/title/on-workspace), then run some action on them (e.g. kill them).

1 answer

Sort by » oldest newest most voted
0

answered Oct 21 '14

TonyC gravatar image

You could write a script, such as with i3ipc-glib, like this:

from gi.repository import i3ipc

i3 = i3ipc.Connection()

for con in i3.get_tree().find_focused().workspace().find_classed('URxvt'):
    con.command('kill')

Comments

That's the kind of information I was looking for. Thanks.

sylecn gravatar imagesylecn (Oct 21 '14)edit

Question Tools

Stats

Asked: Oct 21 '14

Seen: 181 times

Last updated: Oct 21 '14