void-linux / void-packages

The Void source packages collection
https://voidlinux.org
Other
2.59k stars 2.16k forks source link

Spotify WM_CLASS #29479

Open pyramidhead52 opened 3 years ago

pyramidhead52 commented 3 years ago

spotifywm: Set Spotify's WM_NAME before opening the window.

Spotify does not respect window manager rules. Any window manager that try to apply specific rules like starting it on a determined workspace or maximizing it on startup, has no effect, as Spotify doesn't set the WM_CLASS property before creating the window.

This one should fix the problem.

folliehiyuki commented 3 years ago

Hmm it is just 1 source file, and is simple enough that it doesn't need any updates since 2016. Here you go:

$ wget https://github.com/dasJ/spotifywm/raw/master/spotifywm.cpp
$ g++ -O3 -shared -fPIC -static-libgcc -lX11 -Wall -Wextra -DSONAME="spotifywm.so" -o spotifywm.so spotifywm.cpp

Packaging this just adds burden to maintain in my opinion.

pyramidhead52 commented 3 years ago

I got this error:

spotifywm.cpp:9:10: fatal error: X11/Xlib.h: No such file or directory
    9 | #include <X11/Xlib.h>
      |          ^~~~~~~~~~~~
compilation terminated.

"base-devel" is installed.

folliehiyuki commented 3 years ago

You need libX11-devel installed

pyramidhead52 commented 3 years ago

Thank you, it worked.

Sorry, I am bit noob about this. Just to be clear, I changed my Spotify keybinding command from spotify to LD_PRELOAD=$HOME/Downloads/spotifywm/spotifywm.so spotify.

That is the correct way, right?

folliehiyuki commented 3 years ago

I guess it is. You can check whether spotify is launched with a proper WM_CLASS by using xprop

pyramidhead52 commented 3 years ago

Thank you, it works just fine.

pyramidhead52 commented 3 years ago

I've asked if this patch could be incorporated to Spotify package directly and one of the Spotify's maintainers, @ericonr suggested to reopen the issue. So, I'm reopening it.