Giter Site home page Giter Site logo

Comments (25)

webmastak avatar webmastak commented on June 8, 2024 1

Just in Chrome, if you close the player’s tab, the button still remains and you have to close Chrome (restarting the Gnome Shell does not help) so that the button disappears.

from gnome-shell-extension-mpris-indicator-button.

JasonLG1979 avatar JasonLG1979 commented on June 8, 2024

Chrome's MPRIS implementation is broken. Most of the properties are non-existent. In this particular case CanControl is either false or non-existent. If CanControl is false or non-existent then the controls are hidden.

from gnome-shell-extension-mpris-indicator-button.

webmastak avatar webmastak commented on June 8, 2024

You can do then do not show mpris-indicator-button if the player is Chrome?
Because with Chrome and Chromium, it has become useless.

I have with Vivaldi: 2.10.1745.27, and he is on Chromium as well.

I did this with the mediaplayer extension in manager.js

        // player DBus name pattern
        // let name_regex = /^org\.mpris\.MediaPlayer2\./;
        let name_regex = /^org\.mpris\.MediaPlayer2\.(?!chrom)/; // exclude chrome and vivaldi

from gnome-shell-extension-mpris-indicator-button.

JasonLG1979 avatar JasonLG1979 commented on June 8, 2024

You can do then do not show mpris-indicator-button if the player is Chrome?
Because with Chrome and Chromium, it has become useless.

I have with Vivaldi: 2.10.1745.27, and he is on Chromium as well.

I'm a Chrome user also. I have been meaning to workaround it.

By spec that property is not expected to change so an option is to just ignore players altogether that lack the property or if it is false. I really don't want to do any blacklisting.

from gnome-shell-extension-mpris-indicator-button.

webmastak avatar webmastak commented on June 8, 2024

so an option is to just ignore players altogether that lack the property or if it is false.

And this will prevent the button from showing if one Chrome player?

don't want to do any blacklisting

Yes, the blacklist will not be needed then.

from gnome-shell-extension-mpris-indicator-button.

JasonLG1979 avatar JasonLG1979 commented on June 8, 2024

And this will prevent the button from showing if one Chrome player?

Yes, instead of just hiding the controls the whole player will be ignored and hidden.

from gnome-shell-extension-mpris-indicator-button.

JasonLG1979 avatar JasonLG1979 commented on June 8, 2024

It’s just that in Chrome, if you close the player’s tab, the button still remains and you have to restart the Gnome Shell so that it disappears.

Chrome puts up an interface when something plays and never takes down. In my case if you quit Chrome it goes away.

from gnome-shell-extension-mpris-indicator-button.

webmastak avatar webmastak commented on June 8, 2024

if you quit Chrome it goes away.

Yes, that’s what I wrote above, but it’s not convenient.

from gnome-shell-extension-mpris-indicator-button.

JasonLG1979 avatar JasonLG1979 commented on June 8, 2024

Yes, that’s what I wrote above, but it’s not convenient.

Sorry my bad,lol!!! No it's not, but that's not my bug.

from gnome-shell-extension-mpris-indicator-button.

webmastak avatar webmastak commented on June 8, 2024

Hands did not reach the fork of the mediaplayer extension, I will wait for the mpris-indicator-button fix with Chrome. )

from gnome-shell-extension-mpris-indicator-button.

JasonLG1979 avatar JasonLG1979 commented on June 8, 2024

Their implementation is absolute shit. For example most of the time I can fire up d-feet to quickly and easily figure out what a player is doing but since they don't even do the absolute most basic thing when it comes to any dbus interface which is make it introspectable, if I want to see what's actually going on I have to put in a bunch of logging in the extension.

from gnome-shell-extension-mpris-indicator-button.

JasonLG1979 avatar JasonLG1979 commented on June 8, 2024

Hands did not reach the fork of the mediaplayer extension, I will wait for the mpris-indicator-button fix with Chrome. )

I'll have something maybe tonight if not in a couple days at most.

from gnome-shell-extension-mpris-indicator-button.

webmastak avatar webmastak commented on June 8, 2024

Interesting in argos (which I have for tests) with my modification of mpris.1.1s.sh (originally for Chrome I did not) in Chrome, everything works and play / pause and switch tracks if from the playlist.

But I think that for Chrome with their integrated mpris control this is no longer needed in the mpris-Indicator-Button.

~/.config/argos/mpris.1.1s.sh

#!/usr/bin/env bash

PLAYERS=$(dbus-send --session --dest=org.freedesktop.DBus --type=method_call --print-reply /org/freedesktop/DBus org.freedesktop.DBus.ListNames | grep 'org.mpris.MediaPlayer2.' | grep -E 'auryo|rhythmbox|Lollypop|chrome.*')
CUTENT_PLAYER=$(echo "$PLAYERS" | cut -d '"' -f 2 | head -1)
COMMAND_BASE="dbus-send --print-reply --dest=$CUTENT_PLAYER /org/mpris/MediaPlayer2"
PLAY_PAUSE="$COMMAND_BASE org.mpris.MediaPlayer2.Player.PlayPause"
NEXT="$COMMAND_BASE org.mpris.MediaPlayer2.Player.Next"
PREVIOUS="$COMMAND_BASE org.mpris.MediaPlayer2.Player.Previous"

MPRIS_META=$($COMMAND_BASE org.freedesktop.DBus.Properties.Get string:org.mpris.MediaPlayer2.Player string:Metadata)
ARTIST=$(echo "$MPRIS_META" | sed -n '/artist/{n;n;p}' | cut -d '"' -f 2 | cut -c1-30)
SONG_TITLE=$(echo "$MPRIS_META" | sed -n '/title/{n;p}' | cut -d '"' -f 2 | cut -c1-30)
ART_URL=$(echo "$MPRIS_META" | sed -n '/artUrl/{n;p}' | cut -d '"' -f 2)

SONG_TITLE=${SONG_TITLE//&/&}
SONG_TITLE=${SONG_TITLE//|/|}
ARTIST=${ARTIST//&/&}
ARTIST=${ARTIST//|/|}

if [[ "$CUTENT_PLAYER" == *"auryo"* ]]; then 
  player='auryo'
  icon='multimedia-audio-player-symbolic'
elif [[ "$CUTENT_PLAYER" == *"rhythmbox"* ]]; then	
  player='rhythmbox'
  icon='rhythmbox-notplaying'
else 
  player='lollypop'
  icon='org.gnome.Lollypop-symbolic'
fi

if [[ "$ART_URL" == *file://* ]]; then 
  base64img=$(base64 -w 0 < "${ART_URL//file:///}")
else
  base64img=$(curl -s "${ART_URL//large/t200x200}" | base64 -w 0)
fi

PLAYBACK_STATUS=$($COMMAND_BASE org.freedesktop.DBus.Properties.Get string:org.mpris.MediaPlayer2.Player string:PlaybackStatus)
if [[ $PLAYBACK_STATUS == *"Playing"* ]]; then
  TITLE="| iconName=media-playback-start"
  PLAY_PAUSE_TOGGLE="Pause | iconName=media-playback-pause bash='$PLAY_PAUSE' terminal=false refresh=true"
elif [[ $PLAYBACK_STATUS == *"Paused"* ]]; then
  TITLE="| iconName=media-playback-pause"
  PLAY_PAUSE_TOGGLE="Play | iconName=media-playback-start bash='$PLAY_PAUSE' terminal=false refresh=true"
else
  TITLE="| iconName=$icon" 
  PLAY_PAUSE_TOGGLE="Play | iconName=media-playback-start bash='$PLAY_PAUSE' terminal=false refresh=true"
fi

if [ "$PLAYERS" == "" ]; then echo "---"; fi
echo "$TITLE"
echo "---"
if [ "$base64img" != "" ]; then echo "| image=$base64img imageWidth=200 imageHeight=200 terminal=false"; fi
if [ "$SONG_TITLE" != "" ]; then echo "<b>$SONG_TITLE</b>"; fi
if [ "$ARTIST" != "" ]; then echo "$ARTIST"; fi
if [ "$SONG_TITLE" != "" ] && [ "$ARTIST" != "" ]; then echo "---"; fi
echo "$PLAY_PAUSE_TOGGLE"
echo "Next | iconName=media-skip-forward bash='$NEXT' terminal=false refresh=true"
echo "Previous | iconName=media-skip-backward bash='$PREVIOUS' terminal=false refresh=true"
if [[ $player == *"rhythmbox"* ]]; then 
  echo "Show | iconName='$icon' bash='$player' terminal=false"
  echo "Quit | iconName=window-close bash='pkill $player' terminal=false"
fi

from gnome-shell-extension-mpris-indicator-button.

JasonLG1979 avatar JasonLG1979 commented on June 8, 2024

I think that for Chrome with their integrated mpris control this is no longer needed

Like I said their implementation is broken. A bunch of other stuff is broken also. Last I checked none of the "can" props actually worked. Play, pause, next and whatnot may still work but the can props are used to tell you what functionality to expose. Again this is not my bug. I'm pretty forgiving when it comes to the spec and I do a pretty good job, I think, of gracefully exposing and hiding features based on what the player says that it supports. I can only do so much. The extension reads all of the properties and decides what to expose based on those properties if a player doesn't even bother to do the bare minimum it's not my problem. It's the player's bug.

from gnome-shell-extension-mpris-indicator-button.

JasonLG1979 avatar JasonLG1979 commented on June 8, 2024

There are really 2 options.

  1. Completely ignore a player who's canControl property is not true and not even add it at all to the list of players.

  2. Treat canControl as a visible toggle for the player in menu so that if it did change to true it would show up.

In either case until Chrome fixes their shit implementation it wouldn't show up in the extension.

from gnome-shell-extension-mpris-indicator-button.

webmastak avatar webmastak commented on June 8, 2024

There are really 2 options.

I think Chrome will not fix it because they implemented the built-in functionality for managing mpris.

So it’s worth applying the first option.

I liked the scroll buttons on the track, in Chrome built-in functionality for managing mpris.
This can be implemented in mpris-indicator-button?

from gnome-shell-extension-mpris-indicator-button.

JasonLG1979 avatar JasonLG1979 commented on June 8, 2024

I think Chrome will not fix it because they implemented the built-in functionality for managing mpris.

I don't even know if that's mpris?

So it’s worth applying the first option.

My concern is that other players may also set canControl at least initially to false also. The video player Celluloid does in the short list of players I've tested so far.

I liked the scroll buttons on the track, in Chrome built-in functionality for managing mpris.
This can be implemented in mpris-indicator-button?

What does it do? Scrolling already does stuff in the extension. There is a lot of mouse wheel and keyboard shortcut functionality.

https://github.com/JasonLG1979/gnome-shell-extension-mpris-indicator-button/wiki/User-Guide

from gnome-shell-extension-mpris-indicator-button.

webmastak avatar webmastak commented on June 8, 2024

What does it do?

This is similar to Position Slider, only with the help of buttons, when pressed, moves accelerated along the track forward or backward.

I circled them in the screenshot:
https://i.imgur.com/aQT7oz0.png

I don't even know if that's mpris?

I don’t even know, but for some reason they broke mpris.
Using the chrome://flags/#global-media-controls turns on if disable.

I noticed in Rhythmbox, if you do Raise / Minimize Toggle and it is minimized using the Tray Icon plugin (which minimizes the Rhythmbox if you close it), when I do Raise, the spinner at the mouse cursor spins for a long time.

from gnome-shell-extension-mpris-indicator-button.

JasonLG1979 avatar JasonLG1979 commented on June 8, 2024

This is similar to Position Slider, only with the help of buttons, when pressed, moves accelerated along the track forward or backward.

Oh, I thought you were talking about the mouse wheel scroll buttons. Nope, there is no plans to enable any sort of seeking. that's goes back to the whole position slider thing.

I don’t even know, but for some reason they broke mpris.
Using the chrome://flags/#global-media-controls turns on if disable.

Yep, I know.

I noticed in Rhythmbox, if you do Raise / Minimize Toggle and it is minimized using the Tray Icon plugin (which minimizes the Rhythmbox if you close it), when I do Raise, the spinner at the mouse cursor spins for a long time.

I don't use Rhythmbox nor that plugin. By default Rhythmbox has pretty reasonable behavior. If something is playing and you close the window it hides if nothing is playing it quits. I'm not really sure why you'd need a tray icon plugin with the combination of that behavior and mpris desktop integration?

If Rhythmbox is in the menu that means that the MPRIS interface is still up.

Raising in this extension works like this:

If a window is present it directly activates that window, otherwise if there is no window but a shellApp for the player it activates the shellApp, which basically has the same affect. Otherwise if there is no window and no shellApp and the player's canRaise property is true the mpris raise method is called. If there is no window, no shellApp and canRaise is false or non-existent nothing is done.

from gnome-shell-extension-mpris-indicator-button.

webmastak avatar webmastak commented on June 8, 2024

I can’t figure out how to make it so that if canControl = false do not show the player if there are several or do not show mpris-indicator-button if there is only one player.

I wanted to quickly make a hack, it didn’t work out. (

You could tell how to do it?

from gnome-shell-extension-mpris-indicator-button.

JasonLG1979 avatar JasonLG1979 commented on June 8, 2024

You could tell how to do it?

I'm working on it. My solution so far is to ignore any player that's canControl property is not true. When I say ignore I mean totally reject it really, as in don't add it to the menu, throw an error logging message and ban it for that session (technically as long as the extension is enabled during that session. Disabling and re-enabling the extension would clear the ban list). The ban is so that there would be only one error message per session per misbehaving player. I want logs for bug reports but in this case there's no need for more than one really. There's no need to spam the logs.

I'm still doing some tweaking.

from gnome-shell-extension-mpris-indicator-button.

webmastak avatar webmastak commented on June 8, 2024

Waiting for fix )

from gnome-shell-extension-mpris-indicator-button.

JasonLG1979 avatar JasonLG1979 commented on June 8, 2024

Waiting for fix )

Calm down. I'm still testing it with various players.

from gnome-shell-extension-mpris-indicator-button.

JasonLG1979 avatar JasonLG1979 commented on June 8, 2024

@webmastak there, 691888e makes sure players are MPRIS spec compliant and makes sure canControl is true otherwise the player is ignored.

from gnome-shell-extension-mpris-indicator-button.

webmastak avatar webmastak commented on June 8, 2024

Yes, this is what was needed, thanks for the correction. )

from gnome-shell-extension-mpris-indicator-button.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.