Code Monkey home page Code Monkey logo

ahk-keyboard-locker's Introduction

AutoHotkey Keyboard Locker

This is an AutoHotkey script you can use to temporarily block keyboard input. When your keyboard is locked by this script, keypresses will be caught by the script and blocked, until you unlock your keyboard again.

What is it for?

  • Allowing a baby/toddler to tap away on your keyboard without messing up your system.
  • Defending against your cat that walks across or sleeps on your keyboard.
  • Locking your keyboard while wiping it clean.
  • Messing with coworkers.
  • Blocking coworkers from messing with you.

Note: This is not security software and is easily bypassed. Only use it for convenience, not security.

How to use it

You can either use the latest executable release, or run the script itself. Both can be accessed here.

Running the executable

Download the latest release, place it where you want, and run keyboard-locker.exe. Don't forget to grab settings.ini from the release as well.

Running the .ahk script

  1. Install AutoHotkey version 1.x in order to run .ahk scripts. Not tested with AutoHotkey version 2.
  2. Download the latest release and extract the files where you want.
  3. Run keyboard-locker.ahk.
  4. Lock the keyboard either by pressing the default shortcut Ctrl+Alt+k, or by right clicking on the tray icon and selecting Lock keyboard.
  5. Unlock the keyboard either by typing the default password unlock, or by right clicking on the tray icon and selecting Unlock keyboard.

Settings

Various settings can be changed by editing settings.ini. You can change the following settings.

  • change the keyboard shortcut or password
  • disable the keyboard shortcut or password
  • disable tray notifications
  • automatically lock on open
  • automatically exit on unlock
  • lock the mouse as well

The settings file contains explanations for each setting.

Known issues

  • Some media keys or Windows shortcuts may not be blocked.
  • Some keys (especially modifiers) may get "stuck" after unlocking, requiring you to press them again to get them "unstuck".
  • There is sometimes a slight delay after typing the password before the keyboard is unlocked.

Feel free to submit a PR if you have improvements for these issues!

Potential future improvements

  • Stealth mode: hide the tray icon and disable tooltips on lock, making it slightly more difficult to bypass the script.
  • Temporary password: change the password at run time to avoid using the one that is readable in the script itself.
  • Unlock timer: automatically unlock after a period of time.
  • Inactivity lock: automatically lock after a period of inactivity.
  • Scheduled lock: automatically lock and unlock on a schedule.

Credits

This script is inspired by the Keyboard Locker script from this HowToGeek article, which in turn was based on a script by an AutoHotkey forum user named Lexikos (the original forum thread appears to be lost due to forum move, but was originally found here).

ahk-keyboard-locker's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

ahk-keyboard-locker's Issues

lock/unlock by mouse clicking icon

would it be possible to lock and unlock the keyboard by clicking the icon on the system tray?
thanks

EDIT: I was able to do it by adapting two lines of code from another script and i´m finding it very useful, in case anyone wants to try it, i created a fork with the minor changes.
Thank you for this script.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.