This project allows you to remap your device's volume keys to make them trigger specific tasks if particular combinations of presses and long presses of your choice are detected.
- A file manager (for the setup)
Importing the project
- Download the attached XML file
- Open Tasker and long click on a project icon/name on the bottom bar, then select "Import" and browse for the downloaded XML
- Open your file manager and create the new text file (in this precise path)
- Open the text file and setup your triggers in a structure like this:
where "task" is the name of the task to launch, "parameter" the eventual parameter to pass as %par(1) to the launched task and "scheme" is any combination of "up", "down", "longup", "longdown", separated by a "-". Here is an example from my setup:
up-down-longup=:=Computer Actions=:=turn on
up-down-longdown=:=Computer Actions=:=turn off
up-down-longup-longup=:=TV Actions=:=turn on
up-down-longdown-longdown=:=TV Actions=:=turn off
This project works even when phone is locked, but the display has to be on, for the way AutoInput works.
- You can create multiple text files with different names so that you can change the buttons behavior based on different context (time, application...). To do that you just need to set the global variable VKMDB to the file name you wish to use (just its name, without its path or its extension)
- If a command is recognized and a task is launched, the previous ringer volume value is restored. You may wish to change that to media volume instead, if your volume keys control that by default
- You can edit the profile to change the time a button has to be pressed for to set a long press; you can also change the time Tasker waits after the last button release to start looking for command matches
- You can also disable toasts and vibrations in the task, if you want
- The "Show Commands" task reads all the commands contained in the text file and shows them with a toast. You can assign it to a particular combination of button presses to quickly see which commands are available. You can also use this task to populate a custom scene, instead of just using a toast
Comments are much appreciated!
Let me know if it works!