You are not logged in.

#1 2020-04-21 21:42:22

AcidGod
Member
Registered: 2019-02-13
Posts: 34

Cannot bind class Spotify to any tag in dwm.

Hello everyone.

Could someone please help me to understand what could be wrong with Spotify application that doesn't allow me to bind it to any of the tags in config.h, this is what I have in the rules

static const Rule rules[] = {
		/* xprop(1):
		 *	WM_CLASS(STRING) = instance, class
		 *	WM_NAME(STRING) = title
		 */
		/* class	instance	title	tags mask	isfloating	isterminal    noswallow	monitor */
		{ "St",		NULL,		NULL,	0,		0,		 1,	   	0,	-1	},
		{ "Gimp",	NULL,		NULL,	1<<7,		0,		 0,	   	0,	-1	},
		{ "Spotify",	NULL,		NULL,	1<<2,		1,	 	0,	        0,	 0	},
};

Every single application works as intended and appears in the correct tag. But Spotify seems to ignore the rules and somehow go around it.

Last edited by AcidGod (2020-04-21 21:56:57)

Offline

#2 2020-04-21 21:51:54

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: Cannot bind class Spotify to any tag in dwm.

Ugh: have you thought about fixing the spacing in that file? It is impossible to read...

What is the output from xprop when you hit spotify?

# edit: don't paste all the icon crap at the top, just the name, class, instance at the end of the output.

Last edited by jasonwryan (2020-04-21 21:54:57)


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2020-04-21 21:57:36

AcidGod
Member
Registered: 2019-02-13
Posts: 34

Re: Cannot bind class Spotify to any tag in dwm.

jasonwryan wrote:

Ugh: have you thought about fixing the spacing in that file? It is impossible to read...

What is the output from xprop when you hit spotify?

# edit: don't paste all the icon crap at the top, just the name, class, instance at the end of the output.

Sorry for inconvenience  just  did, unfortunately, tabs in vim are not the same tabs as in browser

Last edited by AcidGod (2020-04-21 21:58:28)

Offline

#4 2020-04-22 10:46:31

AcidGod
Member
Registered: 2019-02-13
Posts: 34

Re: Cannot bind class Spotify to any tag in dwm.

WM_CLASS(STRING) = "spotify", "Spotify"
WM_NAME(STRING) = "Spotify Premium"

Offline

#5 2020-04-22 13:21:04

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,510
Website

Re: Cannot bind class Spotify to any tag in dwm.

AcidGod wrote:

Sorry for inconvenience  just  did, unfortunately, tabs in vim are not the same tabs as in browser

Off topic: This is why I only ever use tabs for indent at the start of lines, never for aligning within code.  It took me a while to accept this lesson too.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#6 2020-05-01 11:43:04

AcidGod
Member
Registered: 2019-02-13
Posts: 34

Re: Cannot bind class Spotify to any tag in dwm.

Guys, does anyone know why this might be happening? I have tried a different build of dwm to see if it will work but the result is the same. It opens spotify directly in active tag, rather than the one assign in the rules section.

Last edited by AcidGod (2020-05-01 12:11:34)

Offline

#7 2020-05-01 18:48:58

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: Cannot bind class Spotify to any tag in dwm.

Presumably you have tried changing the case?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#8 2020-12-22 09:46:37

Mahilig
Member
Registered: 2020-12-22
Posts: 3

Re: Cannot bind class Spotify to any tag in dwm.

Running xprop on spotify brings:

WM_CLASS(STRING) = "spotify", "Spotify"
WM_NAME(STRING) = "Spotify Premium"

Following this format in the config.h:

WM_CLASS(STRING) = instance, class
WM_NAME(STRING) = title

Came out with this:

/* class           instance        title      tags mask     isfloating       monitor */
{ "Spotify",     "spotify",       NULL,       1 << 8,         0,                 -1 },

{ "Spotify",     NULL,            NULL,       1 << 8,         0,                 -1 },

{ NULL,          "spotify",       NULL,       1 << 8,         0,                 -1 },

Tried all three (3) of them individually, not at the same time.

NULL value on title because it always changes when the current playing song changes.

Current behavior: Spotify is opened on the current displayed tag, reloading dwm is the only time it moves to the assigned tag (1 << 8).

Expected behavior: Spotify will open on the assigned tag.

Same behavior as spotify:

WM_CLASS(STRING) = "libreoffice", "libreoffice-writer"

Offline

#9 2020-12-22 14:28:48

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,510
Website

Re: Cannot bind class Spotify to any tag in dwm.

It's possible those programs only set their class hints after the window is mapped.  Apparently, DWM only checks these when the window is first mapped.  It should be relatively easy to patch DWM to respond to changes in these properties too.  Of course, this would mean the windows would appear on screen briefly before they were moved to where they should be.

Last edited by Trilby (2020-12-22 14:29:22)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#10 2020-12-23 02:01:17

Mahilig
Member
Registered: 2020-12-22
Posts: 3

Re: Cannot bind class Spotify to any tag in dwm.

Trilby wrote:

It's possible those programs only set their class hints after the window is mapped.  Apparently, DWM only checks these when the window is first mapped.  It should be relatively easy to patch DWM to respond to changes in these properties too.  Of course, this would mean the windows would appear on screen briefly before they were moved to where they should be.

It seems that that is the case indeed. Thanks!
If I was that avid with C I would try doing that patch, but alas, I'm still learning the language and I just switched from i3 just a few days.

Offline

#11 2021-02-20 10:10:09

Mahilig
Member
Registered: 2020-12-22
Posts: 3

Re: Cannot bind class Spotify to any tag in dwm.

{ NULL,          NULL,       "LibreOffice",       1 << 8,         0,            -1 }, 

Update: This works for Libre Office, I just found out this week.

Offline

Board footer

Powered by FluxBB