Skip to content

[DRAFT] AHKv1 -> AHKv2#900

Draft
donaldguy wants to merge 22 commits intorbreaves:masterfrom
donaldguy:ahk-1-to-2
Draft

[DRAFT] AHKv1 -> AHKv2#900
donaldguy wants to merge 22 commits intorbreaves:masterfrom
donaldguy:ahk-1-to-2

Conversation

@donaldguy
Copy link

@donaldguy donaldguy commented Apr 26, 2025

For a version targeted at a post-#899 HEAD, see donaldguy#1

(or https://github.com/rbreaves/kinto/pull/900/files/860e3e0820fb0572fa39c9c769f7823714a42e91..d1002229857c59b8ccc29b65b1cd196a8cb29a37

but don't overlook PR description of donaldguy#1 / commit message of 97705a3)

RedBearAK and others added 22 commits May 4, 2022 15:55
This short script enables the ability to switch between windows of the same application with Cmd+Grave (backtick).
Replacement for PR rbreaves#722. This does the same thing but in a much smarter way with fewer lines. 

Apple laptop keyboards have the PgUp/PgDn/Home/End navigation functions on Fn+arrow keys (even if not explicitly labeled on the keys). Most PC laptops also have these functions on the arrow keys, but some PC laptop keyboards have media functions (Play_Pause/Stop/Prev/Next) on the arrow keys instead. This makes it impossible to use the Fn+arrow keys for shortcuts like text selection (with Shift), or general navigation.

This optional fix for this issue (disabled by default) will cause media arrow keys to behave like an Apple keyboard when used with the Fn key. All possible modifier combinations are mapped to what they would have been without Kinto's modifier remap.

This PR creates a new tray menu item that will toggle the fix on and off, and it can be toggled with Shift+Opt+Cmd+M. The tray menu item will update with a check mark when the fix is active, and a MsgBox alerts the user when it is toggled on and off.

If desired the user can set the fix to be enabled by default by changing a single variable value near the top of kinto.ahk. The toggles to disable/enable will still function.

Companion to part of PR rbreaves#499 which is for Linux.
For Windows/AHK: 

Adds more accurate and intuitive behavior to the process of using dead keys, to match macOS more closely, and fixes some of the Switch/Case lines that weren't working as expected (Escape, Space were not actually activating).

Dead keys sequences will now place the pending diacritic accent character (e.g., umlaut [ ¨ ]) in a highlight, then either replace it with the full accented character (e.g., [ Ü ]) if there is a match, or deselect the diacritic character and exit the dead keys sequence, leaving the diacritic character visible. Any input other than Escape or Space or a matching letter will be passed through. This is a very close match for how dead keys work in macOS.

Also enabled the ability to interrupt a dead key sequence by triggering another dead key sequence, which like many other keys will just leave the original diacritic character visible and insert the new one in a highlight as the start of the new sequence. This behaves like it does on a Mac when you change your mind in the middle and do a different dead key. 

Previous PR by this name had some unforeseen issues with non-character-generating input editing keys like arrows, Backspace, and Delete, which were being ignored/disabled by the AHK `Input` command. And the uppercase accented characters were not working properly. All such issues are fixed here and thoroughly tested. 

🤞🏽 😮‍💨 🤞🏽
Finder Mods for Windows Explorer had a number of issues that needed to be fixed, primarily coming from how the comparison was being made between the `ClassNN` attribute and a list of different possible strings to match on, for certain keys and shortcuts. 

All issues with Enter, Backspace, Cmd+Backspace (Delete) and the Delete key seem to have been resolved in my testing on Windows 11. Renaming with Enter works on the desktop, and Cmd+Backspace is properly blocked to prevent deleting files on the desktop. Tab navigation shortcuts still working.
[Win] Optional fix for media arrow keys (new)

Conflict: Branched prior to rbreaves#719 's:
1. addition to tray menu of OptSpecialChars
2. extension of Alt+[various] handling by 270 lines (while making
   togglable by above)

Resolution:
1. Order menu as OptSpecialChar, then Media Arrows Fix, per expected
   use/interest (also chronological)
2. Move toggle_media_arrows_fix logic below `#If ... optspecialchars =
   1` block - to keep file block order respective to menu order

Non-conflicting intermin changes to master:
 - rbreaves#652 (Landed: f342ee4)
 - Anydesk (bab7660)
[Win] Enable Cmd+Grave (backtick) same application window switching

Nominal conflict: Force push of 35981fc (replacing cb2f08c w/ corrected
commit message)

Resolution: None needed
Mac Numpad feature

Conflicts w/ rbreaves#724 (as 3d9670b <- master [4a3bfe7 , windows: bab7660]):
1. Addition of "Media Arrows Fix" to same slot in menu (below OptSpecialChars, above Close)
2. no `toggle_media_arrows_fix` block (obviously)
3. inserts a `toggle_mac_numpad` block above `#If ... optspecialchars = 1` block

Resolution:
1. Order is OptSpecialChars, then Mac Numpad, then Media Arrows Fix - in order of expected user interest
2. toggle_media_arrows_fix is retained as in 3d9670b
3. relocates insertion of `toggle_mac_numpad` below `optspecialchars` but above `toggle_media_arrows_fix` - in order respective to menu order
…#744, & rbreaves#867 from, respectively: RedBear/patch-46 (via donaldguy/661-on-forced-master), RedBear/patch-40 (via donaldguy/harmonize-724-and-719), RedBearAK/patch-59, RedBearAK/mac_numpad_feature (via  donaldguy/harmonize-744-and-724) & RedBearAK/patch-70

w/ menu order of OptSpecialChars, then Mac Numpad, then Media Arrows Fix
& kinto.ahk logic blocks in that same order.

Common branch point [except @^2^2] is (6aa5cc5, but in `windows/`):
7b3aba9: @^1~14 = @^2~15 = @^3~5 = @^4^1~15 = @^4^2~9 = @^5~17
> @^2^2 is common from @^2^2~2 = 648819f = 7b3aba9~20

(Grand)parents are:
- @^1    rbreaves/HEAD@{2025-04-25 19:00} [@^2^ = @^4^^ = @^5~3]    (7b3aba9~..4a3bfe7)
- @^2       vvv fixed for push -f of rbreaves/master on 2022-5-14   (95e92b4)
  - @^2^2  rbreaves#661: [Win] Enable Cmd+` same app window switching       (3799224~..66ccab5)
- @^3      rbreaves#732: [Win] Enhance OptSpecialChars dead keys processing (5bf0cc2~..f0c2c00)
- @^4       vvvv, chosing numpad between arrows & chars             (b0ee59a)
  - @^4^2  rbreaves#744: Mac Numpad Features                                (7f3c95e~..d0d0bd1)
  - @^4^1    vvv w/ rbreaves#719, choosing arrows fix after OptSpecialChars (3d9670b)
  - @^4^1^2 rbreaves#724: [Win] Optional fix for media arrow keys (new)     (e3e912f~..cea4111)
- @^5       rbreaves#867: [Win] New Fixes for Finder Mods (2024-06)         (8b8e399~..044017e)
0. Landed set of open, useful PRs that modify `windows\kinto.ahk` (rbreaves#899)

1. Enabled all layouts as a vscode (though one could also use powershell `-replace` as below in 3):
  Find: `; (.*; (?:Default|MacModifiers|WinModifiers|Chromebook|CB/IBM|IBM).*)`
  Replace: `$1`

2. Ran [mmikeww/AHK-v2-script-converter](https://github.com/mmikeww/AHK-v2-script-converter)'s [`v2converter.ahk`](https://github.com/mmikeww/AHK-v2-script-converter/blob/master/v2converter.ahk) on `windows\kinto.ahk` using AutoHotKey v2.0.19[^1] on `windows\kinto.ahk`, `windows\detectUSB.ahk`

3.
    ```powershell
    git rev-parse --show-toplevel | Set-Location
    Copy-Item .\windows\kinto_newV2.ahk .\windows\kinto.ahk
    Copy-Item .\windows\detectUSB_newV2.ahk .\windows\detectUSB.ahk
    # or Move-Item if you prefer, I copied so I could continue to use the convertor diff UI

    $redisabled = Get-Content .\windows\kinto.ahk | ForEach-Object {$_ -replace '^(\s*)([^;]+?; (?:Default|MacModifiers|WinModifiers|Chromebook|CB/IBM|IBM).*)','$1; $2' }
    $redisabled | Out-File .\windows\kinto.ahk

    # Note that presence of `git config --global core.autocrlf true` has removed Carriage Returns on the (inconsistent) lines they were present on
    git status --porcelain | Select-String -Pattern '^\sM\s(.*)' | ForEach-Object {git add $_.Matches.Groups[1].Value}
    # or, you know, git commit -a
    ```

[^1]: (installed via `winget install AutoHotKey.AutoHotKey` but this is also the [version](https://community.chocolatey.org/packages/autohotkey.install) installed by

    https://github.com/rbreaves/kinto/blob/860e3e0820fb0572fa39c9c769f7823714a42e91/windows/autohotkey.ps1#L11

    and by extension by `setup.py`)
@donaldguy
Copy link
Author

Went ahead and opened the draft to squat the nice round number 🙃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants