Skip to content

JamesMessinger/AutoHotKey

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

94 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

My Custom AutoHotKey Scripts

These are my customized scripts for AutoHotKey. These are highly tailored to my specific needs and preferences, but feel free to use them as a starting point for your own scripts.

This script simply re-maps a few keyboard keys to behave the way I prefer.

This script allows you to save and restore window layouts for different monitor setups. This is useful when undocking/re-docking a laptop to a docking station, or when connecting/disconnecting external monitors, projectors, etc.

Hotkey Behavior
Alt+Win+0 Save the current window layout for the current monitor configuration.

Depending on how many monitors are connected, the window layout will be saved in the config directory as 1-monitor-layout.txt, 2-monitor-layout.txt, etc.
Ctrl+Win+0 Restore the layout of the active window for the current monitor configuration.
Ctrl+Shift+Win+0 Restore the layout of all windows for the current monitor configuration.

The window layout file is deleted afterward. You can create a config\#-monitor-layout.default.txt file for each monitor configuration, which will be applied if there is no saved layout file.

This script is based on this script by Andrew Moore, which extends Windows 10's built-in window-snapping hotkeys to support additional window sizes and positions.

Default Windows Hotkeys
Hotkey Behavior
Win+ Snap to the left half of the screen
Win+ Snap to the right half of the screen
Win+ Maximize the window
Win+ Restore/minimize the window
Advanced Hotkeys (horizontal)
Hotkey Behavior
Alt+Win+ Snap to the left third of the screen
Alt+Win+ Snap to the right third of the screen
Alt+Win+ Snap to the middle third of the screen
Alt+Win+ Snap to the middle half of the screen
Shift+Win+ Snap to the left two-thirds of the screen
Shift+Win+ Snap to the right two-thirds of the screen
Shift+Win+ Snap to the middle two-thirds of the screen
Shift+Win+ Snap to the middle two-thirds of the screen
Advanced Hotkeys (vertical)
Hotkey Behavior
Ctrl+Win+ Snap to the top half of the screen
Ctrl+Win+ Snap to the bottom half of the screen
Ctrl+Win+ Snap to the middle half of the screen
Ctrl+Win+ Snap to the middle half of the screen
Ctrl+Alt+Win+ Snap to the top third of the screen
Ctrl+Alt+Win+ Snap to the bottom third of the screen
Ctrl+Alt+Win+ Snap to the middle third of the screen
Ctrl+Alt+Win+ Snap to the middle third of the screen
Ctrl+Shift+Win+ Snap to the top two-thirds of the screen
Ctrl+Shift+Win+ Snap to the bottom two-thirds of the screen
Ctrl+Shift+Win+ Snap to the middle two-thirds of the screen
Ctrl+Shift+Win+ Snap to the middle two-thirds of the screen
Advanced Hotkeys (centering)
Hotkey Behavior
Win+Enter Center the window on screen (big)
Alt+Win+Enter Center the window on screen (small)
Advanced Hotkeys (using the number pad)
Hotkey Behavior
Win+Numpad 7 Snap to the top-left half of the screen
Win+Numpad 8 Snap to the top half of the screen
Win+Numpad 9 Snap to the top-right half of the screen
Win+Numpad 4 Snap to the left half of the screen
Win+Numpad 5 Snap to the middle half of the screen
Win+Numpad 6 Snap to the right half of the screen
Win+Numpad 1 Snap to the bottom-left half of the screen
Win+Numpad 2 Snap to the bottom half of the screen
Win+Numpad 3 Snap to the bottom-right half of the screen
Alt+Win+Numpad 7 Snap to the top-left third of the screen
Alt+Win+Numpad 8 Snap to the top third of the screen
Alt+Win+Numpad 9 Snap to the top-right third of the screen
Alt+Win+Numpad 4 Snap to the left third of the screen
Alt+Win+Numpad 5 Snap to the middle third of the screen
Alt+Win+Numpad 6 Snap to the right third of the screen
Alt+Win+Numpad 1 Snap to the bottom-left third of the screen
Alt+Win+Numpad 2 Snap to the bottom third of the screen
Alt+Win+Numpad 3 Snap to the bottom-right third of the screen
Shift+Win+Numpad 7 Snap to the top-left two-thirds of the screen
Shift+Win+Numpad 8 Snap to the top two-thirds of the screen
Shift+Win+Numpad 9 Snap to the top-right two-thirds of the screen
Shift+Win+Numpad 4 Snap to the left two-thirds of the screen
Shift+Win+Numpad 5 Snap to the middle two-thirds of the screen
Shift+Win+Numpad 6 Snap to the right two-thirds of the screen
Shift+Win+Numpad 1 Snap to the bottom-left two-thirds of the screen
Shift+Win+Numpad 2 Snap to the bottom two-thirds of the screen
Shift+Win+Numpad 3 Snap to the bottom-right two-thirds of the screen

Installation and Usage

To get these scripts working on your computer, follow these steps:

  1. Install AutoHotKey
    You can download it here

  2. Clone this repo
    git clone https://github.com/JamesMessinger/AutoHotKey.git

  3. Create an AutoHotKey.ahk file
    When AutoHotKey starts up, it looks for a file named AutoHotKey.ahk in your Documents folder. So create a file by that name, and point it to where you cloned this repo in Step 2.

AutoHotKeyDir := "C:\Users\James Messinger\Code\AutoHotKey"         ; <--- Edit this to point to your path
Run, %A_AhkPath% "%AutoHotKeyDir%\src\AutoHotKey.ahk", %AutoHotKeyDir%
  1. Set AutoHotKey to run at startup
    Create a shortcut to AutoHotKey (C:\Program Files\AutoHotkey\AutoHotkey.exe). Then open the Windows Run utility (Win+R) and type shell:startup to open your Startup folder. Then paste the AutoHotKey shortcut in this folder.

License

All of these scripts are MIT licensed and can be used however you want. AutoHotKey is open-source too!