jsmitar / playbar2

Mpris2 Client for Plasma5
GNU General Public License v3.0
58 stars 14 forks source link

Keyboard shourtcut to easily move from player to player #37

Closed kupiqu closed 6 years ago

kupiqu commented 6 years ago

I'd like to have a shortcut to move to next source. Would it be possible?

Also, I see in settings an option for "Toggle window media player", which at first I thought it was exactly this. But I don't see this shorcut does anything... Can you please clarify what is this functionality about?

Thank you!

jsmitar commented 6 years ago

Of course

I'd like to have a shortcut to move to next source. Would it be possible?

Show the window of the current source, If this does not work for you, it could be a problem with the mpris2 interface of your mediaplayer

Also, I see in settings an option for "Toggle window media player"

kupiqu commented 6 years ago

Of course

Thanks!

Show the window of the current source, If this does not work for you, it could be a problem with the mpris2 interface of your mediaplayer

Oh wow, that's amazing for online players in particular! The browser may be out of focus and the player in a background tab, yet the shortcut gives you back the player :)

I also tested it in dragonplayer and works too. It doesn't seem so in SMPlayer though. I may contact its dev to let him know...

EDIT: it also works for minimized windows, for local players and via browser :)

jsmitar commented 6 years ago

I also tested it in dragonplayer and works too. It doesn't seem so in SMPlayer though. I may contact its dev to let him know...

Please do it, I also use SMPlayer very often. BUGS

kupiqu commented 6 years ago

I just sent him an email as I did at other times before... don't have an account at sourceforge :/

jsmitar commented 6 years ago

The feature is complete, try it if you want.

kupiqu commented 6 years ago

Awesome, works so great!

jsmitar commented 6 years ago

almost perfect, I found a small bug, I'll fix it soon.

jsmitar commented 6 years ago

ok fixed, check the master

kupiqu commented 6 years ago

Thanks!

kupiqu commented 6 years ago

Please do it, I also use SMPlayer very often. BUGS

It isn't actually a bug in SMPlayer. Please see:

SMPlayer dev comment:

There's already code to raise the window in the mpris2 code, however it seems most desktops ignore it because they don't allow a window to go foreground on its own. The dragonplayer uses a specific function from the KDE libraries to do it (KWindowSystem::forceActiveWindow), but I can't use the KDE libraries, otherwise smplayer will depend on a lot of KDE packages.

Indeed, I see the reaction of SMPlayer in the taskbar asking for focus, but there is not special kwin rule that can give it to it automatically... That's unfortunate 

Dragonplayer works as SMPlayer dev described and browsers do too, I guess because the plasma-browser-integration extension must cover this thing among others.

Do you think there could be something Playbar could do here to give focus to non-KDE players when requested?

Many thanks in advance!

kupiqu commented 6 years ago

It may be possible according to SMPlayer dev:

Maybe the call to that function can be done by playbar2. According to the KDE documentation that function should only be used by "pagers and similar tools".

https://api.kde.org/frameworks/kwindowsystem/html/classKWindowSystem.html#aecb213d950a6615fc0e961273d72e166

jsmitar commented 6 years ago

I have to think about it, there are still other things I want to improve.

Do you think there could be something Playbar could do here to give focus to non-KDE players when requested?

kupiqu commented 6 years ago

Sure.

It would be a very nice complement for SMPlayer (my default local media player) but it's certainly not urgent :)

If you want I can open another issue, which can stay quiet until you decide to consider it (if you eventually do).

jsmitar commented 6 years ago

You can do it if you want. So I will keep this feature in mind.