From b81ef61b466ace2478f4ed54efb4ce9e8fe3cfcc Mon Sep 17 00:00:00 2001 From: Stephen Nilsen Date: Wed, 22 Mar 2023 11:23:29 -0500 Subject: [PATCH] Various fixes: #1 Bad insertion position behavior on Windows key hold * This was already fixed in a previous release #6 Cmd + Tab (hold) does not allow to use Left and Right arrow keys #8 Requires Administrator rights --- README.md | 2 +- mac.ahk | 63 +++++++++++++++++++++++++++++++++++-------------------- 2 files changed, 41 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 0ac8ea5..8cc438d 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ This [AutoHotKey script](./mac.ahk) seeks to deliver all the **superior** MacOS 2. Create a new `mac.ahk` file in the location of your choice. I recommend `%userprofile%/Documents/AutoHotKey/mac.ahk`. 3. Open your newly created file in a text editor such as Notepad. 4. Copy the contents of this [mac.ahk](./mac.ahk) into the file you created and save changes. -5. Run the file by double-clicking it in Windows Explorer (click Yes when asked to grant admin rights to the script; this is required). +5. Run the file by double-clicking it in Windows Explorer. --- ## Buy me a coffee (optional) ☕ diff --git a/mac.ahk b/mac.ahk index 29e4aa6..ed6b401 100644 --- a/mac.ahk +++ b/mac.ahk @@ -7,21 +7,6 @@ ; ! Ctrl (because of remapkey). For example, `Send, ^!a` would press Ctrl+Alt+A, and Send, ^{Home} would send Ctrl+Home. Note: ^A produces a different effect in some programs than ^a. This is because ^A presses Ctrl+Shift+A and ^a presses Ctrl+A. If in doubt, use lowercase.Sends Ctrl. For example, Send, ^!a would press Ctrl+Alt+A, and Send, ^{Home} would send Ctrl+Home. Note: ^A produces a different effect in some programs than ^a. This is because ^A presses Ctrl+Shift+A and ^a presses Ctrl+A. If in doubt, use lowercase. ; & An ampersand may be used between any two keys or mouse buttons to combine them into a custom hotkey. -; Relauch as admin if not already running as admin -full_command_line := DllCall("GetCommandLine", "str") - -if (!(A_IsAdmin or RegExMatch(full_command_line, " /restart(?!\S)"))) -{ - try - { - if (A_IsCompiled) - Run *RunAs "%A_ScriptFullPath%" /restart - else - Run *RunAs "%A_AhkPath%" /restart "%A_ScriptFullPath%" - } - ExitApp -} - #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. ; #Warn ; Enable warnings to assist with detecting common errors. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. @@ -39,14 +24,46 @@ Ctrl & Tab::AltTab ^q::Send, !{f4} ; Insertion point movement -^Left::Send, {Home} -^Right::Send, {End} -^Up::Send, ^{Home} -^Down::Send, ^{End} -+^Left::Send, +{Home} -+^Right::Send, +{End} -+^Up::Send, +^{Home} -+^Down::Send, +^{End} +^Left:: + Suspend, On + Send, {Home} + Suspend, Off +return +^Right:: + Suspend, On + Send, {End} + Suspend, Off +return +^Up:: + Suspend, On + Send, ^{Home} + Suspend, Off +return +^Down:: + Suspend, On + Send, ^{End} + Suspend, Off +return ++^Left:: + Suspend, On + Send, +{Home} + Suspend, Off +return ++^Right:: + Suspend, On + Send, +{End} + Suspend, Off +return ++^Up:: + Suspend, On + Send, +^{Home} + Suspend, Off +return ++^Down:: + Suspend, On + Send, +^{End} + Suspend, Off +return #Left:: Suspend, On Send, ^{Left}