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 2014-10-21 01:28:01 +0000

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).

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-10-21 02:56:24 +0000

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')
edit flag offensive delete link more

Comments

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

sylecn gravatar imagesylecn ( 2014-10-21 09:50:51 +0000 )edit

Question Tools

Stats

Asked: 2014-10-21 01:28:01 +0000

Seen: 181 times

Last updated: Oct 21 '14