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

i3 "empty" event: is there a way to get the workspace which is emptied?

asked Dec 6 '14

"empty" event is an event which notifies subscribers that a workspace has its last window closed. However, it does not tell which workspace is closed. Is there a way to know it?

I know a partially useful solution is to always remember the last focused workspace, as in many cases the last focused workspace is new empty workspace. But this is not reliable, since a window can be killed in a workspace that users don't touch.

1 answer

Sort by » oldest newest most voted
1

answered Dec 6 '14

Michael gravatar image

Send a patch to http://cr.i3wm.org/ which modifies i3 to include it. src/con.c:1376 is where the event is generated currently, but you’ll need to switch from a hard-coded string to actually JSON-encoding the workspace title — see the other events.

I think a reasonable workaround is to store a list of workspaces, refresh that list of workspaces after getting a “"change": "empty"” workspace event and taking the difference between the two lists.

Comments

I actually checked the focus event (which gives additional information), but I don't see the JSON way you mentioned...

xuhdev gravatar imagexuhdev (Dec 6 '14)edit

Question Tools

Stats

Asked: Dec 6 '14

Seen: 1,984 times

Last updated: Dec 06 '14