MichaelAquilina / improved-workspace-indicator

gnome-shell extension that provides a workspace indicator similar to i3/sway
42 stars 12 forks source link

Workspaces incorrectly show as active when using DING #3

Closed koin612 closed 2 years ago

koin612 commented 3 years ago

hey,

on the readme it says 'it shows all in use workspaces' and shows a screenshot of workspace 1,2 and 9. I'm trying to archive something similar and was about to create a PR which hides workspace indicators for workspaces with no windows. But the readme makes me think that this extension can handle this already, and maybe my usage and settings of gnome workspaces is wrong.

im running gnome settings:

is there a way to make it behave like in the readme or work with gnome workspaces dynamically like in i3?

MichaelAquilina commented 3 years ago

a PR which hides workspace indicators for workspaces with no windows. But the readme makes me think that this extension can handle this already

This is meant to be how it works now.

What version of Gnome are you using? Could you send a screenshot of how the indicator looks now?

koin612 commented 3 years ago

I'm using GNOME 3.38.3 on X11

Screenshot from 2021-06-01 13-05-03

Workspaces 1-4 are populated with windows and 5-10 are currently empty.

Edit: when I run global.workspace_manager.get_workspace_by_index(9).list_windows() in alt+f2 -> lg window, I get 3 MetaWindowX11 windows, so the condition to hide this WorkspaceIndicator fails, but I don't know anything about GNOME/X11 to continue from here. Currently I'm using PopOS with their pop shell, maybe there are some invisible windows to handle stuff like their tiling/resizing overlays? On populated workspaces I get the a length of 4 (even if there are more or less windows) and unpopulated workspaces it's always 3 (there is none).

MichaelAquilina commented 3 years ago

I'm also using the pop shell extension so I don't think that is it.

Could you extract more information from those windows? Maybe there's a visible property of some kind we can take advantage of to filter these out.

I'll be able to provide better instructions when I'm back on my machine tomorrow if you can't figure it out yourself

koin612 commented 3 years ago

I narrowed it down to the Built-In extension Desktop Icons NG (DING). If I disable this extension everything works as intended. I've cleared all Desktop Icons and now every empty workspace has just 1 Window if the extension is enabled and 0 if its disabled.

I tried a bit to find how to navigate the method from previous post and find some window properties to identify windows created by the extension but I'm not able to find workspace/window api documentation and searching gnome shell source code was frustrating :joy:

ShrirajHegde commented 3 years ago

I have the same problem with DING, the ability to ignore DING window would be great

hakumaku commented 3 years ago

The issue seems to be not only related to DING but also other seanky apps, in my case, such as plank. (well, not sure if there is more) It would be better to provide some kind of "excluded" to users, so that one can find out wm_class and add it to the list.

if (this.active) {
  this.show();
} else if (this.workspace.list_windows().length == 0) {
  this.hide();
} else {
  let count = 0;
  for (const win of this.workspace.list_windows()) {
    if (win.wm_class == "Plank") { // and more...
      ++count;
    }
  }
  if (this.workspace.list_windows().length - count == 0) {
    this.hide();
  } else {
    this.show();
  }
}

I changed the code like this and things are working as expected. I've never learned js, definitely sure there is something wrong with the code though...

MichaelAquilina commented 3 years ago

It might be that we have to maintain a hardcoded list of applications that exhibit this behaviour.

Ideally we are able to figure this out automatically through some other attribute though.

MichaelAquilina commented 2 years ago

Closing this issue as I believe it was fixed in the PR linked in this ticket. Let me know if you think it should be reopened