Aylur / dotfiles

My personal config files
Other
2.18k stars 117 forks source link

Current workspace indicator sometimes shows incorrect workspace #241

Open mechakotik opened 1 week ago

mechakotik commented 1 week ago

When changing workspace, current workspace indicator not always shifts to new workspace. It only happens when you switch from / to occupied workspace, it always works when switching between two empty workspaces. Hyprland 0.39.1 (also tested with 0.41.1), AGS 1.8.2.

lucasile commented 6 days ago

Had this issue for a while rocking Fedora. Checked out their discord and asked for help and found out its likely a Fedora-Hyprland issue. Share any errors you get when this happens, as well as your distro.

mechakotik commented 5 days ago

I m running Gentoo. AGS shows warnings like this when bug happens:

(com.github.Aylur.ags:31601): Gjs-WARNING **: 15:56:21.740: JS ERROR: Gio.IOErrorEnum: Could not connect: Resource temporarily unavailable
_connection@resource:///com/github/Aylur/ags/service/hyprland.js:127:14
_socketStream@resource:///com/github/Aylur/ags/service/hyprland.js:145:33
messageAsync@resource:///com/github/Aylur/ags/service/hyprland.js:170:43
_syncMonitors@resource:///com/github/Aylur/ags/service/hyprland.js:186:36
_onEvent@resource:///com/github/Aylur/ags/service/hyprland.js:239:32
_watchSocket/<@resource:///com/github/Aylur/ags/service/hyprland.js:134:18
_init/GLib.MainLoop.prototype.runAsync/</<@resource:///org/gnome/gjs/modules/core/overrides/GLib.js:266:34
lucasile commented 5 days ago

Yup same exact issue.

This is the conclusion that we found out.

image

I wasn't able to find a fix to it after a lot of debugging, but I was able to apply a disgusting solution where I try updating all the workspaces on every Hyprland event... that way there's a very small chance that this issue occurs. If you find a solution please let me know :)

Something like this in Workspaces.ts

setup: (box) => {
      // this is very bad but it works around this stupid resource temporarily unavailable bug
      box.hook(Hyprland, () => {
        const activeId = JSON.parse(Hyprland.message("j/monitors"))[0]
          .activeWorkspace.id;

        box.children.map((btn) => {
          btn.toggleClassName("active", btn.attribute === activeId);

          if (ws === 0) {
            btn.visible = Hyprland.workspaces.some(
              (ws) => ws.id === btn.attribute,
            );
          }
        });
      });
    },