Insomnia is essentially a remake of LineageOS' Caffeine Tile, but with a few extra features.
Caffeine is a feature that allows users to force their device's display to remain on for longer than the currently set timeout, but without actually changing that timeout. If the display is manually turned off, Caffeine deactivates automatically.
Insomnia works on the same principle. Through the use of a Quick Settings Tile, you can use Insomnia to cycle through predefined screen timeout overrides: 1, 5, 10, 30 and infinite minutes. However, if you want to set your own timeout (say 1 or 2 hours), or you want to remove some of the predefined timeouts, you can do that!
Simply long-press on the added Tile and Insomnia's configuration will appear.
Insomnia doesn't need root or even ADB commands; it barely needs any set up at all. If you download from the Play Store, it's completely plug-and-play. Just add the Tile to your Quick Settings and activate it!
Insomnia uses a display overlay (SYSTEM_ALERT_WINDOW) in order to work. The overlay is a simple single, transparent pixel that is positioned offscreen, and you shouldn't even notice it's there.
If you need help, watch this quick video which shows how to add the Tile: https://youtu.be/gPWAUzEJDkY=
Your interface may not look the same, but the general process applies to all devices running Nougat or later.
PLEASE NOTE: If you are using an ASUS ZenFone, you may need to reboot after installing Insomnia for the Tile to appear. This is a bug in ZenUI!
Insomnia is open source! Check it out on GitHub: https://github.com/zacharee/Insomnia
Insomnia is also available on XDA Labs: https://labs.xda-developers.com/store/app/com.zacharee1.insomnia
XDA Thread: https://forum.xda-developers.com/general/paid-software/android-7-0-insomnia-t3831416