From 7dbeeca952b31f7c01dc20c48c184f075de44c85 Mon Sep 17 00:00:00 2001 From: Christian Segundo Date: Fri, 17 Nov 2023 16:22:08 +0100 Subject: First commit --- background.js | 21 +++++++++++++++++++++ icons/icon-128.png | Bin 0 -> 18062 bytes icons/icon-256.png | Bin 0 -> 44117 bytes icons/icon-48.png | Bin 0 -> 7423 bytes icons/icon-512.png | Bin 0 -> 119051 bytes icons/icon-850.png | Bin 0 -> 240237 bytes icons/icon-96.png | Bin 0 -> 13171 bytes manifest.json | 34 ++++++++++++++++++++++++++++++++++ 8 files changed, 55 insertions(+) create mode 100644 background.js create mode 100644 icons/icon-128.png create mode 100644 icons/icon-256.png create mode 100644 icons/icon-48.png create mode 100644 icons/icon-512.png create mode 100644 icons/icon-850.png create mode 100644 icons/icon-96.png create mode 100644 manifest.json 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 new file mode 100644 index 0000000..744594c Binary files /dev/null and b/icons/icon-128.png differ diff --git a/icons/icon-256.png b/icons/icon-256.png new file mode 100644 index 0000000..e86c42f Binary files /dev/null and b/icons/icon-256.png differ diff --git a/icons/icon-48.png b/icons/icon-48.png new file mode 100644 index 0000000..c8b0c09 Binary files /dev/null and b/icons/icon-48.png differ diff --git a/icons/icon-512.png b/icons/icon-512.png new file mode 100644 index 0000000..fd0fb29 Binary files /dev/null and b/icons/icon-512.png differ diff --git a/icons/icon-850.png b/icons/icon-850.png new file mode 100644 index 0000000..c35f7a6 Binary files /dev/null and b/icons/icon-850.png differ diff --git a/icons/icon-96.png b/icons/icon-96.png new file mode 100644 index 0000000..7a92e2d Binary files /dev/null and b/icons/icon-96.png differ 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" + } +} -- cgit v1.2.3