Shake phone to turn on the flashlight

Here I’ve 80% left after 8 hours.

Well, maybe my phone had an unrelated issue, I will just try again.

I think the problem you have might be that com.jolla.settings.system.flashlight service is only available when its needed. So once it goes away QDBusInterface is invalid and doesn’t recover those signal connections. Constructing QDBusInterface object and connect its signals on QDBusServiceWatcher signals should work better.

A bit aside but QDBusInterface is generally not recommended because it does blocking D-Bus introspection on construction. However it doesn’t really matter in this case because it’s not blocking anything important. (More of a problem for UI apps usually, and even there it depends on how it is used.)

(Note: I improved the first paragraph afterwards to make it more clear.)

4 Likes

Shaking the phone to turn on the flashlight works fine.
But I also have a problem:

I have activated the brightness sensor via mce-tools, so that the clock is displayed when I take my phone out of my pocket (like the Nokia n900). Now the problem is that this activates the whole screen and not only the clock is displayed.
In this case, it is possible that the flashlight will turn on if I move the phone too fast while doing this.

I have two ideas to solve this problem:

  • Add a delay of a few seconds until the flashlight is turned on by shaking it.
  • Can you tell if the screen turns on after you press the power button or the brightness sensor? If it does, simply disable the sensor.

I have noticed the flashlight turning on, when putting the phone away to my pocket, lap or table. To me this seems like the threshold is a bit too low in my use. I wonder if requiring repetitive motion (e.g. 3 repeats) could ease this somewhat.

1 Like

Mmm, I would rather expose DBus methods so that you can disable ShakeTorch at your preference. What do you think?

EDIT: I’m stupid, you can already do that via systemd session bus.

However, please anyone, let’s use GitHub to track any issue/feature request in the app.

I’ve had the same. I put the phone away and only a few minutes later when picking it up I noticed that flash was on (it wasn’t visible until then because the phone was on a soft surface - pillow or something like that). That was on the 10 III, but then I’ve had it also on the XA2U in similar circumstances.

Maybe for “security reasons” (both power consumption and to prevent unnecessary wear of the flash LED) there should be some timer to turn it off automatically after some (excessive) period of time?

A very simple page in Settings to conveniently disable/enable the service would be very useful, much easier and quicker than using the terminal and systemctl for it…

1 Like

I think MCE has ways to determine that the phone isn in the pocket rather than out.

If that is exposed on DBus the program could check it before enabling the light.

That’s in the works.

1 Like

Oh, I should have checked github first. That’s really fantastic!

Maybe for “security reasons” (both power consumption and to prevent unnecessary wear of the flash LED) there should be some timer to turn it off automatically after some (excessive) period of time?

This is also in the works. I’m adding a configurable timeout to the Settings page.

2 Likes

An option to deactivate ShakeTorch would be nice. But turn ShakeTorch of don´t solve my problem.

You are right, Github is a better place for that. I open a ticket.

Thanks for your work!

Edit: Ticket on Github is opened.

That’s great, thank you!

:astonished: Really? I’m always in fear that I will throw my phone 20m away, because I have to shake it quite hard to turn the torch on.

Not for me, shaking two times works, similar to my MotoG9.

Hi, sometimes the light starts while the phone is stored in my pocket.
I’d like to add a terminal command to my Situations-profile, which disables WiFi, whenever I put the phone (display off) in my pocket:
So, is there a terminal command to switch out the torch?

The daemon runs as user systemd service. systemctl --user stop harbour-shaketorch will do it.

The UI to stop ShakeTorch has been merged in the repo as well and will be released this week (hopefully).

Hi, I tried systemctl --user stop harbour-shaketorch, which didn’t work. I tried again with a frsh rebootet phone, the flashlight stays on.