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).
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?
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.
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)
}
}
}
@nephros The .72 OS update contains a new version of mce. Would it be possible for you please patch this new version for support of the 10 IIIās third button, and share the resulting RPM with me? I do not have a build.merproject.org account to build it myself and currently no access to the computer with build toolsā¦ So Iād be extremely grateful for you help in this regardā¦
Done!
I repeat my warning to any readers though:
https://build.merproject.org/package/show/home:nephros:sailfishos/mce
FAT WARNING: this is a crucial system package. Do NOT just download an RPM from a random dude on a forum and install it.
What is the easiest way to apply such patch? Apart from editing manually or using patch
command? Could we use patchmanager for it?
Done, too!
Iāve got that button working again and Iām happy as hell! Thank you so much @nephros!
Itās a binary, so after patching the sources you need to compile itā¦
No, I know the MCE is a binary and I need to install it. But then you need to patch compositor.qml
for the desired function. And is the only way to manually edit it, or use patch
, or could we somehow use patchmanager?
If someone upload it to online catalog then yes.
Here you have instructions how to do it GitHub - sailfishos-patches/patchmanager: Patchmanager for SailfishOS
I do use Patchmanager for that. My patch (to make that button work as flashlight toggle) is as follows:
--- 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)
}
}
}
Couldnāt make patchmanager approach work, but I just used patch
and it worked! Such a cool feature, hope Jolla will introduce it at some point!
An alternative way to achieve this is to write a service for it. Basically something that listens for EV_KEY codes and values and then runs a command if a condition is met. I am currently using Keymapper which I wrote for the pro1. I dont recommend it since youāll need to build libconfig
locally and it works on a holder
and trigger
principle which is usefull if you have a keyboard. Meaning that for any given trigger(ev_code) to function, a holder(ev_code) needs to be registered. For example, the volume down button as the holder(114) needs to pressed, then the assist button as the trigger(457) is pressed to run a command defined in the config file.
I am slowly easing my back to community after a long absence; I might rework this as a stand alone application/service for the 10 III.
Hello Iāve only been using Sailfish for a few days and one thing is the biggest flaw that bothers me. (I switched from the previous Xperia XZ1c directly to the 10 III with Sailfish)
I noticed that button on side of phone is not used on Sailfish.
Is it possible to make it work like on older Xperias (with android) as a camera button, so it launches camera ready to take a photo (even if phone is lockedā¦)?
Lightning fast photo taking without having to unlock first, open the camera, is really the best feature on xperia phones.
You can launch the camera direcrtly from the lock screen by swiping up down.
Is there easy way to get that flashlight code installed? I read the whole thread but I have no idea where to start after installing the patch manager. There is nothing ready related to this in the āweb catalogā.
Before the patchmanager part, youād first need to build (or download from @nephros) and install patched mce
binary replacing the original /usr/sbin/mce
executable (lacking support for that button) with the one patched by @nephros. Only then the patchmanager part can do anything.
The patched mce is here: Show home:nephros:sailfishos / mce - SailfishOS Open Build Service
Then, for the patchmanager part, youād need to copy the patch code I posted earlier in this thread to a file called unified_diff.patch
and then create another file called patch.json
with the following content:
{"description": "Maps Xperia 10 III's Google Assistant button (unused in SFOS) to Flashlight toggle", "name": "Google Button as Flashlight", "display_name": "Google Button as Flashlight", "category": "other", "author": "whoever", "version": "1.0.0", "compatible": ["4.4.0.72"]}
then create a folder called e.g. google_button_flashlight
in /usr/share/patchmanager/patches/
and copy both unified_diff.patch
and patch.json
files there. After that the patch should be visible in Patchmanagerā¦
I canāt submit it to the Patchmanagerās web catalog for easy installation, because without the mce part it wouldnāt work anyway.
Iām sorry everyone, but I have taken down the downloadable RPMs.
As mentioned above, this modification is potentially dangerous, and if you want it, you must build the package yourself. I realize that is a nuisance, but I do not want to take responsibility for things that break when people do not heed warnings.
All the things you need are there in the OBS repository (i.e. the patch itself, source tarball and .spec file).
All those years studiously ignoring the winblows button only to witness the coming of the google button. Sigh.