diff options
-rw-r--r-- | background.js | 21 | ||||
-rw-r--r-- | icons/icon-128.png | bin | 0 -> 18062 bytes | |||
-rw-r--r-- | icons/icon-256.png | bin | 0 -> 44117 bytes | |||
-rw-r--r-- | icons/icon-48.png | bin | 0 -> 7423 bytes | |||
-rw-r--r-- | icons/icon-512.png | bin | 0 -> 119051 bytes | |||
-rw-r--r-- | icons/icon-850.png | bin | 0 -> 240237 bytes | |||
-rw-r--r-- | icons/icon-96.png | bin | 0 -> 13171 bytes | |||
-rw-r--r-- | manifest.json | 34 |
8 files changed, 55 insertions, 0 deletions
diff --git a/background.js b/background.js new file mode 100644 index 0000000..2b0b984 --- /dev/null +++ b/background.js @@ -0,0 +1,21 @@ +browser.menus.create({ + id: "tab-rename", + title: "Rename", + contexts: ["tab"], +}, function() { + if (browser.runtime.lastError) { + console.log(`Error: ${browser.runtime.lastError}`); + } +}); + +let tabRename = ` + var newTitle = window.prompt("", document.title); + if (newTitle) { document.title = newTitle; } +`; + +browser.menus.onClicked.addListener((info, tab) => { + if (info.menuItemId == "tab-rename") { + browser.tabs.update(tab.id, { active: true }); + browser.tabs.executeScript(tab.id, { code: tabRename }); + } +}); diff --git a/icons/icon-128.png b/icons/icon-128.png Binary files differnew file mode 100644 index 0000000..744594c --- /dev/null +++ b/icons/icon-128.png diff --git a/icons/icon-256.png b/icons/icon-256.png Binary files differnew file mode 100644 index 0000000..e86c42f --- /dev/null +++ b/icons/icon-256.png diff --git a/icons/icon-48.png b/icons/icon-48.png Binary files differnew file mode 100644 index 0000000..c8b0c09 --- /dev/null +++ b/icons/icon-48.png diff --git a/icons/icon-512.png b/icons/icon-512.png Binary files differnew file mode 100644 index 0000000..fd0fb29 --- /dev/null +++ b/icons/icon-512.png diff --git a/icons/icon-850.png b/icons/icon-850.png Binary files differnew file mode 100644 index 0000000..c35f7a6 --- /dev/null +++ b/icons/icon-850.png diff --git a/icons/icon-96.png b/icons/icon-96.png Binary files differnew file mode 100644 index 0000000..7a92e2d --- /dev/null +++ b/icons/icon-96.png diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..16cf958 --- /dev/null +++ b/manifest.json @@ -0,0 +1,34 @@ +{ + "manifest_version": 2, + "name": "Tab rename", + "version": "1.0", + "description": "Rename tabs from the context menu", + "developer": { + "name": "Christian Segundo", + "url": "https://git.segundo.io/moz-tab-rename/" + }, + "homepage_url": "https://git.segundo.io/moz-tab-rename/", + "permissions": [ + "activeTab", + "menus", + "tabs" + ], + "background": { + "scripts": [ + "background.js" + ] + }, + "browser_specific_settings": { + "gecko": { + "id": "moz-tab-rename@git.segundo.io" + } + }, + "icons": { + "48": "icons/icon-48.png", + "96": "icons/icon-96.png", + "128": "icons/icon-128.png", + "256": "icons/icon-256.png", + "512": "icons/icon-512.png", + "850": "icons/icon-850.png" + } +} |