From 2fee120e542c7fc36bf885e72ea3b0dfb5a43e30 Mon Sep 17 00:00:00 2001 From: Sinkerine Date: Fri, 5 Apr 2019 23:54:34 -0400 Subject: [PATCH] feat(focus): Add more commands to focus child/sibling Add focusLastChild, focusPreviousSibling, focusNextSibling --- webextensions/_locales/en/messages.json | 3 +++ webextensions/background/handle-misc.js | 14 ++++++++++++++ webextensions/manifest.json | 9 +++++++++ 3 files changed, 26 insertions(+) diff --git a/webextensions/_locales/en/messages.json b/webextensions/_locales/en/messages.json index 8aa296c69..14e4753ca 100644 --- a/webextensions/_locales/en/messages.json +++ b/webextensions/_locales/en/messages.json @@ -17,6 +17,9 @@ "command_focusNextSilently": { "message": "Focus to Next Tab (don't expand tree)" }, "command_focusParent": { "message": "Focus to Parent Tab" }, "command_focusFirstChild": { "message": "Focus to First Child Tab" }, + "command_focusLastChild": { "message": "Focus to Last Child Tab" }, + "command_focusPreviousSibling": { "message": "Focus to Previous Sibling Tab" }, + "command_focusNextSibling": { "message": "Focus to Next Sibling Tab" }, "command_tabbarUp": { "message": "Scroll Tabs Up by Line" }, "command_tabbarPageUp": { "message": "Scroll Tabs Up by Page" }, "command_tabbarHome": { "message": "Scroll Tabs to Top" }, diff --git a/webextensions/background/handle-misc.js b/webextensions/background/handle-misc.js index b9855334c..606a74942 100644 --- a/webextensions/background/handle-misc.js +++ b/webextensions/background/handle-misc.js @@ -209,6 +209,20 @@ async function onShortcutCommand(command) { case 'focusFirstChild': TabsInternalOperation.activateTab(activeTab.$TST.firstChild); return; + case 'focusLastChild': + const children = activeTab.$TST.children; + if(children.length > 0) { + TabsInternalOperation.activateTab(children[children.length - 1]); + } + return; + case 'focusPreviousSibling': { + TabsInternalOperation.activateTab(activeTab.$TST.previousSiblingTab); + return; + } + case 'focusNextSibling': { + TabsInternalOperation.activateTab(activeTab.$TST.nextSiblingTab); + return; + } case 'tabbarUp': SidebarConnection.sendMessage({ diff --git a/webextensions/manifest.json b/webextensions/manifest.json index fba68f644..7d51992c8 100644 --- a/webextensions/manifest.json +++ b/webextensions/manifest.json @@ -164,6 +164,15 @@ "focusFirstChild": { "description": "__MSG_command_focusFirstChild__" }, + "focusLastChild": { + "description": "__MSG_command_focusLastChild__" + }, + "focusPreviousSibling": { + "description": "__MSG_command_focusPreviousSibling__" + }, + "focusNextSibling": { + "description": "__MSG_command_focusNextSibling__" + }, "tabbarUp": { "description": "__MSG_command_tabbarUp__ (Alt+Shift+Up)" },