hyprland-community / hyprland-autoname-workspaces

Hyprland autoname workspaces 🪟 [maintainers=@cyrinux,@maximbaz]
ISC License
199 stars 7 forks source link

[BUG] Changes in workspace names no longer reflected in waybar when using "hyprland/workspaces" #99

Closed XavierChB closed 1 year ago

XavierChB commented 1 year ago

Describe the bug Waybar has recently merged the "hyprland/workspaces" module into the new release, and as of my experiment with hyprland version 0.29.1, the old "wlr/workspaces" module no longer works for hyprland on waybar, so I will be forced to switch to the hyprland workspaces module when I eventually upgrade my local hyprland.

When using the new hyprland workspaces module, the workspace name is no longer dynamically updated when a new window is opened or closed, even though when I run waybar --log-level trace Hyprland IPC is still sending the correct event including the updated workspace names.

image

The updates are only reflected when I manually reload waybar (i.e. pkill waybar && hyprctl dispatch exec waybar).

This could be a bug with the hyprland/workspaces module, please let me know how I can raise an issue there, including what specifically needs to be implemented, etc. Many thanks!

Program version?

hyprland-autoname-workspaces 1.1.7

Program configuration dump? (ideally)

{
  "version": "1.1.7",
  "class": {
    "(?i)bluetooth": "",
    "(?i)control": "",
    "(?i)zathura": "",
    "(?i)kitty": "",
    "(?i)calibre": "",
    "(?i)[ck]alculator": "",
    "(?i)FFPWA": "",
    "(?i)dolphin": "",
    "(?i)Zoom": "",
    "(?i)chrom.*": "",
    "(?i)explorer.exe": "󰍲",
    "(?i)edit": "",
    "[Ss]team": "",
    "[(thunder)(Thunder)(better)(Better)]bird": "",
    "(?i)slack": "󰒱",
    "(?i)xournal": "󱞂",
    "(?i)wechat": "",
    "(?i)wine.*": "󰍲",
    "(?i)plan": "",
    "(?i)firefox": "",
    "Spotify": "",
    "DEFAULT": "",
    "(?i)settings": "",
    "(?i)config": "",
    "com.obsproject*": "<span foreground='#DD0000'>󰻂</span>"
  },
  "class_active": {
    "[Ff]irefox": "<span foreground='#d64000'></span>"
  },
  "initial_class": {},
  "initial_class_active": {},
  "workspaces_name": {},
  "title_in_class": {
    "(?i)explorer.exe": {
      "(?i)wechat": ""
    },
    "(?i)firefox": {
      "(?i)youtube": " ꟳ",
      "(?i)spotify": " ꟳ",
      "(?i)github": " ꟳ"
    },
    "(?i)FFPWA": {
      "(?i)[Oo]utlook": "󰴢",
      "(?i)[Yy]outube": "",
      "(?i)WhatsApp": "",
      "(?i)[Tt]eams": ""
    },
    "[(thunder)(Thunder)(better)(Better)]bird": {
      "(?i)Task": ""
    },
    "(?i)kitty": {
      "(?i)vim": "",
      "(?i)top": ""
    }
  },
  "title_in_class_active": {
    "(?i)kitty": {
      "(?i)vim": "<span foreground='#427b58'></span>",
      "(?i)top": "<span foreground='#9d0006'></span>"
    },
    "(?i)FFPWA": {
      "(?i)[Yy]outube": "",
      "(?i)[Tt]eams": "",
      "(?i)[Oo]utlook": "󰴢",
      "(?i)WhatsApp": "<span foreground='#25D366'></span>"
    },
    "(?i)firefox": {
      "(?i)youtube": "<span foreground='#FF0000'> </span>ꟳ",
      "(?i)spotify": "<span foreground='#1DB954'> </span>ꟳ",
      "(?i)github": " ꟳ"
    }
  },
  "title_in_initial_class": {},
  "title_in_initial_class_active": {},
  "initial_title_in_class": {},
  "initial_title_in_class_active": {},
  "initial_title_in_initial_class": {},
  "initial_title_in_initial_class_active": {},
  "exclude": {
    "": "^$",
    "[Ss]team": "^$",
    "(?i)fcitx": ".*",
    "(?i)TestApp": ""
  },
  "format": {
    "dedup": true,
    "dedup_inactive_fullscreen": true,
    "delim": " ",
    "workspace": "{id} {clients}",
    "workspace_empty": "{id}",
    "client": "{icon}{delim}",
    "client_fullscreen": "<span color='#8f3f71'>{icon}</span>",
    "client_active": "<span color='#458588'>{icon}</span>",
    "client_dup": "{client}{counter_sup}{delim}",
    "client_dup_active": "*{icon}*{delim}{icon}{counter_unfocused_sup}",
    "client_dup_fullscreen": "[{icon}]{delim}<>{icon}{counter_unfocused}{delim}"
  }
}

To Reproduce Steps to reproduce the behavior:

  1. Update waybar to v0.9.22 or higher.
  2. Configure waybar to use the module "hyprland/workspaces" to display the workspaces.
  3. Launch waybar.
  4. Open/Close windows that should be reflected in the workspace name generated by hyplrand-autoname-workspaces.
  5. See error.

Expected behavior Workspace name generated by hyprland-autoname-workspaces correctly reflected on waybar.

Linux Distro (please complete the following information):

OS: Arch Linux x86_64 Kernel: 6.4.12-arch1-1 Hyprland: v0.29.0 Waybar: v0.9.22

edit: fixed typos

maximbaz commented 1 year ago

Hello, it has been fixed yesterday in waybar's module, try to build waybar from master 👍

euglevi commented 1 year ago

I also had this issue and I have been re-installing waybar from master today. Even with the new installation, the updates are only reflected when I manually reload waybar. Has the format I need to configure the module in waybar changed?

maximbaz commented 1 year ago

The change in waybar depends on the change made in hyprland, which was also done on the same day, so you actually need to compile both from latest code, sorry I forgot to mention it earlier!

Other than that, the default format of hyprland/workspaces is {id} and you need to change it to {name}, but since you see some names after waybar restart, I suppose you did it...

XavierChB commented 1 year ago

The change in waybar depends on the change made in hyprland, which was also done on the same day, so you actually need to compile both from latest code, sorry I forgot to mention it earlier!

Other than that, the default format of hyprland/workspaces is {id} and you need to change it to {name}, but since you see some names after waybar restart, I suppose you did it...

Hi I've just compiled both hyprland and waybar with the latest git master version. The good news is that the "renameworkspace" IPC event is now both correctly generated by hyprland IPC and handled by waybar, so if I run hyprctl dispatch renameworkspace 1 "xxx" the changes are correctly reflected on waybar. The bad news is, hyprland-autoname-workspaces itself stops working:

$ env RUST_BACKTRACE=full hyprland-autoname-workspaces
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: SerdeError(Error("invalid value: integer `18446744073709551615`, expected i16", line: 12, column: 35))', src/renamer/mod.rs:278:34
stack backtrace:
   0:     0x560b6f524c51 - <unknown>
   1:     0x560b6f54c8ec - <unknown>
   2:     0x560b6f5219ce - <unknown>
   3:     0x560b6f524a65 - <unknown>
   4:     0x560b6f5261fa - <unknown>
   5:     0x560b6f525e93 - <unknown>
   6:     0x560b6f5267fb - <unknown>
   7:     0x560b6f5266f7 - <unknown>
   8:     0x560b6f5250b6 - <unknown>
   9:     0x560b6f526442 - <unknown>
  10:     0x560b6f334623 - <unknown>
  11:     0x560b6f334a83 - <unknown>
  12:     0x560b6f3447b4 - <unknown>
  13:     0x560b6f3704e2 - <unknown>
  14:     0x560b6f367453 - <unknown>
  15:     0x560b6f3713f9 - <unknown>
  16:     0x560b6f51be0b - <unknown>
  17:     0x560b6f370bf5 - <unknown>
  18:     0x7f29d6827cd0 - <unknown>
  19:     0x7f29d6827d8a - __libc_start_main
  20:     0x560b6f334d45 - <unknown>
  21:                0x0 - <unknown>
pbosab commented 1 year ago

Other than that, the default format of hyprland/workspaces is {id} and you need to change it to {name}

@cyrinux I think this should be placed here, just to prevent questions...

cyrinux commented 1 year ago

Sure, feel free to a quick PR for this or I will do when I can, thanks! edit: done

pbosab commented 1 year ago

cyrinux you man are too fast. good job.

btw, i'm having the same issue as XavierChB, just to add to the report, maybe can help:

❯ hyprctl workspaces
workspace ID 2 (<b><span>2<tt> </tt></span></b>) on monitor DVI-D-1:
        windows: 1
        hasfullscreen: 0
        lastwindow: 0x0
        lastwindowtitle:

workspace ID 1 (1) on monitor HDMI-A-1:
        windows: 4
        hasfullscreen: 0
        lastwindow: 0x55cf84dd73a0
        lastwindowtitle: ~

edit: forgot to add that happens with my config and even the default found on the site.

cyrinux commented 1 year ago

I will try to check this evening for the error, I have to patch hyprland-rs maybe. @pbosab @XavierChB a dump of hyprctl clients -j can help when the crash occurs please.

cyrinux commented 1 year ago

Hmm I finally reproduce, I think its the type of monitor field that change.

Window 558853a05b70 -> :
    mapped: 0
    hidden: 0
    at: 0,0
    size: 0,0
    workspace: -1 ()
    floating: 0
    monitor: 18446744073709551615
    class:
    title:
    initialClass:
    initialTitle:
    pid: 0
    xwayland: 1
    pinned: 0
    fullscreen: 0
    fullscreenmode: 0
    fakefullscreen: 0
    grouped: 0
    swallowing: 0
cyrinux commented 1 year ago

I make a fix but I will have to do a release of hyprland-rs, please be patient.

pbosab commented 1 year ago

I will try to check this evening for the error, I have to patch hyprland-rs maybe. @pbosab @XavierChB a dump of hyprctl clients -j can help when the crash occurs please.

just got back to the pc but

I make a fix but I will have to do a release of hyprland-rs, please be patient.

seems like you already fixed it as always. gj

XavierChB commented 1 year ago
$ hyprland-autoname-workspaces
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: SerdeError(Error("invalid value: integer `18446744073709551615`, expected i16", line: 12, column: 35))', src/renamer/mod.rs:278:34
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
$ hyprctl clients -j
[{
    "address": "0x55f4b0a401c0",
    "mapped": false,
    "hidden": false,
    "at": [0, 0],
    "size": [0, 0],
    "workspace": {
        "id": -1,
        "name": ""
    },
    "floating": false,
    "monitor": 18446744073709551615,
    "class": "",
    "title": "",
    "initialClass": "",
    "initialTitle": "",
    "pid": 0,
    "xwayland": true,
    "pinned": false,
    "fullscreen": false,
    "fullscreenMode": 0,
    "fakeFullscreen": false,
    "grouped": [],
    "swallowing": "0x0"
},{
    "address": "0x55f4b0a41690",
    "mapped": false,
    "hidden": false,
    "at": [0, 0],
    "size": [0, 0],
    "workspace": {
        "id": -1,
        "name": ""
    },
    "floating": false,
    "monitor": 18446744073709551615,
    "class": "",
    "title": "",
    "initialClass": "",
    "initialTitle": "",
    "pid": 0,
    "xwayland": true,
    "pinned": false,
    "fullscreen": false,
    "fullscreenMode": 0,
    "fakeFullscreen": false,
    "grouped": [],
    "swallowing": "0x0"
},{
    "address": "0x55f4b2a577c0",
    "mapped": false,
    "hidden": false,
    "at": [0, 0],
    "size": [0, 0],
    "workspace": {
        "id": -1,
        "name": ""
    },
    "floating": false,
    "monitor": 18446744073709551615,
    "class": "",
    "title": "",
    "initialClass": "",
    "initialTitle": "",
    "pid": 0,
    "xwayland": true,
    "pinned": false,
    "fullscreen": false,
    "fullscreenMode": 0,
    "fakeFullscreen": false,
    "grouped": [],
    "swallowing": "0x0"
},{
    "address": "0x55f4b2a138b0",
    "mapped": false,
    "hidden": false,
    "at": [0, 0],
    "size": [0, 0],
    "workspace": {
        "id": -1,
        "name": ""
    },
    "floating": false,
    "monitor": 18446744073709551615,
    "class": "",
    "title": "",
    "initialClass": "",
    "initialTitle": "",
    "pid": 0,
    "xwayland": true,
    "pinned": false,
    "fullscreen": false,
    "fullscreenMode": 0,
    "fakeFullscreen": false,
    "grouped": [],
    "swallowing": "0x0"
},{
    "address": "0x55f4b2ab7200",
    "mapped": true,
    "hidden": false,
    "at": [1611, 45],
    "size": [2538, 1384],
    "workspace": {
        "id": 1,
        "name": "1"
    },
    "floating": false,
    "monitor": 0,
    "class": "kitty",
    "title": "hyprctl clients -j",
    "initialClass": "kitty",
    "initialTitle": "zsh",
    "pid": 8086,
    "xwayland": false,
    "pinned": false,
    "fullscreen": false,
    "fullscreenMode": 0,
    "fakeFullscreen": false,
    "grouped": [],
    "swallowing": "0x0"
}]

@cyrinux There you go. Yeah just as you have pointed out the monitor field is causing the int overflow.

cyrinux commented 1 year ago

Thanks, same error as I was able to find so, all good, hyprland move fast and there is often breaking like this, its not related to autoname but as a side project its impacted with some breaking change 😄 , fix will be merge and release done then.

yavko commented 1 year ago

I make a fix but I will have to do a release of hyprland-rs, please be patient.

PR merged

XavierChB commented 1 year ago

After changing the hyprland dependency in Cargo.toml to the latest git version, I can confirm that hyprland-autoname-workspaces now work as intended. Should I close the issue or should I wait for the cargo dependency list to be updated accordingly?

cyrinux commented 1 year ago

I just make a release, thanks you guys.

XavierChB commented 1 year ago

Guys it's me again. This time I've got some workspace with id -1.

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: SerdeError(Error("invalid value: integer `-1`, expected u64", line: 12, column: 17))', src/renamer/mod.rs:278:34

running hyprctl clients -j gives:

[{
    "address": "0x55c8106f75f0",
    "mapped": false,
    "hidden": false,
    "at": [0, 0],
    "size": [0, 0],
    "workspace": {
        "id": -1,
        "name": ""
    },
    "floating": false,
    "monitor": -1,
    "class": "",
    "title": "",
    "initialClass": "",
    "initialTitle": "",
    "pid": 0,
    "xwayland": true,
    "pinned": false,
    "fullscreen": false,
    "fullscreenMode": 0,
    "fakeFullscreen": false,
    "grouped": [],
    "swallowing": "0x0"
},{
    "address": "0x55c8106fc220",
    "mapped": false,
    "hidden": false,
    "at": [0, 0],
    "size": [0, 0],
    "workspace": {
        "id": -1,
        "name": ""
    },
    "floating": false,
    "monitor": -1,
    "class": "",
    "title": "",
    "initialClass": "",
    "initialTitle": "",
    "pid": 0,
    "xwayland": true,
    "pinned": false,
    "fullscreen": false,
    "fullscreenMode": 0,
    "fakeFullscreen": false,
    "grouped": [],
    "swallowing": "0x0"
},{
    "address": "0x55c8106feed0",
    "mapped": false,
    "hidden": false,
    "at": [0, 0],
    "size": [0, 0],
    "workspace": {
        "id": -1,
        "name": ""
    },
    "floating": false,
    "monitor": -1,
    "class": "",
    "title": "",
    "initialClass": "",
    "initialTitle": "",
    "pid": 0,
    "xwayland": true,
    "pinned": false,
    "fullscreen": false,
    "fullscreenMode": 0,
    "fakeFullscreen": false,
    "grouped": [],
    "swallowing": "0x0"
},{
    "address": "0x55c8107003a0",
    "mapped": true,
    "hidden": false,
    "at": [11, 45],
    "size": [1578, 944],
    "workspace": {
        "id": 5,
        "name": "5"
    },
    "floating": false,
    "monitor": 0,
    "class": "kitty",
    "title": "xxx@xxx:~",
    "initialClass": "kitty",
    "initialTitle": "zsh",
    "pid": 50697,
    "xwayland": false,
    "pinned": false,
    "fullscreen": false,
    "fullscreenMode": 0,
    "fakeFullscreen": false,
    "grouped": [],
    "swallowing": "0x0"
},{
    "address": "0x55c810710ca0",
    "mapped": true,
    "hidden": false,
    "at": [1611, 11],
    "size": [2538, 1418],
    "workspace": {
        "id": 1,
        "name": "1 <span foreground='#d64000'></span>"
    },
    "floating": false,
    "monitor": 1,
    "class": "firefox",
    "title": "[BUG] Changes in workspace names no longer reflected in waybar when using \"hyprland/workspaces\" · Issue #99 · hyprland-community/hyprland-autoname-workspaces — Mozilla Firefox",
    "initialClass": "firefox",
    "initialTitle": "Mozilla Firefox",
    "pid": 49236,
    "xwayland": false,
    "pinned": false,
    "fullscreen": false,
    "fullscreenMode": 0,
    "fakeFullscreen": false,
    "grouped": [],
    "swallowing": "0x0"
}]

Would it make sense to change it to i64 instead?

yavko commented 1 year ago

Guys it's me again. This time I've got some workspace with id -1.

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: SerdeError(Error("invalid value: integer `-1`, expected u64", line: 12, column: 17))', src/renamer/mod.rs:278:34

running hyprctl clients -j gives:

[{
    "address": "0x55c8106f75f0",
    "mapped": false,
    "hidden": false,
    "at": [0, 0],
    "size": [0, 0],
    "workspace": {
        "id": -1,
        "name": ""
    },
    "floating": false,
    "monitor": -1,
    "class": "",
    "title": "",
    "initialClass": "",
    "initialTitle": "",
    "pid": 0,
    "xwayland": true,
    "pinned": false,
    "fullscreen": false,
    "fullscreenMode": 0,
    "fakeFullscreen": false,
    "grouped": [],
    "swallowing": "0x0"
},{
    "address": "0x55c8106fc220",
    "mapped": false,
    "hidden": false,
    "at": [0, 0],
    "size": [0, 0],
    "workspace": {
        "id": -1,
        "name": ""
    },
    "floating": false,
    "monitor": -1,
    "class": "",
    "title": "",
    "initialClass": "",
    "initialTitle": "",
    "pid": 0,
    "xwayland": true,
    "pinned": false,
    "fullscreen": false,
    "fullscreenMode": 0,
    "fakeFullscreen": false,
    "grouped": [],
    "swallowing": "0x0"
},{
    "address": "0x55c8106feed0",
    "mapped": false,
    "hidden": false,
    "at": [0, 0],
    "size": [0, 0],
    "workspace": {
        "id": -1,
        "name": ""
    },
    "floating": false,
    "monitor": -1,
    "class": "",
    "title": "",
    "initialClass": "",
    "initialTitle": "",
    "pid": 0,
    "xwayland": true,
    "pinned": false,
    "fullscreen": false,
    "fullscreenMode": 0,
    "fakeFullscreen": false,
    "grouped": [],
    "swallowing": "0x0"
},{
    "address": "0x55c8107003a0",
    "mapped": true,
    "hidden": false,
    "at": [11, 45],
    "size": [1578, 944],
    "workspace": {
        "id": 5,
        "name": "5"
    },
    "floating": false,
    "monitor": 0,
    "class": "kitty",
    "title": "xxx@xxx:~",
    "initialClass": "kitty",
    "initialTitle": "zsh",
    "pid": 50697,
    "xwayland": false,
    "pinned": false,
    "fullscreen": false,
    "fullscreenMode": 0,
    "fakeFullscreen": false,
    "grouped": [],
    "swallowing": "0x0"
},{
    "address": "0x55c810710ca0",
    "mapped": true,
    "hidden": false,
    "at": [1611, 11],
    "size": [2538, 1418],
    "workspace": {
        "id": 1,
        "name": "1 <span foreground='#d64000'></span>"
    },
    "floating": false,
    "monitor": 1,
    "class": "firefox",
    "title": "[BUG] Changes in workspace names no longer reflected in waybar when using \"hyprland/workspaces\" · Issue #99 · hyprland-community/hyprland-autoname-workspaces — Mozilla Firefox",
    "initialClass": "firefox",
    "initialTitle": "Mozilla Firefox",
    "pid": 49236,
    "xwayland": false,
    "pinned": false,
    "fullscreen": false,
    "fullscreenMode": 0,
    "fakeFullscreen": false,
    "grouped": [],
    "swallowing": "0x0"
}]

Would it make sense to change it to i64 instead?

It already is 😛