summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Segundo2023-11-17 16:22:08 +0100
committerChristian Segundo2023-11-17 16:22:08 +0100
commit7dbeeca952b31f7c01dc20c48c184f075de44c85 (patch)
tree110bab8f0d7d042a8b1f0cee6c733d3164f025d4
downloadmoz-tab-rename-7dbeeca952b31f7c01dc20c48c184f075de44c85.tar.gz
First commitHEADmaster
-rw-r--r--background.js21
-rw-r--r--icons/icon-128.pngbin0 -> 18062 bytes
-rw-r--r--icons/icon-256.pngbin0 -> 44117 bytes
-rw-r--r--icons/icon-48.pngbin0 -> 7423 bytes
-rw-r--r--icons/icon-512.pngbin0 -> 119051 bytes
-rw-r--r--icons/icon-850.pngbin0 -> 240237 bytes
-rw-r--r--icons/icon-96.pngbin0 -> 13171 bytes
-rw-r--r--manifest.json34
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
new file mode 100644
index 0000000..744594c
--- /dev/null
+++ b/icons/icon-128.png
Binary files differ
diff --git a/icons/icon-256.png b/icons/icon-256.png
new file mode 100644
index 0000000..e86c42f
--- /dev/null
+++ b/icons/icon-256.png
Binary files differ
diff --git a/icons/icon-48.png b/icons/icon-48.png
new file mode 100644
index 0000000..c8b0c09
--- /dev/null
+++ b/icons/icon-48.png
Binary files differ
diff --git a/icons/icon-512.png b/icons/icon-512.png
new file mode 100644
index 0000000..fd0fb29
--- /dev/null
+++ b/icons/icon-512.png
Binary files differ
diff --git a/icons/icon-850.png b/icons/icon-850.png
new file mode 100644
index 0000000..c35f7a6
--- /dev/null
+++ b/icons/icon-850.png
Binary files differ
diff --git a/icons/icon-96.png b/icons/icon-96.png
new file mode 100644
index 0000000..7a92e2d
--- /dev/null
+++ b/icons/icon-96.png
Binary files 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"
+ }
+}