CODeRUS / powermenu

Powermenu - fancy menu and configuration for power key actions
2 stars 2 forks source link

Separate action for longtap when phone is locked #5

Open equeim opened 10 years ago

equeim commented 10 years ago

In cyanogenmod there is an option to pause the music player on power button long tap. I can write .desktop file, but I want to execute it only when screen is off.

CODeRUS commented 10 years ago

i can only make separate application when phone is locked and when it's not locked, not separate action itself

equeim commented 10 years ago

Do you mean check if the phone is locked in bash script (and set .desktop file as application)?

equeim commented 10 years ago

It seems that I've solved this issue :D This script for longtap action will pause music if screen is off or show power menu of screen is on.

#!/bin/bash
status=$(cat /sys/power/wait_for_fb_status)
if [ "$status" == "off" ]; then
    dbus-send --session --type=method_call --dest=com.jolla.mediaplayer.remotecontrol /com/jolla/mediaplayer/remotecontrol com.jolla.mediaplayer.remotecontrol.Interface.executeCommand string:"toggle_pause"
else
    dbus-send --session --type=method_call --dest=com.jolla.lipstick.PowerMenuDialog /org/coderus/powermenu com.jolla.lipstick.PowerMenuDialogIf.openDialog
fi

Could you add possibility to set actions for volume buttons long tap (e.g. to change tracks)?

CODeRUS commented 10 years ago

No, volume butons can't be overriden this way :)