diff --git a/icons/postify-48.png b/icons/postify-48.png new file mode 100644 index 0000000..0ab8975 Binary files /dev/null and b/icons/postify-48.png differ diff --git a/manifest.json b/manifest.json index 0fae2c4..d7f2102 100644 --- a/manifest.json +++ b/manifest.json @@ -11,6 +11,7 @@ }, "permissions": [ "activeTab", + "notifications", "tabs" ], "background": { @@ -19,5 +20,12 @@ "browser_action": { "default_icon": "icons/postify-32.png", "default_title": "Postify" + }, + "commands": { + "_execute_browser_action": { + "suggested_key": { + "default": "Ctrl+Shift+D" + } + } } } \ No newline at end of file diff --git a/postify.js b/postify.js index 040b240..69168d1 100644 --- a/postify.js +++ b/postify.js @@ -1,17 +1,18 @@ -console.log('Load!'); +const APP_NAME = 'Postify'; -function onGot(tabInfo) { - var tab = tabInfo[0]; - var url = tab.url; - console.log(url); +function sendUrl(url) { + browser.notifications.create({ + "type": "basic", + "iconUrl": browser.extension.getURL("icons/postify-48.png"), + "title": APP_NAME, + "message": url, + }); } -function onError(error) { - console.log(`Error: ${error}`); -} - -function sendCurrentUrl() { - browser.tabs.query({currentWindow: true, active: true}).then(onGot, onError); +function sendCurrentUrl(args) { + if (args.url) { + sendUrl(args.url) + } } browser.browserAction.onClicked.addListener(sendCurrentUrl);