shell icon indicating copy to clipboard operation
shell copied to clipboard

Pop-Shell not working on Spotify

Open the1derer opened this issue 6 years ago • 20 comments

(1) Issue/Bug Description: Pop Shell doesn't seem to recognize Spotify ~~(deb) installed via the method provided on official Spotify resource~~. It doesn't do auto-tiling on the Spotify window and I can't use ~~Window~~ Super+S to initiate window-stack.

Although I am able to select the Spotify window with ~~Window~~ Super+Enter, I can't perform any operations other than to add it to the previously available window-stack.

The weird thing is when I add and then remove this Spotify window from Floating Window exception then it starts recognizing the window!!

(2) Steps to reproduce (if you know):

(I) Go to https://www.spotify.com/in/download/linux/ (ii) Install Spotify(deb) as the steps provided i.e.

OR

Just install Spotify flatpak.

curl -sS https://download.spotify.com/debian/pubkey_0D811D58.gpg | sudo apt-key add - 
echo "deb http://repository.spotify.com stable non-free" | sudo tee /etc/apt/sources.list.d/spotify.list
sudo apt-get update && sudo apt-get install spotify-client

(iii) Open Spotify You will see that it doesn't tile. And then try to initiate window-stack using Window+S.

(3) Expected behaviour:

Pop! Shell recognises and tiles the Spotify ~~(deb)~~ window and I can initiate window-stack on it.

(4) Distribution (run cat /etc/os-release):

NAME="Pop!_OS"
VERSION="20.10"
ID=pop
ID_LIKE="ubuntu debian"
PRETTY_NAME="Pop!_OS 20.10"
VERSION_ID="20.10"
HOME_URL="https://pop.system76.com"
SUPPORT_URL="https://support.system76.com"
BUG_REPORT_URL="https://github.com/pop-os/pop/issues"
PRIVACY_POLICY_URL="https://system76.com/privacy"
VERSION_CODENAME=groovy
UBUNTU_CODENAME=groovy
LOGO=distributor-logo-pop-os

(5) Gnome Shell version: 3.38.1

(6) Pop Shell version (run apt policy pop-shell or provide the latest commit if building locally):

  Installed: 1.0.0~1605809546~20.10~1a8b13f
  Candidate: 1.0.0~1605809546~20.10~1a8b13f
  Version table:
 *** 1.0.0~1605809546~20.10~1a8b13f 1001
       1001 http://ppa.launchpad.net/system76/pop/ubuntu groovy/main amd64 Packages
       1001 http://ppa.launchpad.net/system76/pop/ubuntu groovy/main i386 Packages
        100 /var/lib/dpkg/status

(7) Where was Pop Shell installed from: Provided by default with the distribution(Pop! OS),

(8) Monitor Setup (2 x 1080p, 4K, Primary(Horizontal), Secondary(Vertical), etc): Single 1080p screen attached to laptop.

(9) Other Installed/Enabled Extensions: Only 2 other extensions installed: (i) Caffeine (ii) Sound input and Output device chooser

I also tried to check result by disabling these extensions by the result was same(bug still there).

(10) Other Notes: ~~All features of Pop-Shell is working correctly on Spotify-flatpak.~~ Edit (01-April-2021): Pop-Shell has stopped working even on flatpak version of Spotify.

the1derer avatar Nov 22 '20 07:11 the1derer

I'm on Pop_OS 20.04 and I just started experiencing a more extreme variation of this issue: the Spotify window doesn't seem to respect the shell at all. It now covers the menubar, is unable to be resized by Super+Enter, and is ignored by other windows that are functioning correctly. I have no gnome extensions installed and I'm using the 1080p display attached to my laptop (lemp9). I have not tried the flatpak version of Spotify yet.

image

nathaniel-c-wheeler avatar Nov 22 '20 21:11 nathaniel-c-wheeler

I'm on Ubuntu 20.10 and experience the same thing with snap version of spotify (I presume this also means flatpak is affected?):

