flathub / com.spotify.Client

https://flathub.org/apps/details/com.spotify.Client
68 stars 34 forks source link

Spotify flatpak doesn't remember last window location/open new windows as centered ignored #154

Open Scotty-Trees opened 3 years ago

Scotty-Trees commented 3 years ago

Greetings,

First off thank y'all for making this flatpak, it definitely comes in handy many times a day as a music lover, can't appreciate your efforts enough. I've used both .deb and flatpak versions of Spotify in the past, currently using the flatpak version of Spotify. I use GNOME, and have a setting enabled via Gnome Tweaks Tool "center new windows" which for the most part all applications obey and center windows opened in the center of the desktop. I know previous versions of the .deb and flatpak version of Spotify have obeyed this rule, but with one of the recent new versions, Spotify does not open in the center anymore, it always opens in the center, but at a lower angle than what I previously had it as. I'm wondering if this issue can be address or fixed since it appeared to be something that worked before to open Spotify in the center of the desktop or perhaps y'all can set a rule to have the window open in the same spot from it's last time used or like restore last known window position on restart if that makes more sense I hope?

One issue I have noticed also is if I open Spotify, it'll open in the center but shifted down and every time I close it and reopen it, the application will shift down even more. If I open and close it about 2-3 times the window ends up continually shifting to going to the bottom border of my screen, without me having moved the window at all, which makes it very inconsistent and I constantly have to re-drag it up to where I'd like it placed. I do hope this can be address in an update.

This would be very much appreciated as since every time I open Spotify, I have to drag it up since it doesn't align to the center like all my other windows do. Any help would be great and thanks for hearing this out!

Using the latest Spotify flatpak version 1.1.55.498.gf9a83c60 on PopOS 20.04 on GNOME 3.36 with a fully up to date system and currently flatpak version 1.8.5

Below is a few screenshots to show any relevant settings that may help Gnome Tweaks tool with new windows open in center selected Screenshot from 2021-04-14 01-34-37 System info showing laptop model and kernel version Screenshot from 2021-04-14 01-34-56 Currently on PopOS with GNOME 3.36.8 Screenshot from 2021-04-14 01-35-22 Spotify opening in the center after I've placed it that way. It won't remember this position upon a restart sadly. Screenshot from 2021-04-14 01-41-49 After opening Spotify twice, this is where the window ends up moving to. Screenshot from 2021-04-14 01-42-31

JasonLG1979 commented 3 years ago

The config file for the Spotify flatpak is located at ~/.var/app/com.spotify.Client/config/spotify/prefs in it you will find app.window.position.y= which should correspond to the top left corner of the app. The problem is that when closing and writing that value Spotify does not account for the height window decorations (Spotify incorrectly records y as the top of application frame not the window decorations) but when the app is opened and tells GNOME where to put it, GNOME actually puts it at the correct y position that it asks for (as in y is the top of the window decorations). The affect is, as you've noticed, that if you open and close the app it basically will walk down the screen.

The proper solution is for Spotifiy to fix it, but we all know that won't happen, so I'll see if I can write a script that can't connect to the close event of the window, record it's actual correct y position and overwrite the bogus app.window.position.y= value?

Scotty-Trees commented 3 years ago

This would be awesome and like I mentioned very much appreciated! I hope it's as simple as something like making it remember it's last used position on exit or something to that effect, perhaps I hope it is simple enough at least! Thank you very much for looking into it though, its not the end of the world if it's a Spotify side fix, but it's sure nice when things do work as intended. Take all the time you need and good luck to you.

JasonLG1979 commented 3 years ago

@Scotty-Trees looking further into it the desired size in prefs doesn't include the window decorations either so it may be as simple as comparing the actual size to the desired size in prefs to get the height of the window decorations and basically doing desired_position = bogus_position - (bogus_size - actual_size) at start up. But that may make the window jump though and is pretty hacky. It assumes a lot and may not work as expected on all DE's. I'd rather record the real value at close but I don't really want a python script just hanging out all the time doing nothing but just waiting for the window to close. I don't know? I'll play with it and see what I can come up with. I really wish the Spotify app wasn't such garbage.

