Alexays / Waybar

Highly customizable Wayland bar for Sway and Wlroots based compositors. :v: :tada:
MIT License
5.86k stars 660 forks source link

Spotify in tray #3402

Closed Prabhuomkar9 closed 2 days ago

Prabhuomkar9 commented 5 days ago

Hello,

hyprctl systeminfo

Hyprland, built from branch main at commit 918d8340afd652b011b937d29d5eea0be08467f5  (flake.lock: update).
Date: Tue Jun 25 12:06:02 2024
Tag: , commits: 1

flags: (if any)

System Information:
System name: Linux
Node name: Spike-Arch
Release: 6.6.36-1-lts
Version: #1 SMP PREEMPT_DYNAMIC Thu, 27 Jun 2024 12:26:27 +0000

GPU information: 
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GA107M [GeForce RTX 3050 Mobile] [10de:25a2] (rev a1) (prog-if 00 [VGA controller])
06:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Cezanne [Radeon Vega Series / Radeon Vega Mobile Series] [1002:1638] (rev c6) (prog-if 00 [VGA controller])

os-release: NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
BUILD_ID=rolling
ANSI_COLOR="38;2;23;147;209"
HOME_URL="https://archlinux.org/"
DOCUMENTATION_URL="https://wiki.archlinux.org/"
SUPPORT_URL="https://bbs.archlinux.org/"
BUG_REPORT_URL="https://gitlab.archlinux.org/groups/archlinux/-/issues"
PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/"
LOGO=archlinux-logo

plugins:
  hyprbars by Vaxry ver 1.0
  hyprexpo by Vaxry ver 1.0

Waybar : Waybar v0.10.3

Spotify : spotify-launcher 0.5.4-1

Issue: On close spotify is put to waybar tray, and so is discord, although when i kill waybar spotify pops out of tray and maximizes, meanwhile discord remains hidden(i suppose not in tray as waybar is killed) If i close spotify now, its killed as waybar is no more. If i open waybar(without closing spotify), i can see discord as well as spotify in the tray.

Is it a wayabr tray bug, or have i missed some setup

RobertMueller2 commented 4 days ago

I'm not 100% sure I understand this correctly, but I don't think waybar is responsible for starting or killing tray apps. (Unless maybe the application was previously started via an action e.g. from custom module. (see #3339), but that's probably unrelated.)

E.g. I can start nm-applet without waybar or any other tray present, I can't ever see any tray icon, yet the process (according to ps) is there. And when I open waybar along with tray, nm-applet is displayed in the tray.

So, above you have stated your observation. Can you clarify what you expected instead, please?

Prabhuomkar9 commented 4 days ago

Steps to come to my condition

  1. Open waybar
  2. Open spotify
  3. Open discord/docker desktop/obs
  4. Make sure all r set to minimize to tray once closed
  5. Close all(aka all will get into tray)
  6. Close waybar

Expectation

Reality

(this is my 2nd github error where i press Ctrl+Shit+Enter to go to previous line, and github presses the close issue button, i hate VS Code)

Prabhuomkar9 commented 4 days ago

for now i have made it so that spotify opens in workspace 4, i usually will be using 1, 2 or 3, so even when i close waybar spotify popping out doesnt irritate me, but its at the end of the day a workaround

RobertMueller2 commented 3 days ago

I've installed spotify and I can reproduce the behaviour. But I can also reproduce the behaviour with eww instead of waybar.

This is not so easy to prove as spotify is closed source, but I think that spotify reacts to org.kde.StatusNotifierWatcher being present (you can check if it is e.g. with dbus-send --session --dest=org.freedesktop.DBus --type=method_c all --print-reply /org/freedesktop/DBus org.freedesktop.DBus.ListNames | grep Status)

Spotify uses libayatana-appindicators so likely does any checks against org.kde.StatusNotifierWatcher through that. If I run an strace with spotify, I can find org.kde.StatusNotifierWatcher several times. Even if no tray is available at all throughout spotify's process's lifetime.

If you close spotify without org.kde.StatusNotifierWatcher available, the process ends. If you close spotify with org.kde.StatusNotifierWatcher available, the process remains. If spotify doesn't have an open window and org.kde.StatusNotifierWatcher vanishes, spotify opens a window.

To me, it looks like behaviour of the spotify client so personally, I'd suggest a bug report at spotify.

EDIT: dbus-monitor might be a better approach to understanding this than strace ;)

RobertMueller2 commented 2 days ago

Something interesting I noticed while testing with both Waybar and eww, apparently there's always a process that has the ownership of org.kde.StatusNotifierWatcher. If that process ends, spotify shows.

If I start eww, then waybar, ending waybar does not cause spotify to show. If I start waybar, then eww, ending waybar causes spotify to show.

Another interesting observation is that eww keeps org.kde.StatusNotifierWatcher running even if the window containing the tray is closed. Spotify only shows when eww's daemon process ends. Waybar doesn't have an architecture with a separate daemon so can't really do it like that.

But here's an idea, perhaps there's a way to create a mock tray service, that starts before waybar and keeps running. No idea if there are any side effects. Or use eww to create a tray window and close it again, also before waybar. Maybe both of these suggestions are over the top, but I suppose it all depends on how annoying spotify's behaviour is to you ;)

Prabhuomkar9 commented 2 days ago

I recently started Linux so couldn't understand your response completely, but as far as i could understand and imitate what you have specified so far I too believe its a spotify issue.

Backed by the fact that i couldn't find any other app that would behave the same way. I did find jet brains toolbox to actually be in the tray(coz its opening fast from 2nd time) but cant really find its icon in the tray once waybar is killed and restarted(this is out of context and doesn't bother me)

For now ig redirecting spotify to a workspace i don't use is fine with me, although i am curious to find a better solution. lately a bit busy so maybe ill look into this later

For now i'll drop a issue in https://community.spotify.com/t5/Desktop-Linux/bd-p/desktop_linux and link to this issue. I'll close this issue

Thanks for the help;)