Xperia 10 iii: make Google assistant button a camera trigger

To make up for it a bit, I have proposed a pull request to Jolla.

11 Likes

I added it for my personal use at GitHub - RikudouSage/sailfish-os-patched-mce: Mce patched for SailfishOS to make use of the assistant hardware key but everyone feel free to use it. It’s automatically built using GitHub Actions and downloadable in the Artifacts section of every build (example: Remove arm version Ā· RikudouSage/sailfish-os-patched-mce@b806b59 Ā· GitHub).

As nephros said, don’t just download system stuff without knowing what you’re doing, at the very least check that the build script (sailfish-os-patched-mce/build.yaml at master Ā· RikudouSage/sailfish-os-patched-mce Ā· GitHub) doesn’t do anything shady.

Edit: Added a patchmanager patch that enables using the button as a flashlight toggle.

2 Likes

can this but just be configurable?
One would set it for camera, other one for flashligt, another for that guest account.

1 Like

It is, unless you enable the patch in patchmanager it works simply as home button.

That would be a nice app or settings menu entry

3 Likes

The patched mce has been updated for latest SFOS version (4.5.0.16). Download for example here.

2 Likes

What I haven’t seen here is an option to immediately start the camera while the phone is on. Or is there a way to?
Also, imho the swipe from lockscreen is too slow for when you really need to get a quick shot.

2 Likes

Can it produce a stripped version? The current non-stripped version boosts the binary by +300 kB or so.

Not sure it’s worth the time to lower the size by 300 kB, but if you know how to feel free to create a pull request.

The problem is that for now I actually don’t know how to :wink: as I am totally not familiar with all these online tools. Anyway, the non-stripped binary seems to work perfectly fine, so maybe indeed it’s not worth the hassle…

As mentioned above, there is a PR, and some discussion has happened, and the groundwork of a solution has been laid.

That solution does not need/use MCE, and it can be done on a running device by editing and replacing three files.

After that you have a Camera button, like proposed in the original post.

2 Likes

UPDATE 2: Added process_name in cfg to handle a pid check to avoid duplicate processes from running. Requires correct cmdline; cfg updated below.

UPDATE: Fixed issue where command will launch immediately after closing if the button was pressed. requires full cmdline.

Here’s a ā€˜test’ solution that doesn’t require having a holder and could be run as an independent service: GitHub - Logic-gate/Keymapper at testing. You will need to build libconfig yourself.

Demo: One Time File

Assist button config; keymap.conf
command; keymapper -s /dev/input/event3

// Not recommended to run keymapper as root,
// Provide full correct-cmdline e.g /usr/bin/invoker -s -n -d 5 --type=silica-media,silica-qt5 -A -- /usr/bin/jolla-camera
// Otherwise the process will never die

name = "TEST CONFING";
keymap = {
        assist_button = {
                proc = "Camera Starting...";
                trigger = 457;
                process_name = "/usr/bin/jolla-camera"
                cmd = "/usr/bin/invoker -s -n -d 5 --type=silica-media,silica-qt5 -A -- /usr/bin/jolla-camera";
        };
};
2 Likes

Here’s an arch64 build of libconfig: 295.8 KB folder on MEGA I am just waiting for @pamoedo to respond before pushing it openrepos.

2 Likes

Here’s the official package: Keymapper | OpenRepos.net — Community Repository System.
Libconfig has also been added to openrepos here: libconfig – C/C++ Configuration File Library | OpenRepos.net — Community Repository System

3 Likes

It works
By the way, how to start flashlight with the button?

You could try something like this

// Not recommended to run keymapper as root,
// Provide full correct-cmdline e.g /usr/bin/invoker -s -n -d 5 --type=silica-media,silica-qt5 -A -- /usr/bin/jolla-camera
// Otherwise the process will never die

name = "TEST CONFING";
keymap = {
        assist_button = {
                proc = "";
                trigger = 457;
                process_name = ""
                cmd = "dbus-send --type=method_call --print-reply --dest=com.jolla.settings.system.flashlight /com/jolla/settings/system/flashlight com.jolla.settings.system.flashlight.toggleFlashlight";
        };
};

Keep in mind that you need to state the process_name if you want to launch applications; the example I used with camera has /usr/bin/jolla-camera as the process_name yet the actual command to run is from .desktop. The reason being that we want to block duplicate processes from starting based on the process_name. As for dbus-calls I am not entirely sure.

2 Likes

Nice!!
Also would be good to have systemd .service file ready to enable.

Yeah. I just wanted more people to test it first. I also thought of adding some sort of gui to set the config.

btw, an idea - react to multiple (e.g. 3) subsequent presses in 2-3 seconds (kind of 2nd function for the button)

PS I imagine lots of people would want to have it binded to fingerprint daemon restart.

Time and sequential based triggers are already in TODO :slightly_smiling_face:

1 Like