kdeconnect-kde/plugins/pausemusic
Weixuan Xiao f1843cb492 Improve D-Bus implementation on macOS
Better patch to replace !218.

- Auto and quick detection of previous D-Bus instance;
- Remove private D-Bus compile definition, only use it on macOS without an existing D-Bus instance;
- Safe reboot after crashes because the indicator is not relating on the kdeconnectd to run a D-Bus session;
- Safe exit after clicking on `Quit` in the systray.


More details in commit logs:

Only enable private D-Bus on macOS because the other platforms do not
need them.
The app should be able to easily detect the session bus from the env
DBUS_LAUNCHD_SESSION_BUS_SOCKET from launchd through launchctl.
Because https://gitlab.freedesktop.org/dbus/dbus/-/blob/master/dbus/dbus-sysdeps-unix.c#L4392
shows that it is the only probing method on macOS with launchd.

The D-Bus session bus can be easily found from launchd/launchctl
with DBUS_LAUNCHD_SESSION_BUS_SOCKET env. It can be an external one
(installed from HomeBrew) or an internal one (launched by a previous
instance followed by a crash).

The indicator helper on macOS can now automatically detect whether we can use a potentially
(with launchd/launchctl env set, or KDE Connect macOS
private_bus_address set) existed and usable session bus.
If previous bus is usable, just try to launch the kdeconnectd with us.
Otherwise, launch a private D-Bus daemon, export the launchd/launchctl
env, and run a kdeconnectd instance.

Everything works better and quicker now :)
2022-04-12 05:40:03 +00:00
..
CMakeLists.txt Port from KPluginSelector to new KPluginWidget class 2021-12-15 08:24:22 +01:00
kdeconnect_pausemusic.json SVN_SILENT made messages (.desktop file) - always resolve ours 2022-02-07 01:45:12 +00:00
kdeconnect_pausemusic_config.qml Add autoResume to pausemusic_config.qml 2021-07-02 04:05:18 +00:00
org.mpris.MediaPlayer2.Player.xml Generat 2020-01-21 02:55:46 +00:00
pausemusic_config.cpp kcm: Fix showing plugins' configuration 2022-03-21 18:03:45 +01:00
pausemusic_config.h Convert license headers to SPDX expressions 2020-08-17 09:48:10 +00:00
pausemusic_config.ui [pausemusic] Add option to not unpause music once call has finished. 2020-05-20 21:44:33 +00:00
pausemusicplugin-win.cpp pausemusicplugin-win: rewrite plugin 2021-06-22 12:57:13 +05:30
pausemusicplugin-win.h pausemusicplugin-win: rewrite plugin 2021-06-22 12:57:13 +05:30
pausemusicplugin.cpp Improve D-Bus implementation on macOS 2022-04-12 05:40:03 +00:00
pausemusicplugin.h Convert license headers to SPDX expressions 2020-08-17 09:48:10 +00:00
README Move the plugins into a different top-ĺevel directory 2014-06-14 16:34:11 +02:00

This simple plugin will just listen to "kdeconnect.telephony" like the telephony
plugin does. It reads the field "event", to see if it is "ringing" or "talking"
and then pauses all the music/video players reachable through MPRIS. When the
same kind of package is received but the boolean "isCancel" is set to true, it
will resume the playback of all the paused sources.