hyprland-community / hyprland-autoname-workspaces

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

Autoname workspaces with null class window #61

Closed funkthew0rld closed 1 year ago

funkthew0rld commented 1 year ago

Problem is specific to Spotify binary when launched with spotify-launcher when set to run in wayland.

The resulting window class is null, and naming is done on class alone.

The window when running in xwayland has a class, but looks awful on hidpi displays.

With no class, you can’t even set an icon based on title alone, or if you can, I couldn’t figure it out.

cyrinux commented 1 year ago

Hi, Can you show me a hyprctl clients -j please of what you say? Also, do you run hyprland-git or the stable one?

funkthew0rld commented 1 year ago

Using hyprland from arch repos

{ "address": "0x558163dabf10", "mapped": true, "hidden": false, "at": [647, 42], "size": [621, 746], "workspace": { "id": 1, "name": "1: <span foreground='red'></span>" }, "floating": false, "monitor": 0, "class": "", "title": "Spotify", "initialClass": "", "initialTitle": "Spotify", "pid": 655, "xwayland": false, "pinned": false, "fullscreen": false, "fullscreenMode": 0, "fakeFullscreen": false, "grouped": [], "swallowing": null }

cyrinux commented 1 year ago

Will give you the snippet later after testing but you can do a rule already for this in theory.

cyrinux commented 1 year ago

You can do this:

Use title with null class ^$.

[title."^$"]
"(?i)spotify" = "spotify"

Is-it ok for you ?

funkthew0rld commented 1 year ago

Unfortunately that doesn’t work. Switch’s to your example config file and it actually shows as a blank workspace in that situation. I didn’t have that stylized in my config, so I couldn’t have known that before.

😓

cyrinux commented 1 year ago

Hi, about the styling it's just a example,  does it work without the span?

funkthew0rld commented 1 year ago

I tried without the span. The workspace with the Spotify window shows up as an empty workspace when this line is in my config . workspace_empty = "<b><span color='yellow'>{id}:</span></b>{delim}{clients}"

cyrinux commented 1 year ago

What version do you have? I can't reproduce in a unit test.

$ hyprland-autoname-workspaces -V

Can you also share me your full config please ?

$ hyprland-autoname-workspaces --dump
funkthew0rld commented 1 year ago

When trying last night I updated to 1.0.0. I’m not by the computer right now, but I used the config example from this project and added the title.”^$” section you suggested above.

Anomalocaridid commented 1 year ago

I am having the exact same issue with Spotify. It has no class or initial class and if it is alone in a workspace, hyprland-autoname-workspaces thinks its workspace is empty. The snippet you provided does not work for me.

version: hyprland-autoname-workspaces 1.1.0

full config:

{
  "version": "1.1.0",
  "class": {
    "DEFAULT": "",
    "[Ff]irefox": "",
    "blueman-manager": "",
    "nyxt": "󰖟",
    "org.pwmt.zathura": "",
    "pavucontrol": "󰕾",
    "lutris": "",
    ".yubioath-flutter-wrapped_": "󰌋",
    "org.keepassxc.KeePassXC": "󰌋",
    "org.wezfurlong.wezterm": "",
    "FreeTube": "",
    "steam": "󰓓",
    "virt-manager": "󰍺"
  },
  "class_active": {},
  "initial_class": {},
  "initial_class_active": {},
  "workspaces_name": {},
  "title_in_class": {},
  "title_in_class_active": {},
  "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": "(Friends List.*|^$)"
  },
  "format": {
    "dedup": true,
    "dedup_inactive_fullscreen": true,
    "delim": " ",
    "workspace": "{name}:{delim}{clients}",
    "workspace_empty": "{name}",
    "client": "{icon}",
    "client_fullscreen": "[{icon}]",
    "client_active": "*{icon}*",
    "client_dup": "{icon}{counter_sup}",
    "client_dup_active": "*{icon}*{delim}{icon}{counter_unfocused_sup}",
    "client_dup_fullscreen": "[{icon}]{delim}{icon}{counter_unfocused_sup}"
  }
}

Also, in case it is relevant, my Linux distro is NixOS with nixpkgs unstable and I am using eww as my bar.

Edit: I just realized that the title table does not show up here, even though I did not remove the snippet you provided. Is this normal?

cyrinux commented 1 year ago

@Anomalocaridid Can you do a hyprctl clients -j while spotify running please? Also, since the issue is open, the config format change, the snippet i give should be now:

[title_in_class."^$"]
"(?i)spotify" = "spotify"
Anomalocaridid commented 1 year ago

The updated snippet does not work.

Output of hyprctl clients -j with Spotify running:

[{
    "address": "0x1997d40",
    "mapped": true,
    "hidden": false,
    "at": [22, 60],
    "size": [1316, 686],
    "workspace": {
        "id": 3,
        "name": "3"
    },
    "floating": false,
    "monitor": 0,
    "class": "",
    "title": "Spotify",
    "initialClass": "",
    "initialTitle": "Spotify",
    "pid": 141892,
    "xwayland": false,
    "pinned": false,
    "fullscreen": false,
    "fullscreenMode": 0,
    "fakeFullscreen": false,
    "grouped": [],
    "swallowing": null
},{
    "address": "0x19f39b0",
    "mapped": true,
    "hidden": false,
    "at": [22, 60],
    "size": [1316, 686],
    "workspace": {
        "id": 1,
        "name": "1: **"
    },
    "floating": false,
    "monitor": 0,
    "class": "org.wezfurlong.wezterm",
    "title": "~",
    "initialClass": "org.wezfurlong.wezterm",
    "initialTitle": "wezterm",
    "pid": 144479,
    "xwayland": false,
    "pinned": false,
    "fullscreen": false,
    "fullscreenMode": 0,
    "fakeFullscreen": false,
    "grouped": [],
    "swallowing": null
}]
cyrinux commented 1 year ago

Thanks for the info, I will debug this asap.

cyrinux commented 1 year ago

@Anomalocaridid @funkthew0rld I finally think I find the bug, can you please try again with the main branch before I do a release ?

cyrinux commented 1 year ago

I am confident in my fix and did a release 1.1.1 🤞🏻

Anomalocaridid commented 1 year ago

I cloned the repo and ran it with cargo run and it looks like it works for me! Thank you!

funkthew0rld commented 1 year ago

yup, it works now!

thanks @cyrinux