Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • phosh phosh
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 124
    • Issues 124
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Librem5
  • phoshphosh
  • Issues
  • #430
Closed
Open
Issue created Nov 17, 2020 by Oliver Smith@ollieparanoid

Make play button from headset toggle mpris play/pause

I'd find it very useful if the play button on headsets was able to toggle play/pause of the currently active mpris player. Then I could quickly toggle music / podcast playback from the headset without pulling out the phone.

The button is available as XF86AudioPlay, so with the following patch, I can get phosh to log a message when the button is pressed.

The mpris code to check if the player can play/pause, and to actually do it, is used in src/media-player.c already (e.g. phosh_mpris_dbus_media_player2_player_call_play_pause). However, it needs the dbus player object as first parameter, which isn't available in src/settings.c.

If this feature is wanted, it would be great if you could give me a pointer of how it should be implemented.

--- a/src/settings.c
+++ b/src/settings.c
@@ -79,10 +79,12 @@ G_DEFINE_TYPE (PhoshSettings, phosh_settings, GTK_TYPE_BIN)
 
 static void raise_volume (GSimpleAction *action, GVariant *param, gpointer self);
 static void lower_volume (GSimpleAction *action, GVariant *param, gpointer self);
+static void play (GSimpleAction *action, GVariant *param, gpointer self);
 
 const GActionEntry action_entries[] = {
   { "XF86AudioLowerVolume", lower_volume, },
   { "XF86AudioRaiseVolume", raise_volume, },
+  { "XF86AudioPlay", play, },
 };
 
 static void
@@ -224,6 +226,14 @@ raise_volume (GSimpleAction *action, GVariant *param, gpointer self)
   change_volume (PHOSH_SETTINGS (self), 1);
 }
 
+static void
+play (GSimpleAction *action, GVariant *param, gpointer self)
+{
+  g_return_if_fail (PHOSH_IS_SETTINGS (self));
+
+  g_debug ("Play button pressed");
+}
+
 
 static void
 update_output_vol_bar (PhoshSettings *self)
Edited Nov 17, 2020 by Oliver Smith
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking