raffaem / waybar-mediaplayer

A mediaplayer for waybar with progress bar, tooltip, album art and synced lyrics
MIT License
20 stars 2 forks source link

Can't play/pause by clicking on media player in bar but can use playerctl command to play/pause #5

Closed J-Carder closed 2 months ago

J-Carder commented 2 months ago

I've followed the steps outlined in the README and the player does work with lyrics in my bar (great module!).

However whenever I try to click on the module to play/pause or skip songs it doesn't work.

This is the error I get when running: $HOME/.config/waybar/waybar-mediaplayer/src/mediaplayer -vvv play-pause

[__main__] [main] [INFO] I was called
[__main__] [main] [DEBUG] Arguments received {'command': 'play-pause', 'verbose': 3}
[__main__] [main] [DEBUG] config={'refresh_interval': 500, 'is_notification': False, 'notification_min_interval': 2, 'widget_length': 40, 'sepchar': '\uf444', 'surface_color': '#383c4a', 'overlay_color': '#6f92ff', 'interval': 1, 'text_rot_int': 1000, 'image_signal': 4, 'length_factor': 1, 'player_name': 'chromium.instance', 'convert_to_jpeg': False, 'album_art_placeholder': 'no', 'lyrics_providers': ['Lrclib', 'Musixmatch', 'NetEase', 'Megalobiz'], 'lyrics_span_before': 2, 'lyrics_span_after': 2}
[__main__] [signal_album_art_change] [DEBUG] pkill returned: CompletedProcess(args=['pkill', '-RTMIN+4', 'waybar'], returncode=0)
[__main__] [main] [DEBUG] Splitting player_name on `.`. requested_player=chromium
[__main__] [main] [DEBUG] Found player 'chromium'
[__main__] [main] [DEBUG] DBEUG <class 'gi.repository.Playerctl.Player'>
Traceback (most recent call last):
  File "/home/user/.config/waybar/waybar-mediaplayer/src/mediaplayer", line 656, in <module>
    main()
  File "/home/user/.config/waybar/waybar-mediaplayer/src/mediaplayer", line 619, in main
    Playerctl.Player.new(player.name).play_pause()
gi.repository.GLib.GError: playerctl-player-error-quark: Player not found (1)

What is interesting is that play and pause works perfectly fine when running playerctl play or playerctl pause from a terminal.

I'm using Playerctl 2.0.1 (as I couldn't find an exact 2.0 version).

I am using Ungoogled Chromium Version 126.0.6478.126 (Official Build) (64-bit). I have also tested on the latest Brave browser version and it gives the same results (no play/pause and same error).

I have the player_name in the config.json set to chromium.instance which is what playerctl --list-all outputs (minus the instance ID).

I am on KDE Neon 6.

EDIT: I've also tried messing with the player.name value on the error line it mentions in the log above but to no avail.

raffaem commented 2 months ago

Please install this extension, set player_name to plasma-browser-integration and check whether that fixes the issue

J-Carder commented 2 months ago

Please install this extension, set player_name to plasma-browser-integration and check whether that fixes the issue

That fixed it. Thank you!

raffaem commented 2 months ago

Thank you for the report!