Skip to content

eugenesvk/Win.ahk

Repository files navigation

A collection of Windows extensions written in
AutoHotkey automation scripting language

Introduction

  • AutoHotkey main launcher, loads common and machine-specific files
  • [PCH] and aX.ahk machine-specific Auto-Execute Section and keybindings

Scripts

  • 0 Hyper as a "Hyper" modifier key when held and open a launcher app when tapped
  • xReformatPrompt avoid accidentally formatting your USB drive by auto-closing prompts with a 'Format disk' button (helpful when inserting USB drives with unrecognized formatting). Use in a separate process / compile to a standalone exe with Ahk2Exe to not block the main app
  • Home row modifier (⌂mod) without affecting fast typing (experimental)! ⌂modtap key:
    • located at the most convenient home row position (e.g., 👆🏻f)
    • on hold acts as a modifier (e.g., )
    • on a single tap acts as usual and types its letter (f)

Insert various characters and symbols

  • char ⎇› TypES typographical layout and easily insert modifier symbols like ⎇ when pressed with ⎇›
  • char🠿 insert chars on key Hold via a Mac-like Press&Hold character picker:
    sequential labels
    custom labels
    where a symbol can be inserted with a single key label, cursor keys and , or a mouse click on the symbol or the label. Symbols, labels, hold duration trigger, and a few picker styles are customizable.
  • char-AltTT add diacritics to keys by triggering an diacritic type and finishing with a key (with a tooltip hint) or insert arbitrary symbols via the same mechanism
    tooltip diacritics m to insert macron
    tooltip math symbols t to insert math
  • 6 NumPad NumPad with two prefix keys:
    • right-hand: 7...0...n.../
    • left-hand: 1...5...z...b

Mouse

  • 5 Mouse e.g., scroll ←→ with 🖱↑/🖱↓ (MouseWheel)
  • 🖰Scroll Excel horizontal scroll in Excel to be launched separately in a no-UIA Autohotkey session
  • 🖰hide on 🖮 hide mouse pointer while typing

Others

  • Tab convert into a prefix key and use 1...8 to navigate to favorite folders in a file manager or use it as a substitute for x shortcuts
  • 9 ‹␠1 as ⎇ restore physical (mapped to via SharpKeys registry override) as (e.g., f4f4)
  • 8 Language remap to keyboard layout switching (with workarounds around various window types)

Libraries

Library files in /lib used only when function by the same name is called

  • constTypES definition for the TypES typographical layout
  • constWin32 get any Windows API constant by name (full and short) (external dll/data)
    • winAPIconst_embed.dll with data embedded
    • or winAPIconst_mmap.dll with data/winAPI_Const.rkyv_data_0 data/winAPI_Const.rkyv_state
  • constWin32T translate Windows API types to DllCall types
  • constKey use ⎈1 to define a keybind instead of ^1 (only works in a function)
  • Win app/window management, including applying borderless style
  • Unicode RemoveLetterAccents
  • cfg FileExplore to toggle extensions, hidden files in Windows File Explorer
  • 4 Cursor Home Row cursor with 🠿⎇›
  • Data types and their extension
  • libFunc various helper functions
    • keyFunc register hotkeys and send functions
    • RunActivMin run a new app/switch to an existing instance, but with options to make the window borderless and pass other options
    • OpusDir_CD open a path in Directory Opus
    • HasValue checks if a value exists in an array
    • GroupHasWin check if the specified group contains the specified window (quasi-boolean)
    • libFunc Scroll ScrollHCombo horizontal scroll, picking the working sub-function depending on the window/app since ther isn't a single universal horizontal scrolling method. Unfortunately, with 'UIA' enabled fails with COM (Word/Excel...) due to some weird permissions mismatch src
    • libFunc Dbg dbgTT debugging tooltip that only shows if a global dbg var is set above a threshold, also with posion/timer arguments, less intrusive than a typical message box (though dbgMsg is also there)
  • Enumerate all conhosts and tries to find the one that maps to our console window (external) getconkbl.dll
  • UI Automation (external) UIA v2

Install

This page (the main branch of the repo) doesn't support care-free installation of individual components (e.g., launching 🖰hide on 🖮.ahk will result in warnings and might not work) or even the full combined version. So far only the following components have been separated to allow a double-click install:

Others would likely require manual modifications to import only the libraries that they require

Also, some of the scripts require external libraries not included in this repo, so copy them to Lib from:

Use

Configure

Press&Hold character picker

  • char🠿 contains the hotkey definitions and what set of symbols those hotkeys should use to show a symbol picker
  • symbol contains a few Maps of symbols that can be updated to insert whatever symbols you need
  • PressH contains a set of visual tweaks (like fonts and colors) and TimerHold hold threshold (0.4 sec by default)
  • varWinGroup contains the list of apps in the PressnHold group where the functionality is enabled
  • PressH library contains the actual PressH_ChPick function that creates the popup characte picker, and has lbl_en list of default labels used when no user defined labels are provided (non-english labels can be added to the constKey library)

Hide mouse pointer while typing

You can configure the script to ignore selected mouse behavior when you type:

  • hide mouse pointer to avoid obscuring your text caret with it
  • clicks to avoid surprising caret movements
  • wheel scrolling (on a per-direction level)
  • pointer movements within user defined horizontal/vertical threshold (to help with accidentally moving your mouse)

And further configure it to:

  • ignore key presses with modifiers, e.g., hide the pointer on a, but ignore a as that's not typing
  • work only within text fields, e.g., don't hide when using j to scroll down in an app
  • ignore specific apps (and manually tweaked to work only in specific apps)

All of these are set by changing the values of the ucfg🖰hide configuration map at the top of 🖰hide on 🖮 and reloading the script. Each value has a comment explaining what it does and what values are allowed

You can also change the keys that trigger hiding the pointer by adjusting the keys_m['en'] map for the English locale

Known issues

  • Horizontal scrolling fails with 'UIA' enabled AutoHotkey and COM (Word/Excel...) due to some weird permissions mismatch src, use 🖰Scroll Excel
  • 🖰hide on 🖮 with limit2text enabled may take ~0.3sec in some apps to determine whether the text cursor is in a text field due to using accessibility frameworks for such determination, and this might have a negative affect on other timing-sensitive typing hotkeys like modtaps. Workaround: use the standalone version

Credits