[G2 and Desire Z Android Development] the1wingedangel:
[Info]:

My only gripe about the trackpad wake mod (while it is awesome), is that we do it in order to avoid reaching for the awkwardly placed power button, but then we still have to reach for it anyway when we want to shut the screen back off. So it only helps us for half of the task.

After trying to find a way to directly map the search soft-key (or any of the soft-keys) to a power button, and failing, I've decided to come at it from a different angle. Attached you'll find a very simple app, that simply turns off the screen when clicked, along with instructions on how to map it to the search soft-key or the rosie button for sense users.

[Options]:

1.

Search key short press.

This is the method I use, as it is both the fastest and accessible from within any app. It will completely replace the search key. Single-tap it at anytime to turn off the screen. You'll need to install the app, and push the keyboard remapping file that I have also attached. Note that there are 2 different key mapping files, one for Sense ROMs and another for Vanilla. They will make the following changes:

Sense version:

-Search soft-key is now mapped to the user programmable key #2. Set it to open the Kill Screen app.

-www/com key is now TAB.

-USER 3 key, which didn't work anyway, is now BACK.

-USER 2 key, which is now not needed, is HOME.

-USER 1 key (left of the space bar) is left as normal.

Vanilla version:

-Search soft-key is now mapped to the user programmable key #3. Set it to open the Kill Screen app.

-USER 3 key, which is now not needed, is now BACK.

-USER 1 and USER 2 are left as normal.​

2.

Rosie's right button.

This is for those who want to keep the search key as normal. See my rosie remap thread here for the option to have it launch when you press the right dock button. Keep in mind you still need to install the app, and you'll (obviously) have to be viewing one of the home screens to press it.

NOTICE:

Do not post asking me to adapt this key layout to your needs, as we will end up with 500 different files before long. Instead, change it yourself! Editing this file is about as easy as it gets. You don't need anything special installed, or any programing experience whatsoever. Simply open the attached (or your own) vision-keypad.kl in any text editor (Notepad, Notepad++, etc) and change your desired key to your desired function. If you want to know what key corresponds to what number, you can boot to clockworkmod recovery --> advanced --> key test. Touch any key on the phone, and it spits out the number.

NOTICE #2:

As with any app that is given administrator permissions, you will need to remove the app from the admin list in order to uninstall it. Menu --> Settings --> Security --> Select Device Administrators --> Uncheck Kill Screen. Then uninstall as normal. You will be reminded to do this when you first give the app the admin permissions.

[How To]:

Method 1 - Install the app, then grab a copy of the modified key layout and then reboot to recovery and enter this code:

adb shell mount /system

adb shell rm /system/usr/keylayout/vision-keypad.kl

adb push [your saved file location]\keypad_owamod_xxxxx.kl.zip /system/usr/keylayout/vision-keypad.kl

Reboot and enjoy.​

Method 2 - Install the app first, then see the linked thread for how to get the modified rosie.apk