Scotty-Trees commented 3 years ago

I really wish the Spotify app wasn't such garbage.

It's been a sentiment many in the Linux community have shared for literally years. Sadly, Spotify sees Linux as an after thought, even though I wish that weren't the case of course. Whatever solution you come up with or if it turns out that no implementation works as you need it to across all DE's then I understand that. It's just one of those annoying little things. Ahh the life of coding eh! Once again, good luck to any solutions/fixes/answers you come up with, no rush, take you're time, and I look forward to any news when you do.

JasonLG1979 commented 3 years ago

It's been a sentiment many in the Linux community have shared for literally years.

Projects like librespot are starting to make it possible to not have to rely on the desktop app. I use librespot on a Raspberry Pi Zero with a Hifiberry DAC+ Zero as a Spotify Connect appliance that's literally so small that it's velcro'd to the back of my stereo reciever. I just use the desktop app as a remote control when I'm on my computer or I use my phone when not at my computer. The audio playback actually happens on the Pi Zero. A lot of times I just start a playlist in the desktop app and then close it. It doesn't actually have to be running for the playlist to continue to play on the Pi Zero.

Erick555 commented 3 years ago

It's been a sentiment many in the Linux community have shared for literally years. Sadly, Spotify sees Linux as an after thought, even though I wish that weren't the case of course.

Keep in mind below:

Linux is not an officially supported platform for Spotify, the client is brought here by the Spotify developers, from their free time.

JasonLG1979 commented 3 years ago

Keep in mind below:

I think that literally everyone that uses Spotify on Linux knows that all to well :disappointed:

JasonLG1979 commented 3 years ago

That doesn't speak well of Spotify. You may read that to say "Hey you're lucky this even works." I read it to say "We care so little of customers that may even be actually paying for the service that not only do we not even support the platform you run Spotify on, that we totally could, we don't even pay our devs."

Scotty-Trees commented 3 years ago

Projects like librespot are starting to make it possible to not have to rely on the desktop app.

Definitely nice to see it when there's an actively developed alternative to things like this. For me I still like the default app for what it DOES offer (besides the playback) like I like knowing related artists, I like knowing the top/most popular tracks, the album/EP discography, any artist bio information is a bonus but not crucial of course, and I enjoy knowing how many times a band has been streamed, I dunno why I like that last one, but it's a thing!

JasonLG1979 commented 3 years ago

At this point librespot is nowhere near a total replacement. It does however offer peace of mind in the fact that I don't have to depend on AVR Spotify integration or a dedicated Spotify Connect devices that can be expensive and with no notice could become door stops if the company that makes them goes belly up or decides to stop supporting them. If librespot stops working I can always use the Pi Zero for something else.

Erick555 commented 3 years ago

@JasonLG1979 I read it the same as you however I'm afraid the negative feedback about garbage app may more likely to discourage unpaid devs from caring about linux at all than encourage spotify management to support linux as the latter may not even get it.

JasonLG1979 commented 3 years ago

I'm sorry. I am a paying customer if something doesn't work and they won't let me fix it or fix it themselves I have the right to complain. That's how proprietary software works. The complaint is not with the unpaid devs it's with Spotify. The truth hurts sometimes. If as a paying customers we lay down and play dead surely nothing will change. At the very worst I'm just yelling into the void (which is most likely the case) at the best if enough people make enough noise maybe they'll actually do something.

JasonLG1979 commented 3 years ago

@Scotty-Trees I'm not having much luck finding a simple and small tool that will actually tell me the real y coordinate. They either don't work in wayland or report the same bogus value as Spotify. I really would like to avoid pulling in some relatively large dependency to fix this. It may be a no-go but I'll keep looking.

Scotty-Trees commented 3 years ago

@JasonLG1979 No worries, I appreciate you taking a lo at this issue nonetheless, so thank you for that. If it matters at all I'm still on Xorg for PopOS, they haven't yet moved over to Wayland by default. PopOS 20.04/20.10 are still Xorg and I think 21.04 may still be Xorg as well, but not sure at the moment since that won't be released some time next month in June.