$ spotify --version
Spotify version 1.1.46.916.g416cacf1, Copyright (c) 2020, Spotify Ltd

Pop Shell installed locally from https://github.com/pop-os/shell/commit/b5ed27076acf0cef5feaa02c345a2f384a3f9d72 (latest master at the time of writing)

Xanewok avatar Nov 23 '20 11:11 Xanewok

same here, also on 1.1.46.916.g416cacf1 and Ubuntu 20.04.2

kevgilmore avatar Feb 01 '21 12:02 kevgilmore

I have the same issue, and I'm beginning to wonder if this affects flatpak/snap apps broadly. Spotify is the most notable one that I've had issues with, but also Flatpaks for Slack and Telegram have exhibited the same behavior.

A temporary fix can work if you add and remove a "floating window exception" for the app in question. Once the floating window exception is removed, the app will tile correctly again.

Pop Shell version 1.2.0-1 on Manjaro GNOME

porkloin avatar Feb 11 '21 17:02 porkloin

Still not working on spotify to this day

RazerPC avatar Apr 23 '21 10:04 RazerPC

Unfortunately, @porkloin 's solution doesn't work for me with Slack's flatpak. Slack always acts as if there's an exception no matter what. It did however work for Spotify.

Pop!_OS 20.10 GNOME 3.38.3 Pop Shell: 1.1.0~1619554528~20.10~42e8ac0

devotoare avatar Apr 29 '21 20:04 devotoare

I've encountered a few windowing issues like this myself in the last while with Spotify so I wrote this little script to fix things:

#!/usr/bin/env python3

import subprocess
import time
from pynput.keyboard import Key, Controller


# opening spotify

subprocess.call(["/usr/bin/flatpak", "run", "--branch=stable", "--arch=x86_64", "--command=spotify", "--file-forwarding", "com.spotify.Client"])

spotify_found = False

while (spotify_found == False) :

	open_windows = str(subprocess.check_output(["wmctrl", "-l"]))
	spotify_found = ("Spotify Premium" in open_windows)


# toggle the title bar

subprocess.call(["gsettings", "set", "org.gnome.shell.extensions.pop-shell", "show-title", "true"])
subprocess.call(["gsettings", "set", "org.gnome.shell.extensions.pop-shell", "show-title", "false"])


# toggle tiling

keyboard = Controller()

keyboard.press(Key.f8)
keyboard.release(Key.f8)

keyboard.press(Key.f8)
keyboard.release(Key.f8)

It has two dependencies:
sudo apt install wmctrl
pip install pynput

All it does is automate the manual fix of toggling settings to force it to behave properly.


The first portion of the script starts Spotify and waits for the window to load before attempting to configure it.

The next part toggles pop-shell's "show-title" attribute to properly hide the title bar, because Spotify wasn't obeying my system-wide setting to hide title bars- you can delete this part if you don't care about that.

The last part is the tiling-specific solution, and it works by simulating two keypresses of F8, which I have set as a shortcut for toggling tiling.
I had to set that shortcut manually because the default shortcut, Super + Y, was inexplicably not working correctly through pynput, so if you can get that to work more power to you but using F8 has worked perfectly for me.
I couldn't find a pop-shell boolean setting for tiling like I was able to with the title bar, hence the need to simulate the keyboard shortcut for this, but maybe someone more knowledgable than me can point out the correct setting if it exists.

To use the script just save it somewhere convenient and replace the "Exec" entry in Spotify's .desktop file:

[Desktop Entry]
Type=Application
Name=Spotify
GenericName=Online music streaming service
Comment=Access all of your favorite music
Icon=com.spotify.Client
Exec=python3 /path/to/script.py        <--- this is what the entry should be changed to
Terminal=false
MimeType=x-scheme-handler/spotify;
Categories=Audio;Music;AudioVideo;
Keywords=Music;Player;Streaming;Online;
StartupWMClass=Spotify
X-GNOME-UsesNotifications=true
X-Flatpak-Tags=proprietary;
X-Flatpak=com.spotify.Client

