DEV Community

Cover image for Keep your Windows always on!
Amzar
Amzar

Posted on

1

Keep your Windows always on!

When you're working on something else that needs away from the keyboard, your Windows always automatically locks due to the setting (because you don't have admin access to change the setting due to company restrictions).

Usually, people will open YouTube repeatedly, which is tiring since YouTube also has a policy that if you're idle, it will auto-pause.

Solution

With Python, you can code a script to press the key for a certain time range.

...
def main(args):
    try:
        print(progname)
        console.print(
            "\nRunning with [bold cyan]{}[/bold cyan] key.".format(args.button)
        )
        no_lock(args.button)

    except KeyboardInterrupt:
        print("\n[Process Stopped]", flush=True)

    except Exception as ex:
        print({"main": ex})
...
Enter fullscreen mode Exit fullscreen mode

Only works on Windows :)

Full Code

Github follow the installation step in README.md

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (2)

Collapse
 
sectasy0 profile image
sectasy • Edited

In my opinion, it's a silly case of "because you don't have admin access to change the setting due to company restrictions". I can't imagine that, being a programmer and not having local admin rights

Collapse
 
amzar profile image
Amzar

Indeed, but it's reality :)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay