Remapping of hardware buttons

Hello sailors, i am using xa2, x10+ and xz2c. On the XA2 with screen protector it is really a pain to swipe from the edge of the screen to show the apps overview. It would be really nice to show the desktop with the camera button on the side! Can someone give me a hint, how to do this? It should be really easy, when you know where to look at…


ok, found out that KEY_CAMERA_FOCUS is 0x210 and KEY_CAMERA_SNAPSHOT is 0x2fe. anybody knows how to add/modify actions triggered, for example show task switcher? also want to mention mce-tools and sf-button-monitor (which is not working for me)…
edit: found the place for adding the action at /usr/share/lipstick-jolla-home-qt5/main.qml, but still not knowing the command to show home/desktop

1 Like

There is a not really used or actively maintained home key support feature in mce+lipstick that just might still work for your purposes… requires root, but something like:

printf "[EVDEV]\nKEY_CAMERA_SNAPSHOT=KEY_HOME\n" > /etc/mce/99-camera-key-hack.ini
systemctl restart mce

After which mce treats camera key as home key → when pressed mce informs lipstick which then backgrounds the currently active app.

(It should also power up display if blanked, but that bit does not work well with on-demand proximity sensor use that is used e.g. in xa2. And as that remapping is for mce only, ui is still going to get camera key events - which might produce interesting situations e.g. with camera application.)

And in case you wish to return back to normal camera key behaviour:

rm /etc/mce/99-camera-key-hack.ini
systemctl restart mce

i think best solution would be to add: onPress: { Lipstick.compositor.goToSwitcher(“false”)} and maybe toggle torchlight (via dbus) on double-press to the ShutterKey section of main.qml

Thank you.
But which main.qml ?

in /usr/share/lipstick-jolla-home-qt5/, but phone may become unbootable, so be carefull (backup, ssh, no reboot until fix)!

1 Like

i can remap the behaviour of onPressAndHold, but neither onPress, onClicked or onPressed is working for the shutter button… any idea where to look at for the right syntax? btw, i am using the pressAndHold for toggling flashlight, even when device is locked and also mapped the button via mce to show the switcher with short press.

hi @mankir ,
can you tell me, what exactly i need to do, to enable flashlight on longpress?

cuz im kinda a noob regarding such stuff

thanks cvwild

Hi i will try to post the file or give a patch later, but it is not for noobs anyway… First you have to set up ssh access and enable it, try to restart lipstick to prove it works! Make a backup of the file and be sure to know how to restore it, as almost every typo will give you an unresponsive UI! Then you have to look at the main.qml, and “simply” change the section, where it calls camera service and change it to use torchlight service: Using D-Bus System Features in Sailfish OS / Sudo Null IT News

i have already set up ssh, i also already used it, i am also used to terminal.
i just meant that im a noob regarding sailfish (sry, wasnt very clear)
my problem is, that i dont know any of the commands to use f.i. for restarting lipstick (that is kinda the DE i presume?)
with backup of the file you mean just copying it to another place and afterwards replacing the messed up one?

thank you for quick response

Unfortunately i lost the file with the update, but you only have to change the parameters of the call to (“toggleFlashlight”, undefined) and the iface/service/path in the DBusInterface according to the link in my previous post. Also consider to change the id and enabled: true, but this is optional.

ShutterKeyHandler {
    // for now playing it safe and allowing only if device is properly unlocked
    enabled: !lipstickSettings.lockscreenVisible
    onPressAndHold: {"showViewfinder", "")

ThemeEffect {
    id: vibraEffect
    effect: ThemeEffect.PressWeak

DBusInterface {
    id: cameraInterface

    iface: ""
    service: ""
    path: "/"

i dont get what that link should tell me,
i see the toggleflashlight thing, but what the f shall i write in the dbus section?
i just thought you could tell me how that file should look like


what i should do is following right?:
i have to call tHe function “toggleFlashlight” in the file that i define im the dbus interface section

but what do i have to write in that file to turn the Flashlight on? or is toggleFlashlight already the dbus command?

At the bottom of the link there are most of available interfaces described and there is even an example more on top how to toggle the flashlight. No additional file necessary, AS the dbus interfaces are built in. There is also an API overview at official jolla site, but it laggs some information…

To toggle flashlight from command line, paste the following and hit enter;

dbus-send --type=method_call --print-reply --dest=com.jolla.settings.system.flashlight 
/com/jolla/settings/system/flashlight com.jolla.settings.system.flashlight.toggleFlashlight

As for mapping to a button, no idea, sorry, but the command given above does work, tested just now on Xperia 10 ii