(note: to bring the changes into effect after saving you have to refresh the gnome session with 'Alt+F2 --> r')


Before you edit the .desktop file the "Exec" entry will look something like:

/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=spotify --file-forwarding com.spotify.Client

and this is what goes in the first subprocess.call() command in the script.

I'm yet to try it with any other programs but it should work the exact same way; just replace the first subprocess.call() command with the "Exec" entry from the target program's .desktop file, and change the loop in the script to wait until the target program's window title is found instead of "Spotify Premium".

Hope this helps someone!

konall avatar May 03 '21 00:05 konall

Very cool @konall

bflanagin avatar May 25 '21 13:05 bflanagin

I am encountering the same issue with the flatpak version although I can get the window to behave normally if I toggle tiling with Super + Y. It's unfortunate though as I have to do this everytime I launch spotify.

devonallie avatar Jul 11 '21 10:07 devonallie

I am also experiencing this issue with the newest version of spotify (1.1.55.498.gf9a83c60) and pop os 21.04.

I tried both the flatpak and the deb version. Neither tiles and neither responds to super + G. Both will tile if system tiling is toggled off and back on with super + Y after spotify is opened.

msdrigg avatar Sep 07 '21 17:09 msdrigg

I did some digging on this issue and I'll share here to help anyone else understand who is curious.

It appears that the source of the issue is that Spotify doesn't set its WM_CLASS property early enough, so tiling window managers aren't able to deal with it well. This has apparently been an issue since 2015.

To address this issue, there is a package called spotifywm binds with spotify to set WM_CLASS before opening the window. This package is actually incorporated into the official spotify flatpak as seen here.. Which explains why the flatpak was working initially.

Unfortunately, with the newest update to spotify, there is a new issue with spotifywm so that this hack no longer works. There haven't been any updates or workarounds that fix the issue up to this point.

I don't know of any convenient work-around at this point.

msdrigg avatar Sep 07 '21 19:09 msdrigg

I'm still having this problem with the Spotify flatpak on the latest commit. Can anyone test if it behaves correctly on their system?

RedHatTurtle avatar Nov 05 '21 14:11 RedHatTurtle

Can confirm this is happening again on 1fddaa8, tested on 21.10 beta.

jacobgkau avatar Nov 05 '21 14:11 jacobgkau

I've checked out and tested every commit in master back to 321588609a443902405908df59161b43a70f4698 (which fixed this), and it's broken on all of them, including 321588609a443902405908df59161b43a70f4698. Not sure what else has changed.

jacobgkau avatar Nov 05 '21 15:11 jacobgkau

Have to wait for Spotify to fix it, because they broke it: https://github.com/dasJ/spotifywm/issues/8

mmstick avatar Nov 05 '21 15:11 mmstick

I have been using the standard deb version, so this is a flatpak-specific issue. It is caused by https://github.com/flathub/com.spotify.Client/issues/184. You can see in the comment by dennysMB that the newest version of the flatpak never sets its WM_CLASS or title at all, so there is no way for us to tile it or apply rules.

I just confirmed and the spotify version that the flatpak is based off of sets its WM_CLASS and title just fine. I think we're waiting on flatpak to fix this.

I see that the snap sets its WM_CLASS, so it should work fine, but I haven't confirmed this myself.

msdrigg avatar Nov 11 '21 14:11 msdrigg

If this pr (https://github.com/flathub/com.spotify.Client/pull/188) is accepted, spotify will tile correctly with the flathub as well.

msdrigg avatar Dec 01 '21 21:12 msdrigg

The PR was merged and I can confirm that it is fixed with the update!

jstebenne avatar Dec 03 '21 19:12 jstebenne

If one of the devs wants to confirm the fix, I think we may be ready to finally close this issue

msdrigg avatar Dec 03 '21 19:12 msdrigg

I just updated and restarted my Spotify flatpak and can confirm that it now tiles!

Thanks @msdrigg !

leviport avatar Dec 03 '21 19:12 leviport