Serranya / deadbeef-mpris2-plugin

A rewrite of the seemingly orphaned deadbeef-mpris-plugin originally written by HuangCongyu
GNU General Public License v2.0
65 stars 8 forks source link

Make gio-unix optional #49

Closed kuba160 closed 2 years ago

kuba160 commented 3 years ago

This will allow plugin to compile plugin on non-unix platforms such as Windows (and maybe macos). The plugin behavior on linux is unchanged.

saivert commented 3 years ago

This codepath is just an attempt to circumvent the focus stealing prevention in Gnome shell and possible KDE. If you can call an action in Deadbeef that shows the main window successfully without Gnome shell intercepting it and presenting the notification "click to show deadbeef" then you can just use a single codepath without this build time option. I believe this is irrelevant on Windows as there is no such behavior there.

Through trial and error I found out you could launch the .desktop file and this seemed to work for me when I added the code and the dependency on gio-unix.

There is also another way that involves using g_monotonic_time() on gtk_window_present_with_time(). See: https://github.com/DeaDBeeF-Player/deadbeef/commit/95ca904a1e0d54706cebb5f386ec525761f20afe

kuba160 commented 3 years ago

Using action_show_mainwin does indeed have focus stealing issues, including Windows, but I guess it is better than nothing. Unless there is a simple solution that works well with focus stealing without gio-unix, using action_show_mainwin as fallback is a good compromise in my opinion.

saivert commented 3 years ago

The MPRIS spec is ridiculous as it is and some servers don't even implement the Raise method and some MPRIS clients actually handle the raising of apps themselves by invoking the .desktop file based on the app id provided by the MPRIS server in case the Raise method isn't implemented. I think the MPRIS spec should be revised and they should just get rid of the Raise method since there are standardized ways to deal with this in desktop shells.

I'm just saying that if you can find a way that works universally feel free to just permanently get rid of the gio-unix dependency and implement the universal solution. Otherwise this PR is probably fine. I have no objections to it. Just giving my 2 cents.

saivert commented 2 years ago

Closing as this pull request source branch contains unrelated changes.