JasonLG1979 commented 3 years ago

@Scotty-Trees Ubuntu 21.04 was released a couple weeks ago. Ubuntu 21.04 defaults to Wayland unless you're running nvidia proprietary graphics drivers. Fedora 34 is the same. I'm not sure about other distros? Not working on Wayland at this point is a deal breaker.

Scotty-Trees commented 3 years ago

@JasonLG1979 If PopOS doesn't go default to Wayland in 21.04 in June, it'll more than likely be Wayland by default in 21.10 I would assume. I don't really have a reason to jump into Wayland being on a 5 year old laptop with an Nvidia hybrid graphics card, but I'll go wherever the open source community becomes the norm for

JasonLG1979 commented 3 years ago

@Scotty-Trees I'm not making a judgment on what you chose as a distro, I'm just saying at this point if something doesn't work on Wayland also it's a no-go IMHO for the sake of consistency and future proofing. X is going bye-bye. They have already split out XWayland from X so It's possible to run X only apps in Wayland without having a full X install. There will come a day in the not so distant future when X won't be installed by default in distros.

alvarlagerlof commented 2 years ago

It not starting in the right place I can live with, but this size is just stupid.

image

gowerc commented 2 years ago

image

Yer the current default window size is a bit silly :( is there anyway of setting a more sensible default ?

esamson commented 2 years ago

Just tried this today and it seems to have been fixed already.

JasonLG1979 commented 2 years ago

@esamson the original issue of Spotify "walking" down the screen is back though. Which is still bad but not as bad as not remembering it's size.

esamson commented 2 years ago

Ah, interesting. It doesn't happen when I have the window snapped to the upper left corner of my screen. I do see it happening when the window is somewhere near the center.

alvarlagerlof commented 2 years ago

Seems fixed for me too, but I only use it maximized.

JasonLG1979 commented 2 years ago

Seems fixed for me too, but I only use it maximized.

Yes that is a well established fact. The original bug is still present.

mat-m commented 2 years ago

@Scotty-Trees looking further into it the desired size in prefs doesn't include the window decorations either so it may be as simple as comparing the actual size to the desired size in prefs to get the height of the window decorations and basically doing desired_position = bogus_position - (bogus_size - actual_size) at start up. [...].

Do you know the settings to define a sensible size at startup ? Position is fine by me, locked in 0,0 :) But size is definietly too small.

JasonLG1979 commented 2 years ago

Do you know the settings to define a sensible size at startup ? Position is fine by me, locked in 0,0 :) But size is definietly too small.

It's not a user facing setting. When you close the app it saves some state info to ~/.var/app/com.spotify.Client/config/spotify/prefs.

SimonLammer commented 2 years ago

I'd rather record the real value at close but I don't really want a python script just hanging out all the time doing nothing but just waiting for the window to close

Maybe FUSE can help in that case, by creating the prefs as a virtual file that would be slightly modified upon write. I havn't looked into this technology pretty much at all, but this reminded me of it. I'm not even sure if this would consume less resources than some other sleeping (waiting for the file to change) script. It would also add a lot more hackyness to the fix.

Here's a getting-started article for FUSE with python: https://thepythoncorner.com/posts/2017-02-28-writing-a-fuse-filesystem-in-python/

JasonLG1979 commented 2 years ago

Creating a virtual file system would be completely unnecessary.

SimonLammer commented 2 years ago

@JasonLG1979 couldn't it trigger a program without the program running continuously? e.g. upon a file being written

JasonLG1979 commented 2 years ago

The overhead would be crazy compared to just a python thread that spent most of it's time sleeping.

elvisisvan commented 8 months ago

It not starting in the right place I can live with, but this size is just stupid.

image

lmao is this still an issue?? that looks hilarious :)

on my side, this is how spotify looks according to the default dimensions i set in my fedora linux kde plasma desktop:

image

and this is the "window rules" config in kde plasma system settings for spotify:

image

maybe you should consider switching to kde plasma desktop :)