HTC introduced their version of gesture controls to the masses when they launched the HTC One M8, and while the feature includes gestures to open the camera, start voice dialing, and unlock the device, it does not include one to lock it.
Sure, you can "knock" your screen off, but that method requires a hot-zone of sorts. Fortunately, renowned developer MohammadAG made an app that enables a new gesture to do just that, from anywhere on your screen.
The app, HTC Gesture Listener, does not require a rooted or unlocked M8, so whether you're running a completely stock or a custom ROM, you can easily add this new gesture to your device.
There's not much to actually settings up this mod. Just open the HTC Gesture Listener app, tap the Enable Device Admin button, and Activate it.
There is no need to restart your device after it installs.
Try it out by tapping anywhere on your screen with three fingers. Check out the video above for a demo. MohammadAG says that he plans on making more mods for this gesture listener, so be sure to check back every once in a while to check his progress.