Source: AutoHotkey.ahk
Core AHK script.
All included scripts assume the following parameter settings:
SetTitleMatchMode, RegEx ; Match window names, ahk_class, ahk_exec, etc. using regex
All AHK scripts listed below are included (referenced) in this core script. In addition the following key-bings are defined (excerpt):
Active | Key | Action | Description |
---|---|---|---|
|
Open Terminal |
Runs one of (first available): Terminus, Hyper, ConEmu, Powershell (open home directory). |
|
|
Run Powershell as Admin |
Runs Powershell as Administrator. |
|
|
SSH |
Focus / launch various SSH sessions (KITTY). |
|
|
Browser |
Focus / launch browser (Chrome). |
|
|
Editor |
Focus / launch editor (VS Code). |
|
|
Paste to Editor |
Copy selection, paste into editor (newline), and switch back to original window. |
|
|
Focus / launch mail client (Outlook). |
||
|
Web Search |
Web search for current text selection. |
|
|
Explorer |
Windows "Explorer" Run window explorer (default: |
|
|
Show Desktop |
Windows "Show Desktop" (default: |
|
|
Run |
Windows "Run Dialog" (default: |
|
|
Move Window |
Move active window to 100x100 of second screen. |
|
|
Move Window |
Move active window negative by window decoration (center window content, e.g. hide decoration for game in windowed mode). |
Source: KeyMap.ahk
Some basic key(re-)maps. Note that my default keyboard layout is Colemak:
Keybiding excerpts (some disabled in my current setup):
Active | Key | Action | Description |
---|---|---|---|
|
|
Faster paging than mouse-wheel. Replaces prev./next (usually useless) binding. |
|
|
|
See above … |
|
|
|
Easier media key access (also useful if dedicated keys not available). |
|
|
|
See above … |
|
|
|
See above … |
|
|
|
See above … |
|
|
|
See above … |
|
|
|
See above … |
|
|
Close current window |
Same as Alt-F4 |
|
|
Kill current window (process) |
Easily kill app if not responding |
|
|
Toggle CapsLock |
Noone really needs CapsLock nowadays but sometimes it is activated for no apparent reason, so it’s good to have a key-binding to deactivate it. |
|
|
|
If, for some strange twist of faith, I’m forced to use a german QWERTZ keyboard, the otherwise useless |
|
|
|
Classic lisp hacker / emacs mapping, but also practical in daily life, since |
|
|
|
Home-row access to brackets ( |
|
|
|
Home-row access to brackets ( |
|
|
|
Home-row access to brackets ( |
Additional (currently disabled) mappings exist for:
-
German umlauts accessible on default german keyboard positions +
AltGr
(e.g.AltGr-;
→ö
) or like on common international layout (AltGr) position (e.g.AltGr-p
→ö
).-
The latter is already the case with the international US Colemak layout.
-
-
CapsLock
→Backspace
-
Already default with Colemak layout (partially not the case in the past).
-
-
CapsLock
→Control
-
Old hacker mapping (e.g. from emacs users) but no longer preferred by me. Ctrl already easily accessible but
backspace
requires leaving home-row, so I preferbackspace
instead.
-
Source: WindowTracking.ahk
A script that tracks window details, like window id, class, process id, process executable and process name, in global variables allowing visualization in a tooltip and copy-to-clipboad. Intended to be used as a Windows / AutoHotkey development tool.
By pressing Win-F8
the mouse cursor monitoring mode is activated. While active, a tooltip like the following will be shown and updated whenever the mouse cursor focuses on a new window:
Instead of following the mouse cursor it’s also possible to update the tooltip whenever the active window changes (e.g. on alt-tab).
The script includes a blacklist that ignores windows like windows task-bar/-choose, desktop, the AHK tooltip itself and other windows that usually doesn’t want to capture. These blacklisted windows are still captured, but in a separate set of variables (single last blacklisted window only).
By pressing Win-Shift-F8
the active window monitoring mode is activated, additionally showing details of the last blacklisted window:
The hotkeys Win-(Alt-)F8
toggle the tooltip (on/off). While active the tooltip will update either every time the mouse curser hovers above a new window (Win-F8
, track_active = false
) or whenever a new window is activated (Win-Alt-F8
, track_active = true
).
; win-F8 -> toggle mouse hover tooltip without blacklisted windows
#F8::_toggleShowTrackedWindows() ; clipboard on close, show final tt 5sec
;#F8::_toggleShowTrackedWindows(,,0,0) ; no clipboard, close immediate
;#F8::_toggleShowTrackedWindows(,,2) ; always clipboard (each change)
; win-shift_F8 -> toggle active window tooltip with blacklisted windows
#+F8::_toggleShowTrackedWindows(true, true) ; bl + clipboard on close, show final tt 5sec
;#+F8::_toggleShowTrackedWindows(true, true, 0, 0) ; bl + no clipboard, close immediate
;#F8::_toggleShowTrackedWindows(true, true, 2) ; bl + always clipboard (each change)
Per default the tooltip content is copied to the clipboard when monitoring is stopped (toggle off). Alternatively it is possible to continuously update the clipboard (on every window change) or to not update the clipboard at all. See the code documentation of _toggleShowTrackedWindows
and the examples above.
The clipboard text contains the same information as the tooltip but in a slightly simplified/cleaner format using \t
as column delimiter:
ACTIVE WINDOW: |
|
active_id |
0x831b5a |
active_title |
README.adoc - dotfiles - Visual Studio Code |
active_class |
Chrome_WidgetWin_1 |
active_pid |
343836 |
active_procname |
Code.exe |
PREVIOUS WINDOW: |
|
previous_id |
0xd61bb4 |
previous_title |
AutoHotkey Community - Index page - Firefox Developer Edition |
previous_class |
MozillaWindowClass |
previous_pid |
172388 |
previous_procname |
firefox.exe |
This script tries to provide the "copy on selection" and "middle-click paste" features known from X Windows.
Allows middle-click (MButton
) paste in most apps, with "click-through" (~
) support (for apps that treat middle-click in a special way, e.g. navigation in 3D/CAD apps), and special rules for individual apps like e.g. KITTY/Putty/Firefox (MButton
paste configurable) or common terminals (Ctrl-Shift-v
).
Key | Function |
---|---|
|
Paste text into the current app (key binding depending on app, default |
|
Same as above but enclose the pasted text into double-quotes |
This one is a bit tricky. For now the script is not able to identify whether a text window / editor is active (with a text selection) or not. It is only able to identify that a drag action was performed with the mouse. Since there are any number of possible drag actions that could be performed, intentionally (e.g. drag-drop file) or unintentionally (e.g. drag slightly when clicking an action button) this approach is not very reliable. In addition, in many cases it is not desired that a selected text is automatically copied to the clipboard (e.g. select text to override / compare it with the clipboard content). That’s why this feature is currently disabled (in my scripts), it would need additional work an restrictions (e.g. terminal windows only) to be usable in an acceptable manner. Since most windows terminals already support copy on selection out of the box, there is currently no immediate need for this feature.
Source: ConfineMouse.ahk
This scripts confines the mouse to a window’s screen area, either of the window currently below the mouse cursor (default) or the active window. The confinement area can optionally be reduced by a fixed margin to exclude the window decoration.
Mouse cursor confinement is sometimes desired when working in a mouse-heavy application or games (e.g. in windowed mode), especially in a multi-screen environment. The scripts helps avoiding exiting the working area and prevent unwanted clicks (e.g. taskbar, different app, etc.).
Key | Function |
---|---|
|
Toggle window confinement to the window currently below the mouse cursor with a fixed margin, excluding the window decoration. |
|
Same as above but confined to the full window size, include decoration. |
Source: SendToWindow.ahk
This script sends a sequence of keys to the current window (optional), switches to a target window, sends another key sequence (optional), and finally switches back to the previous window.
Key | Function |
---|---|
|
Copy (text only) to clipboard, switch to code editor, paste text switch back. |
|
Copy (text only) to clipboard, switch to code editor, press |
|
Switch to mpv/netflix/youtube an pause playback (using space) |
The following (configurable) steps are executed in sequence:
-
Optionally clear the clipboard (
clipboard_mode > 0
) -
Optionally send a series of keys (
source_keys
) to the active window -
Optionally wait for the clipboard (
clipboard_mode > 0
) -
Optionally stop if clipboard dose contain something other than text (
clipboard_mode == 0
) -
Switch to the
target_window
-
Optionally send a series of keys (
target_keys
) to the target window -
Switch back to the previously active window
Note that the default parameters are set to copy text only (clipboard_mode = 1
) using Ctrl-c
(source_keys = "^c"
) and Ctrl-v
(target_keys = "^v"
).
;; copy text only to Notepad++ (no fancy stuff)
_sendToWindow("ahk_class i)^Notepad\+\+$")
;; copy text only to emacs using Ctrl-y to paste
_sendToWindow("ahk_class i)^Emacs$",, "^y")
;; switch to mpv/netflix/youtube an pause playback (using space)
_sendToWindow("^(.* mpv|Netflix .*|.* YouTube .*)$", "", "{Space}", 0)
;; copy to KITTY SSH session (host 10.0.23.12) using Shift-Insert, finally press Return
_sendToWindow("i)10.0.23.12.*ssh.*Kitty",, "+{Insert}{Return}")
;; copy to WordPad into a new line and add newline after pasting, copy non-text too (e.g. images)
_sendToWindow("ahk_class WordPadClass",, "{End}{Return}^v{Return}", 2)
Some game specific hotkeys and functions.
Source: PathOfExile.ahk
Requires functions from Commons.ahk
Key | Function |
---|---|
|
Panic button. Use all flasks in random order with random intermittent delay. |
|
Enter the hideout (if possible, e.g. from cities/camps). |
Source: Skyrim.ahk
Key | Function |
---|---|
|
Load Riften Honeyside house using console command (considered a cheat, no official fast travel) |
|
Load Riften Thieves Guild Headquarters using console command (considered a cheat, no official fast travel) |
Source: Divinity.ahk
Source: Diablo3.ahk
Source: Diablo2Resurrected.ahk
Source: GrimDawn.ahk
Icon pack by Icons8