Open aggrand opened 9 months ago
I have not tried this, but the wiki says, window-rewrite
is against a window's class. Have you checked what Spotify window's class is?
hyprctl workspaces
's lastwindowtitle property really shows the window's title. To get the class, use hyprctl clients
.
@RobertMueller2 thanks for responding! Running hyprctl clients
gets me the following:
Window 34dff80 -> Spotify:
mapped: 1
hidden: 0
at: 7,43
size: 1906,1030
workspace: 3 (3)
floating: 0
monitor: 0
class:
title: Spotify
initialClass:
initialTitle: Spotify
pid: 2970
xwayland: 0
pinned: 0
fullscreen: 0
fullscreenmode: 0
fakefullscreen: 0
grouped: 0
swallowing: 0
focusHistoryID: 2
It looks like the class is empty? I would still expect the default "?" to appear if the empty string is making the match fail. Matching against "^$" doesn't make a difference in the behavior I see.
Yes, the class is empty because it is a Wayland window and not an XWayland window.
I've had a look, the wiki page seems a bit outdated, the manpage has an additional section and this is interesting:
[...]
Rules may specify class<...>
, title<...>
, or both in order to fine-tune the matching.
[...]
I've also had a look at the source code, and I'd have to spend more time to understand how the rewriting works. Right now, I don't have an explanation why you don't see a ?
.
So unless someone can explain it in more detail, perhaps you can try these advanced rewrite rules. If I understand it correctly, "title<Spotify>" : "S"
should work.
@RobertMueller2 that worked for me, thank you so much for taking a look!
Not sure if there's a bug w.r.t. the default not being used in this case but my workflow is fixed; feel free to close the issue or leave open as preferred!
No problem. :)
Looks like a bug to me at first glance, so I'd suggest to keep this open for tracking and further analysis.
Hi there, sorry for coming in late, but thanks @RobertMueller2 to have helped @aggrand reach their desired behavior!
I've had a look, the wiki page seems a bit outdated ...
Great catch! I've updated the Wiki to better reflect the man pages.
About the bug, could I have a screenshot of the bar along with the output of hyprctl clients -j
to better understand why the placeholder didn't kick in? @aggrand
@Syndelis thanks for taking a look!
Here's the output of hyprctl clients -j
:
[{
"address": "0x3692640",
"mapped": true,
"hidden": false,
"at": [967, 37],
"size": [946, 1036],
"workspace": {
"id": 1,
"name": "1"
},
"floating": false,
"monitor": 0,
"class": "firefox",
"title": "hyprland/workspaces rewrite ignores spotify · Issue #2741 · Alexays/Waybar — Mozilla Firefox",
"initialClass": "firefox",
"initialTitle": "Mozilla Firefox",
"pid": 1826,
"xwayland": false,
"pinned": false,
"fullscreen": false,
"fullscreenMode": 0,
"fakeFullscreen": false,
"grouped": [],
"swallowing": "0x0",
"focusHistoryID": 2
},{
"address": "0x368a550",
"mapped": true,
"hidden": false,
"at": [7, 37],
"size": [1906, 1036],
"workspace": {
"id": 2,
"name": "2"
},
"floating": false,
"monitor": 0,
"class": "Emacs",
"title": "config.jsonc – Doom Emacs",
"initialClass": "Emacs",
"initialTitle": "GNU Emacs at personal-laptop",
"pid": 2602,
"xwayland": true,
"pinned": false,
"fullscreen": false,
"fullscreenMode": 0,
"fakeFullscreen": false,
"grouped": [],
"swallowing": "0x0",
"focusHistoryID": 4
},{
"address": "0x368cb90",
"mapped": false,
"hidden": false,
"at": [0, 0],
"size": [0, 0],
"workspace": {
"id": -1,
"name": ""
},
"floating": false,
"monitor": -1,
"class": "",
"title": "",
"initialClass": "",
"initialTitle": "",
"pid": -1,
"xwayland": true,
"pinned": false,
"fullscreen": false,
"fullscreenMode": 0,
"fakeFullscreen": false,
"grouped": [],
"swallowing": "0x0",
"focusHistoryID": -1
},{
"address": "0x36aec60",
"mapped": true,
"hidden": false,
"at": [7, 37],
"size": [1906, 1036],
"workspace": {
"id": 3,
"name": "3"
},
"floating": false,
"monitor": 0,
"class": "",
"title": "Spotify",
"initialClass": "",
"initialTitle": "Spotify",
"pid": 2713,
"xwayland": false,
"pinned": false,
"fullscreen": false,
"fullscreenMode": 0,
"fakeFullscreen": false,
"grouped": [],
"swallowing": "0x0",
"focusHistoryID": 3
},{
"address": "0x36bd7a0",
"mapped": true,
"hidden": false,
"at": [7, 37],
"size": [946, 511],
"workspace": {
"id": 1,
"name": "1"
},
"floating": false,
"monitor": 0,
"class": "foot",
"title": "foot",
"initialClass": "foot",
"initialTitle": "foot",
"pid": 3061,
"xwayland": false,
"pinned": false,
"fullscreen": false,
"fullscreenMode": 0,
"fakeFullscreen": false,
"grouped": [],
"swallowing": "0x0",
"focusHistoryID": 1
},{
"address": "0x36cbff0",
"mapped": true,
"hidden": false,
"at": [7, 562],
"size": [946, 511],
"workspace": {
"id": 1,
"name": "1"
},
"floating": false,
"monitor": 0,
"class": "foot",
"title": "foot",
"initialClass": "foot",
"initialTitle": "foot",
"pid": 7476,
"xwayland": false,
"pinned": false,
"fullscreen": false,
"fullscreenMode": 0,
"fakeFullscreen": false,
"grouped": [],
"swallowing": "0x0",
"focusHistoryID": 0
}]
Here's a screenshot of the bar:
In the above, spotify is open in workspace 3 but isn't visible.
Also here's my config at the time of the screenshot:
"hyprland/workspaces": {
"format": "{icon}: {windows} |",
"format-window-separator": " ",
"window-rewrite-default": "",
"window-rewrite": {
"firefox": "",
//"title<Spotify>" : "",
"Spotify" : "",
"foot": "",
"kitty": "",
"emacs": "",
"discord": "",
"thunderbird": "",
"tor": "",
"orbot": "",
"steam": "",
"signal": "",
"anki": "",
"pavucontrol": ""
},
},
(I had changed the default here, but the behavior is the same if I don't set window-rewrite-default
.)
For me it behaves the same. The title of a Spotify window changes its name to
I am getting the same ( I believe) bug with sway/workspaces
. Same problem where the icons for Spotify ( and other apps: eg brave, jetbrains-idea etc ) are not even rendering using the window-rewrite-default
I have the following config:
When I open the spotify desktop app in a new workspace, the new workspace appears in my bar but it's empty, just like it would appear if I created a new workspace without any windows. If I open, say, a foot terminal in this workspace alongside spotify, the waybar looks exactly as it would if only the terminal was open in this workspace.
This isn't an issue with the default icon. If I open a workspace with something not specified above, such as pavucontrol, the default "?" icon is correctly used. This also isn't a style issue; it repros if I remove my .css file. I ran
hyprctl workspaces
and the output included the following:So I would expect the regex to match, but even if it didn't I'd expect to see the default "?" rather than a blank workspace.