Double-Tap to SleepThis is my favourite trick on an Android phone with root access. Cyanogenmod has Double-Tap the Status Bar To Sleep, but , frankly, it sucks balls. Because please, the status bar? If you're reaching that high, you might as well use the power button anyway. Also, it doesn't work. Or, for me, with cm11, it didn't work. It does in cm12. But still, it's the status bar. So, without further ado, how to set up your Android phone to go to sleep when you double tap the screen.
You'll need root access, of course, but you'll also need a launcher that monitors gestures. Apex, Nova, more or less any of the others, but not the Google Now Launcher, and not Trebuchet. I used to use HD Launcher. These days I prefer Nova. Basically, you want to get into the settings for Behaviour and/or Gestures and have the launcher perform a "go to sleep" instruction of some kind when the screen is double-tapped (or swiped, or single tapped, or whichever gesture floats your boat and the launcher supports). Thing is, of course, there is no native "go to sleep" instruction. You have to find a way for the launcher to access one. Thus...
Method Number One: Xposed Framework + Gravity Box.The
Xposed Framework does nothing obvious by itself. It's only the framework after all. What it is is a powerful access tool for customization modules. The modules introduce changes in the way your Android presents itself to you and what tools you have available. One of the more popular modules is Gravity Box, which comes in
Gravity Box [JB] and
Gravity Box [kk] flavours. (It's also available for Lollipop, but Xposed for Lollipop is only Alpha release so far - see
Xposed development forum for discussions various.) Gravity Box is basically a big ole collection of popular customization modules that do all sorts of pretty and useful things. If you already have cyanogenmod, many of those things are on your phone already. But one of the things Gravity Box does that Cyanogenmod doesn't, is make Sleep an accessible command. So basically...
(1) Install and activate Xposed Framework.
(2) Install Gravity Box module
(3) Activate Gravity Box within the Xposed Framework
(4) In your launcher gesture/behaviour settings, find and assign to double tap the Gravity Box sleep command.
(I forget how to do step 4 exactly - you're assigning either an "App" setting to double tap or a "Shortcut" setting - whichever lets you find Gravity Box actions.)
Method Number Two: TaskerWhere Xposed is a powerful tool for customization,
Tasker is a powerful tool for automation. It's bizarrely difficult to understand, not at all intuitive, but once the process of creating "tasks" is realized, you can assign pretty much any bunch of Android processes to pretty much any trigger. Or so they say. I personally have never worked out how to do this except insofar as I worked out how to create a task I like to call Go To Sleep.
(1) Install
Tasker(2) Open Tasker
(3) Swipe to Tasks.
(4) Find and press at the bottom of the screen, "+".
(5) You'll be prompted to enter a task name. Enter whatever you like, but some variation on "Go to sleep" is to the point.
(6) On the new screen you're presented with, find and press again at the bottom of the screen, "+".
(7) Select Action category: Display
(
Select Display Action: System Lock
(9) There is probably some other damn thing to do here but I just hit the "Back" button until Tasker exits.
(10) In your launcher gesture/behaviour settings, find and assign to double tap the Task you just created.
(For step 10 in Nova for instance, you're assigning a shortcut to the double tap, specifically "Task Shortcut" > "[
Whatever you named the Task you just created]".)
Now obviously this is all a bit complex and the instructions are vague and a bit dubious, but the rewards are mighty and the double tap is fun. Whichever method you choose, you get powerful new access to your phone in terms either of customization or automation, and trust me, you'll be wondering how you ever lived without the double tap.
And, yes, there is a double-tap to wake, but that requires a custom kernel and sucks battery like nobody's business. I don't use it.
You're welcome.