Skip to content

Commit

Permalink
Release v1.7.1
Browse files Browse the repository at this point in the history
Use a regex to match ` + ` in shortcuts.
Resolve #66.
Tweak quickey-ctrl-tab.ahk to exclude non-Chromium browsers and clean up formatting.
Ignore whether we previously saw a ctrl-tab when handling ctrlUp, so that if the menu is already open, pressing ctrl-tab and releasing will select the item.
Update version to 1.7.1.
Update releases/index.md.
  • Loading branch information
fwextensions committed Mar 8, 2022
1 parent 7663046 commit dc084e3
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 45 deletions.
74 changes: 31 additions & 43 deletions docs/ctrl-tab/quickey-ctrl-tab.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,36 @@ SetKeyDelay, -1, -1 ; No delay at all will occur after each keystroke sent b
SetWinDelay, 0 ; Changed to 0 upon recommendation of documentation


BrowserName := "Google Chrome|Edge"
BrowserName := "Google Chrome|Edge"
DeveloperToolsWindowTitle := "Developer Tools"
TicksToToggleTab := 450
MinUpDownTicks := 200
OpenedTickCount := 0
SawCtrlTab := 0
ExcludedTitles := ["(Visual Studio Code|VSCodium)( - Insiders)?$"] ; Add patterns to this array to exclude other apps
ExcludedTitlePattern := ExcludedTitles[1]

ExcludeTitles := ["(Visual Studio Code|VSCodium)( - Insiders)?$"] ; VSCode / VSCodium

ExcludeTitle := ExcludeTitles[1]
For Idx, Title in ExcludeTitles {
; Build a string that OR's all the excluded title patterns
For Idx, Title in ExcludedTitles {
If (Idx > 1) {
ExcludeTitle .= "|" . Title
ExcludedTitlePattern .= "|" . Title
}
}


IsChromiumBasedBrowser()
IsChromiumBrowser()
{
global ExcludeTitle
global ExcludedTitlePattern

return WinActive("ahk_class Chrome_WidgetWin_1",, ExcludeTitle)
return WinActive("ahk_class Chrome_WidgetWin_1",, ExcludedTitlePattern)
}


HasPopupWindowSize()
{
Width := 0
WinGetPos, , , Width, , A

return Width between 500 and 505
}

Expand All @@ -52,17 +53,16 @@ IsPopupActive()
{
global BrowserName, DeveloperToolsWindowTitle

return WinActive("ahk_class Chrome_WidgetWin_1") and !WinActive(BrowserName) and !WinActive(DeveloperToolsWindowTitle) and HasPopupWindowSize()
return IsChromiumBrowser() and !WinActive(BrowserName) and !WinActive(DeveloperToolsWindowTitle) and HasPopupWindowSize()
}


#If IsChromiumBasedBrowser()
#If IsChromiumBrowser()

; Ctrl+Tab
^Tab::
{
if WinActive(BrowserName)
{
if WinActive(BrowserName) {
SawCtrlTab := 1

Send !{q}
Expand All @@ -72,8 +72,7 @@ IsPopupActive()
; check for the popup window every 100ms
Sleep 100

if !SawCtrlTab
{
if !SawCtrlTab {
; if this is no longer 1, it means ctrl up was heard while we
; were sleeping, so exit
Exit
Expand Down Expand Up @@ -102,8 +101,7 @@ IsPopupActive()
; Ctrl+Shift+Tab
^+Tab::
{
if WinActive(BrowserName)
{
if WinActive(BrowserName) {
Send !{q}
OpenedTickCount := A_TickCount
} else {
Expand All @@ -117,32 +115,22 @@ IsPopupActive()
; Ctrl keyup
~Ctrl Up::
{
if (SawCtrlTab = 1)
{
SawCtrlTab := 0

if (A_TickCount - OpenedTickCount < TicksToToggleTab)
{
TicksToSleep := OpenedTickCount + MinUpDownTicks - A_TickCount

if (TicksToSleep > 0)
{
; if the QuicKey popup is closed within 450ms, it switches to the previous tab.
; but if it's closed too quickly, it might not detect that it was opened, so
; make sure there's at least 200ms between opening and closing it.
Sleep TicksToSleep
}

; close the popup
Send !{q}

return
if (A_TickCount - OpenedTickCount < TicksToToggleTab) {
TicksToSleep := OpenedTickCount + MinUpDownTicks - A_TickCount

if (TicksToSleep > 0) {
; if the QuicKey popup is closed within 450ms, it switches to the previous tab.
; but if it's closed too quickly, it might not detect that it was opened, so
; make sure there's at least 200ms between opening and closing it.
Sleep TicksToSleep
}

if IsPopupActive()
{
Send {Enter}
}
; close the popup
Send !{q}

return
} else if IsPopupActive() {
Send {Enter}
}

return
Expand All @@ -151,7 +139,7 @@ IsPopupActive()
#If


#If IsChromiumBasedBrowser() and IsPopupActive()
#If IsPopupActive()

; Ctrl+Right, Ctrl+Shift+Right, Ctrl+Shift+Down
^Right::
Expand Down Expand Up @@ -182,4 +170,4 @@ IsPopupActive()
return
}

#If
#If
8 changes: 8 additions & 0 deletions docs/releases/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ comments: true
# Release history


## 1.7.1 - 2022-03-07

### Fixed

* Fix keyboard shortcut handling in Cent and any other Chromium browsers that use a plus surrounded by spaces in shortcut strings.
* Fix the `quickey-ctrl-tab.ahk` AutoHotkey script to not interfere with Chromium-based apps like VS Code.


## 1.7.0 - 2021-10-24

### Added
Expand Down
3 changes: 2 additions & 1 deletion src/js/background/get-chrome-shortcuts.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ define([
// "\u2318": "Cmd",
};
const ShortcutSeparator = "+";
const ShortcutSeparatorPattern = /\s*\+\s*/;
const MacShortcutPattern = /([\u2303\u21E7\u2325\u2318]+)(.+)/;
// Unicode chars in a regex also show up broken
// const MacShortcutPattern = /([⌃⇧⌥⌘]+)(.+)/;
Expand Down Expand Up @@ -82,7 +83,7 @@ define([
shortcutKeys = [""];
}
} else {
shortcutKeys = shortcutText.split(ShortcutSeparator);
shortcutKeys = shortcutText.split(ShortcutSeparatorPattern);
}

// make the modifier strings lowercase, remove spaces from
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "QuicKey DEV",
"short_name": "QuicKey DEV",
"version": "1.7.0",
"version": "1.7.1",
"description": "Add keyboard shortcuts to switch tabs with a Quicksilver-style search or a most recently used menu",
"author": "John Dunning",
"content_security_policy": "script-src 'self' 'unsafe-eval' https://www.google-analytics.com; object-src 'self'",
Expand Down

0 comments on commit dc084e3

Please sign in to comment.