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 2014-12-06 07:14:23 +0000

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

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
1

answered 2014-12-06 22:21:09 +0000

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.

edit flag offensive delete link more

Comments

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

xuhdev gravatar imagexuhdev ( 2014-12-06 22:33:39 +0000 )edit

Question Tools

Stats

Asked: 2014-12-06 07:14:23 +0000

Seen: 1,984 times

Last updated: Dec 06 '14