How to avoid the pesky HTC One (M8) lock key at the top, and use a simple swipe instead
We have to admit that the larger those phone screens get, the less enthusiastic we get about power/lock keys that are situated on the top of the handset. They are much harder to get to without looking, requiring you to stretch your finger quite a bit to reach them up top, when operating the phone with one hand. That's why we were a bit miffed when we saw that in the new, taller HTC One (M8), the lock key is still placed at the top, asking for even more digit gymnastics.
Granted, HTC introduced the double-tap-to-wake gesture with the One (M8), but locking the display from within the interface still requires you to do some palm yoga. The modding community, however, lives and breathes for such issues, and there is now a much better way to lock your new HTC One (M8), provided that you have a rooted handset, with installed recovery for flashing custom ROMs and mods.
The mod, adapted by the developer flar2, is aptly named Sweep2sleep, and works just as it says on the tin - you can lock the phone by simply swiping right to left over the black notification bar at the top of the display. Here's what you need to do, in order to avoid the pesky lock button at the top of your HTC One (M8):
1. Download the Sweep2sleep mod as a flashable ZIP file;
2. If you don't have custom recovery installed, you can use the newbie-oriented HTC One (M8) All in One Toolkit by XDA-Devs member hasoon2000. It lets you easily unlock the bootloader, root, and install custom recovery. Bear in mind that, as usual, you will do this at your own risk;
3. Using your recovery method of choice, flash the Sweep2sleep mod on the One (M8);
4. If you have a custom ROM, the mod should load automatically at boot, but if you have stayed with the stock Sense 6.0, you need to add the following module:
su
insmod /system/lib/modules/s2w_mod.ko
5. If for some reason you wish to remove the Swipe2sleep mod, use the following code in recovery:
adb shell rm /system/lib/modules/s2w_mod.ko /system/etc/init.d/40s2w
That's it, you can now double-tap on the screen to wake the phone up, and simply swipe over the navigation bar right to left with your thumb to lock it back again, without using the uncomfortably-placed power button at the top of the HTC One (M8)
source: flar2 (XDA-Devs)
Things that are NOT allowed: