Skip to content

Commit

Permalink
Release v1.5.1
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit 516ccb5
Author: John Dunning <[email protected]>
Date:   Thu Dec 24 12:58:35 2020 -0800

    Update version to 1.5.1

    Update releases/index.md for 1.5.1.

commit 2e55baa
Author: John Dunning <[email protected]>
Date:   Thu Dec 24 12:22:36 2020 -0800

    Handle malformed URLs in quickey-storage.js

    Use decode() instead of decodeURI() when looking for URLs with Chinese characters.  Fix #43.
    Show the Edge store's extension ID when the ctrl-tab page is loaded in Edge.  Fix #41.
    Update quickey-ctrl-tab.ahk to support both Chrome and Edge Chromium.
  • Loading branch information
fwextensions committed Dec 24, 2020
1 parent 181e00f commit 472e332
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 60 deletions.
8 changes: 8 additions & 0 deletions docs/assets/css/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ body {
line-height: 1.4em;
}

body p.edge {
display: none;
}

body.edge p.edge {
display: block;
}

h2 {
margin: 60px 0 20px;
}
Expand Down
23 changes: 19 additions & 4 deletions docs/ctrl-tab/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ comments: true

Do you wish Chrome had the same <b><kbd>ctrl</kbd><kbd>tab</kbd></b> tab navigation as Firefox? There are two key features Chrome is missing:

- **Switch to the previously used tab**
- <strong>Switch to the previously used tab</strong>
- Press <b><kbd>ctrl</kbd><kbd>tab</kbd></b> and then release both keys

- **Select an open tab from a menu using the keyboard**
- <strong>Select an open tab from a menu using the keyboard</strong>
- Press <b><kbd>ctrl</kbd><kbd>tab</kbd></b> but then release just <kbd>tab</kbd>
- Press <kbd>tab</kbd> repeatedly to select older tabs in the menu
- Release <kbd>ctrl</kbd> to switch to the selected tab
Expand Down Expand Up @@ -70,6 +69,8 @@ That's it!

Now you can press <b><kbd>ctrl</kbd><kbd>tab</kbd></b> to switch to the previously used tab, and press it again to switch back. Unlike [Option 2](#option-2) below, you can toggle between *only* the two most recent tabs, but the advantage is you can switch back and forth as quickly as you like.

<p class="edge">Note that if you're using Microsoft Edge and installed *QuicKey* from the Chrome Web Store, you'll need to replace the `mcjciddpjefdpndgllejgcekmajmehnd` string in the code above with `ldlghkoiihaelfnggonhjnfiabmaficg`, which is *QuicKey*'s extension ID in the Chrome Web Store.</p>


## <a name="option-2"></a>Option 2: Use <b><kbd>ctrl</kbd><kbd>tab</kbd></b> to switch to any recently used tab

Expand Down Expand Up @@ -102,7 +103,9 @@ That's it!

Now you can press <b><kbd>ctrl</kbd><kbd>tab</kbd></b> to switch to the previously used tab. If you press it again within .75 seconds, while the icon is inverted <img src="../img/icon-38-inverted.png" style="height: 19px; vertical-align: text-bottom;">, you'll switch to the tab before that. You can press <b><kbd>ctrl</kbd><kbd>shift</kbd><kbd>tab</kbd></b> to navigate in the other direction.

(You should always be cautious about copying code from a website and running it in DevTools, but even if you don't know JavaScript, it's hopefully clear what the snippet above is doing. It's calling a private `updateExtensionCommand()` function twice to set <b><kbd>ctrl</kbd><kbd>tab</kbd></b> and <b><kbd>ctrl</kbd><kbd>shift</kbd><kbd>tab</kbd></b> keyboard shortcuts. The "ldlgh..." string is *QuicKey*'s extension ID, which you can see in its [Chrome webstore link](https://chrome.google.com/webstore/detail/quickey-%E2%80%93-the-quick-tab-s/ldlghkoiihaelfnggonhjnfiabmaficg), so this code won't affect any other extensions you have installed.)
<p class="edge">Note that if you're using Microsoft Edge and installed *QuicKey* from the Chrome Web Store, you'll need to replace the `mcjciddpjefdpndgllejgcekmajmehnd` string in the code above with `ldlghkoiihaelfnggonhjnfiabmaficg`, which is *QuicKey*'s extension ID in the Chrome Web Store.</p>

(You should always be cautious about copying code from a website and running it in DevTools, but even if you don't know JavaScript, it's hopefully clear what the snippet above is doing. It's calling a private `updateExtensionCommand()` function twice to set <b><kbd>ctrl</kbd><kbd>tab</kbd></b> and <b><kbd>ctrl</kbd><kbd>shift</kbd><kbd>tab</kbd></b> keyboard shortcuts. The "ldlgh..." string is *QuicKey*'s extension ID, which you can see in its [Chrome Web Store link](https://chrome.google.com/webstore/detail/quickey-%E2%80%93-the-quick-tab-s/ldlghkoiihaelfnggonhjnfiabmaficg), so this code won't affect any other extensions you may have installed.)


## <a name="option-3"></a>Option 3: Use <b><kbd>ctrl</kbd><kbd>tab</kbd></b> to switch to a recent tab via a menu (Windows only)
Expand All @@ -111,6 +114,8 @@ Now you can press <b><kbd>ctrl</kbd><kbd>tab</kbd></b> to switch to the previous

This option provides the closest experience to Firefox. It lets you quickly press and release <b><kbd>ctrl</kbd><kbd>tab</kbd></b> to switch to the previous tab, or you can keep holding <kbd>ctrl</kbd> to select from a menu of recent tabs.

If you've already installed *QuicKey*, make sure that the keyboard shortcut for the *Activate the extension* command is still set to the default, <b><kbd>alt</kbd><kbd>Q</kbd></b>. Otherwise, the AutoHotkey script listed below won't respond correctly to <b><kbd>ctrl</kbd><kbd>tab</kbd></b>.

1. [Install QuicKey](https://chrome.google.com/webstore/detail/quickey-%E2%80%93-the-quick-tab-s/ldlghkoiihaelfnggonhjnfiabmaficg).

2. Download and install [AutoHotkey](https://www.autohotkey.com/download/ahk-install.exe), a Windows utility for remapping keys.
Expand All @@ -131,6 +136,16 @@ The other default shortcuts continue to work, so you can still press <b><kbd>alt


<script>
if (navigator.userAgent.includes("Edg/")) {
for (const el of document.getElementsByTagName("code")) {
el.textContent = el.textContent.replace(/ldlghkoiihaelfnggonhjnfiabmaficg/g,
"mcjciddpjefdpndgllejgcekmajmehnd");
}

document.body.classList.add("edge");
}


function copyCode(
index)
{
Expand Down
106 changes: 53 additions & 53 deletions docs/ctrl-tab/quickey-ctrl-tab.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SetBatchLines, -1 ; Script will never sleep
ListLines Off ; Omits subsequently-executed lines from the history
#KeyHistory 0 ; Disable key history
SendMode Input ; Recommended for new scripts due to its superior speed and reliability
SetTitleMatchMode 2 ;
SetTitleMatchMode RegEx ;
SetTitleMatchMode Fast ;
SetKeyDelay, -1, -1 ;

Expand All @@ -15,7 +15,7 @@ SetKeyDelay, -1, -1 ; No delay at all will occur after each keystroke sent b
SetWinDelay, 0 ; Changed to 0 upon recommendation of documentation


ChromeTitle := "Google Chrome"
BrowserName := "Google Chrome|Edge"
DeveloperToolsWindowTitle := "Developer Tools"
TicksToToggleTab := 450
MinUpDownTicks := 200
Expand All @@ -25,31 +25,31 @@ SawCtrlTab := 0

HasPopupWindowSize()
{
Width := 0
WinGetPos, , , Width, , A
return Width between 500 and 505
Width := 0
WinGetPos, , , Width, , A
return Width between 500 and 505
}


IsPopupActive()
{
global ChromeTitle, DeveloperToolsWindowTitle
global BrowserName, DeveloperToolsWindowTitle

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


#IfWinActive ahk_exe Chrome.exe
#IfWinActive ahk_class Chrome_WidgetWin_1

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

Send !{q}
OpenedTickCount := A_TickCount
Send !{q}
OpenedTickCount := A_TickCount

Loop {
; check for the popup window every 100ms
Expand All @@ -68,32 +68,32 @@ IsPopupActive()
; arrow, since it might have closed while we were sleeping, and
; then it would scroll the previously active window
if IsPopupActive() {
Send {Down}
}
Send {Down}
}

Exit
}
}
} else {
Send {Down}
}
} else {
Send {Down}
}

return
return
}


; Ctrl+Shift+Tab
^+Tab::
{
if WinActive(ChromeTitle)
{
Send !{q}
OpenedTickCount := A_TickCount
} else {
Send {Up}
}

return
if WinActive(BrowserName)
{
Send !{q}
OpenedTickCount := A_TickCount
} else {
Send {Up}
}

return
}


Expand All @@ -102,48 +102,48 @@ IsPopupActive()
{
if (SawCtrlTab = 1)
{
SawCtrlTab := 0
SawCtrlTab := 0

if (A_TickCount - OpenedTickCount < TicksToToggleTab)
{
TicksToSleep := OpenedTickCount + MinUpDownTicks - A_TickCount
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 (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}
Send !{q}

return
}
return
}

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

return
return
}

#IfWinActive


#If WinActive("ahk_exe Chrome.exe") and IsPopupActive()
#If WinActive ahk_class Chrome_WidgetWin_1 and IsPopupActive()

; Ctrl+Right, Ctrl+Shift+Right, Ctrl+Shift+Down
^Right::
^+Right::
^Down::
^+Down::
{
Send {Down}
return
Send {Down}
return
}


Expand All @@ -153,16 +153,16 @@ IsPopupActive()
^Up::
^+Up::
{
Send {Up}
return
Send {Up}
return
}


; Ctrl+Esc
^Esc::
{
Send {Esc}
return
Send {Esc}
return
}

#If
13 changes: 12 additions & 1 deletion docs/releases/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,22 @@ comments: true
# Release history


## 1.5.1 - 2020-12-24

### Fixed

* Malformed URLs in open tabs could cause *QuicKey* to not load properly on browser launch.

* The [`quickey-ctrl-tab.ahk`](https://fwextensions.github.io/QuicKey/ctrl-tab/quickey-ctrl-tab.ahk) AutoHotkey script that enables <b><kbd>ctrl</kbd><kbd>tab</kbd></b> to navigate the recents menu now supports Edge 79+.

* The [page](https://fwextensions.github.io/QuicKey/ctrl-tab/) about enabling <b><kbd>ctrl</kbd><kbd>tab</kbd></b> support now shows the correct extension ID when loaded in Edge.


## 1.5.0 - 2020-04-29

### Added

* [Pinyin](https://en.wikipedia.org/wiki/Pinyin) strings in the search query will now match Chinese characters in tab titles and URLs. This option is enabled by default if Chrome's language is set to Chinese or if Chinese characters are found in any currently open tabs titles or URLs.
* Typing [Pinyin](https://en.wikipedia.org/wiki/Pinyin) in the search query will now match Chinese characters in tab titles and URLs. This option is enabled by default if Chrome's language is set to Chinese or if Chinese characters are found in any currently open tabs titles or URLs.

### Fixed

Expand Down
4 changes: 3 additions & 1 deletion src/js/background/quickey-storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ define([
"cp",
"shared",
"lib/objects-have-same-keys",
"lib/decode",
"./storage",
"./get-default-settings",
"./constants"
], function(
cp,
shared,
objectsHaveSameKeys,
decode,
createStorage,
getDefaultSettings,
k
Expand Down Expand Up @@ -106,7 +108,7 @@ define([

// decode the URL, since Chinese characters in tab
// URLs seem to get encoded when returned by the API
if (hanPattern.test(title) || hanPattern.test(decodeURI(url))) {
if (hanPattern.test(title) || hanPattern.test(decode(url))) {
DefaultSettings[k.UsePinyin.Key] = true;

break;
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.5.0",
"version": "1.5.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 472e332

Please sign in to comment.