summaryrefslogtreecommitdiffstats
path: root/plugins/media-keys/README.media-keys-API
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 14:51:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 14:51:55 +0000
commit86b7f1a83d7db9c912f32b29c32e1124c0a6454d (patch)
tree42a7ff7c6885e99e0669d07b104df11b2bf387b6 /plugins/media-keys/README.media-keys-API
parentInitial commit. (diff)
downloadgnome-settings-daemon-86b7f1a83d7db9c912f32b29c32e1124c0a6454d.tar.xz
gnome-settings-daemon-86b7f1a83d7db9c912f32b29c32e1124c0a6454d.zip
Adding upstream version 3.38.2.upstream/3.38.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--plugins/media-keys/README.media-keys-API51
1 files changed, 51 insertions, 0 deletions
diff --git a/plugins/media-keys/README.media-keys-API b/plugins/media-keys/README.media-keys-API
new file mode 100644
index 0000000..55d1a59
--- /dev/null
+++ b/plugins/media-keys/README.media-keys-API
@@ -0,0 +1,51 @@
+This is very simple documentation to gnome-settings-daemon's
+D-Bus API for media players.
+
+gnome-settings-daemon will send key press events from multimedia
+keys to applications that register their interest in those events.
+This allows the play/pause button to control an audio player that's
+not focused for example.
+
+The D-Bus API is described in gsd-media-keys-manager.c (look for
+introspection_xml), but a small explanation follows here.
+
+1. Create yourself a proxy object for the remote interface:
+Object path: /org/gnome/SettingsDaemon/MediaKeys
+D-Bus name: org.gnome.SettingsDaemon.MediaKeys
+Interface name: org.gnome.SettingsDaemon.MediaKeys
+
+2. Register your application with gnome-settings-daemon
+GrabMediaPlayerKeys ("my-application", 0)
+with the second argument being the current time (usually 0,
+or the time passed to you from an event, such as a mouse click)
+
+3. Listen to the MediaPlayerKeyPressed() signal
+
+4. When receiving a MediaPlayerKeyPressed() signal,
+check whether the first argument (application) matches
+the value you passed to GrabMediaPlayerKeys() and apply the
+action depending on the key (2nd argument)
+
+Possible values of key are:
+- Play
+- Pause
+- Stop
+- Previous
+- Next
+- Rewind
+- FastForward
+- Repeat
+- Shuffle
+
+5. Every time your application is focused, you should call
+GrabMediaPlayerKeys() again, so that gnome-settings-daemon knows
+which one was last used. This allows switching between a movie player
+and a music player, for example, and have the buttons control the
+last used application.
+
+6. When your application wants to stop using the functionality
+it can call ReleaseMediaPlayerKeys(). If your application does
+not call ReleaseMediaPlayerKeys() and releases its D-Bus connection
+then the application will be automatically removed from the list of
+applications held by gnome-settings-daemon.
+