yambar/modules
Daniel Eklöf 73ccafdade
module/i3: fix regression in handling of persistent workspaces
bbd2394601 added support for ‘rename’
and ‘move’ events. In order to do that, it changed how workspace
events are matched against our internal workspace list: from string
comparing the workspace name, to checking i3/sway’s workspace ID
parameter.

This introduced a regression in our handling of persistent
workspaces. A persistent workspace is one that isn’t removed from the
bar when it’s deleted (empty, and switched away from) by i3/sway.

This concept doesn’t exist in i3/sway, but is something we’ve
added. Put simple, the way we do this is be keeping the workspace in
our list, even when i3/sway tells us it has been deleted.

However, at this point the workspace doesn’t have an ID anymore. And
the same is true at startup; when we initialize the persistent
workspaces, we only have their names. Not their IDs (since the
workspaces don’t actually exist yet).

To this the regression, we need to:

a) fallback to looking up workspaces by name. That is, if we fail to
  find one with a matching ID, try again using the workspace name. For
  _this_ to match, we also required the matched workspace to be a
  persistent workspace, with an ID < 0 (which essentially means the
  workspace doesn’t exist yet).

b) reset the ID to -1 when a persistent workspace is "deleted".

Closes #253
2022-12-28 15:21:46 +01:00
..
alsa.c module: const:ify ‘module’ argument to module->description() 2022-12-14 12:05:17 +01:00
backlight.c module: const:ify ‘module’ argument to module->description() 2022-12-14 12:05:17 +01:00
battery.c modules: change min poll interval from 500ms to 250ms 2022-12-27 13:20:31 +01:00
clock.c module: const:ify ‘module’ argument to module->description() 2022-12-14 12:05:17 +01:00
cpu.c modules: change min poll interval from 500ms to 250ms 2022-12-27 13:20:31 +01:00
disk-io.c modules: change min poll interval from 500ms to 250ms 2022-12-27 13:20:31 +01:00
dwl.c module/dwl: correctly handle the title 2022-12-28 15:19:11 +01:00
foreign-toplevel.c module: const:ify ‘module’ argument to module->description() 2022-12-14 12:05:17 +01:00
i3-common.c modules: Implement workspace move event 2022-12-13 16:21:55 +01:00
i3-common.h modules: Implement workspace move event 2022-12-13 16:21:55 +01:00
i3-ipc.h module/i3: use our own copy of i3/ipc.h 2019-03-31 12:08:44 +02:00
i3.c module/i3: fix regression in handling of persistent workspaces 2022-12-28 15:21:46 +01:00
label.c module: const:ify ‘module’ argument to module->description() 2022-12-14 12:05:17 +01:00
mem.c modules: change min poll interval from 500ms to 250ms 2022-12-27 13:20:31 +01:00
meson.build modules: meson: add missing ‘m’ (math) dependency 2022-12-17 18:26:25 +01:00
mpd.c module: const:ify ‘module’ argument to module->description() 2022-12-14 12:05:17 +01:00
network.c modules: change min poll interval from 500ms to 250ms 2022-12-27 13:20:31 +01:00
pipewire.c module/pipewire: disable debug logging 2022-12-17 18:26:31 +01:00
pulse.c module: const:ify ‘module’ argument to module->description() 2022-12-14 12:05:17 +01:00
removables.c module: const:ify ‘module’ argument to module->description() 2022-12-14 12:05:17 +01:00
river.c module: const:ify ‘module’ argument to module->description() 2022-12-14 12:05:17 +01:00
script.c modules: change min poll interval from 500ms to 250ms 2022-12-27 13:20:31 +01:00
sway-xkb.c module: const:ify ‘module’ argument to module->description() 2022-12-14 12:05:17 +01:00
xkb.c module: const:ify ‘module’ argument to module->description() 2022-12-14 12:05:17 +01:00
xwindow.c module: const:ify ‘module’ argument to module->description() 2022-12-14 12:05:17 +01:00