From 902bfe950eca5b606cbfa7fd997f495cb8870c02 Mon Sep 17 00:00:00 2001 From: Corbin Davenport Date: Sun, 18 Dec 2022 17:22:16 -0500 Subject: [PATCH] Add keyboard shortcut --- js/settings.js | 5 +++++ manifest.json | 6 ++++++ settings.html | 8 ++++++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/js/settings.js b/js/settings.js index bf626f3..287affb 100644 --- a/js/settings.js +++ b/js/settings.js @@ -30,4 +30,9 @@ document.querySelectorAll('input,select').forEach(function (el) { }) }) +// Open keyboard shortcut +document.querySelector('#mastodon-keyboard-shortcut').addEventListener('click', function() { + chrome.tabs.create({ url: 'chrome://extensions/shortcuts#:~:text=Share%20to%20Mastodon' }) +}) + loadSettings() \ No newline at end of file diff --git a/manifest.json b/manifest.json index 8ed3b83..6dc5d09 100644 --- a/manifest.json +++ b/manifest.json @@ -17,6 +17,12 @@ }, "default_title": "Share this page to Mastodon" }, + "commands": { + "_execute_action": { + "suggested_key": "Ctrl+Shift+S", + "description": "Share current page on Mastodon" + } + }, "permissions": [ "contextMenus", "storage", diff --git a/settings.html b/settings.html index 3e306c3..d81b12c 100644 --- a/settings.html +++ b/settings.html @@ -17,14 +17,18 @@
-