Xperia 10 iii: make Google assistant button a camera trigger

About Lipstick, you can see it listens for that event on the mce dbus, you probably can copy that code somewhere else to do more things (but need to disable the original handler).

2 Likes

EDIT: I managed to make it work as mpris PlayPause by making this simple patch:

--- /usr/share/lipstick-jolla-home-qt5/compositor.qml	2022-08-06 22:26:20.000000000 +0200
+++ /usr/share/lipstick-jolla-home-qt5/compositor.qml	2022-08-06 22:48:32.000000000 +0200
@@ -21,6 +21,7 @@
 import Sailfish.Silica.private 1.0
 import Sailfish.Lipstick 1.0
 import com.jolla.lipstick 0.1
+import org.nemomobile.mpris 1.0
 
 import "layers"
 import "launcher"
@@ -310,6 +311,8 @@
             alarmLayerItem.parent = alarmApplicationForeground
         }
     }
+    
+    MprisManager { id: mprisManager }
 
     FileWatcher {
         id: initDoneFile
@@ -1761,7 +1764,7 @@
                 root.showUnlockScreen()
             } else if (argument === "home-key") {
                 if (!root.systemGesturesDisabled) {
-                    root.goToSwitcher(true)
+                  mprisManager.playPause() //  root.goToSwitcher(true)
                 }
             }
         }

Hurray!

One sad thing, though, is that the button is no longer read when the phone goes to sleep. So it takes waking up the device (e.g. by pressing one of the remaining buttons or using the fingerprint sensor) in order to use it. Which kind of contradicts its purpose.

I’d say that in this case Jolla is trying to save power not where they should. How much power draw can be saved by disabling button click monitoring? Microamperes?

2 Likes

Just had another idea how to use that.

As we have the Guest user function, make the button switch that account on long press.

That would enable you to hand the phone to someone, and sneakily hold that button while doing so.

They will have a functional but empty environment to examine, even though they just saw you using it. Magic!

I call it the Secret Agent Magic button, SAM.

2 Likes

Do you know what other arguments nokia.com.mce.signal provides? Compositor.qml uses “home-key” and “double-power-key”. So maybe there’s more, e.g. “double-home-key”, or some “long-press-home-key”…

If someone’s interested, the following is a patch to use that button as flashlight toggle. I’ve also added some vibration effect when the button is pressed. Same restrictions apply as above, i.e. when the phone goes to sleep the button becomes inactive, so you need to wake the the device up first.

--- a/usr/share/lipstick-jolla-home-qt5/compositor.qml	Sun Aug  7 21:53:14 2022
+++ b/usr/share/lipstick-jolla-home-qt5/compositor.qml	Sun Aug  7 23:00:04 2022
@@ -21,6 +21,7 @@
 import Sailfish.Silica.private 1.0
 import Sailfish.Lipstick 1.0
 import com.jolla.lipstick 0.1
+import QtFeedback 5.0
 
 import "layers"
 import "launcher"
@@ -310,6 +311,11 @@
             alarmLayerItem.parent = alarmApplicationForeground
         }
     }
+    
+    ThemeEffect {
+      id: vibraEffect
+      effect: ThemeEffect.PressWeak
+    }
 
     FileWatcher {
         id: initDoneFile
@@ -1738,6 +1744,13 @@
             root.PeekFilter.keyboardHeight = keyboardHeight
         }
     }
+    
+    NemoDBus.DBusInterface {
+        id: flashlightInterface
+        iface: "com.jolla.settings.system.flashlight"
+        service: "com.jolla.settings.system.flashlight"
+        path: "/com/jolla/settings/system/flashlight"
+    }
 
     NemoDBus.DBusInterface {
         bus: NemoDBus.DBus.SystemBus
@@ -1761,7 +1774,8 @@
                 root.showUnlockScreen()
             } else if (argument === "home-key") {
                 if (!root.systemGesturesDisabled) {
-                    root.goToSwitcher(true)
+                   vibraEffect.play()
+                   flashlightInterface.call("toggleFlashlight", undefined)
                 }
             }
         }
3 Likes