Skip to content

About

Two AutoHotkey scripts that help with long Claude Code sessions.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

AutoHotkey Scripts

A pair of AutoHotkey v2 scripts for Windows that make working with Claude on a laptop less annoying.

Requires: AutoHotkey v2.0 — these will not run under v1.


ClaudeCodeMode.ahk

Toggle with Ctrl + Alt + C — keeps the machine awake so a long Claude Code run isn't cut short by the lid closing or the display sleeping.

On:

  • Sets lid-close action to do nothing on both AC and battery (requires admin)
  • Launches PowerToys Awake with --display-on true, if PowerToys is installed
  • Engages native keep-awake via SetThreadExecutionState
  • Shows a green ● CODE MODE ON pill in the top-right corner

Off: restores the previous lid behavior, closes the Awake process it started, and hides the pill.

Notes

  • Admin is optional. The script attempts to relaunch elevated (needed only for the lid setting). If you decline UAC it keeps running — you just lose the lid override; everything else still works.
  • Startup proof. A grey pill flashes top-right for ~1.5s on launch. No pill means the script isn't running, or an error dialog is waiting.
  • Crash-safe. Original lid values are written to %APPDATA%\ClaudeCodeMode.state before being changed, and restored on the next launch if the script was force-killed while on.
  • PowerToys is auto-located. Per-user and machine-wide installs are both probed, including the newer WinUI3Apps subfolder. If it isn't found, native keep-awake carries on alone.
  • Duplicate instances are closed at startup, matched by script name across the UAC boundary — so relaunching is always safe.

CopilotToClaude.ahk

Repurposes a key on your keyboard to control the Claude desktop app instead. Inspired by the Copilot key on Windows laptops.

Claude's state What the key does
Minimized Restore and focus
Visible and focused Minimize
Visible but behind Bring to front
Not running Launch it

Launch is by AUMID (shell:AppsFolder\Claude_pzs8sxrjxfjjc!Claude) rather than a file path, so app updates don't break it.


Usage

Double-click either .ahk file to run it, or drop a shortcut in shell:startup to have it load at login.

About

Two AutoHotkey scripts that help with long Claude Code sessions.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages