diff --git a/README.md b/README.md new file mode 100644 index 0000000..4318947 --- /dev/null +++ b/README.md @@ -0,0 +1,28 @@ +

Welcome to brave-lock-pinned-tabs 👋

+

+ Version + + License: WTFPL + +

+ +> Brave extension to prevent pinned tabs from being closed accidentally + +## Installation + +Clone this repo and [load the extension](https://developer.chrome.com/docs/extensions/mv3/getstarted/#unpacked). + +## Usage + +1. In your browser open the address `brave://extensions/shortcuts` + +2. Look for the extension "Lock Pinned Tabs" + +3. In the option `Activate the extension` set the key `Ctrl + w` + +4. Now it will replace the default `Ctrl + w` and this extension will prevent pinned tabs from being closed using Ctrl + W. + +------------- + + +This extension was inspired on https://github.com/gabrielmaldi/chrome-lock-tab diff --git a/images/icon.png b/images/icon.png new file mode 100644 index 0000000..cd0fd3c Binary files /dev/null and b/images/icon.png differ diff --git a/images/icon_128.png b/images/icon_128.png new file mode 100644 index 0000000..3e08062 Binary files /dev/null and b/images/icon_128.png differ diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..f8a7bf3 --- /dev/null +++ b/manifest.json @@ -0,0 +1,19 @@ +{ + "name": "Lock Pinned Tabs", + "description": "Prevents pinned a tab from being closed accidentally", + "version": "1.0.0", + + "author": "gustavotrott", + "homepage_url": "https://github.com/gustavotrott/chrome-lock-tab", + "manifest_version": 3, + "permissions": [ + "activeTab" + ], + "icons": { + "128": "images/icon_128.png" + }, + "background": { + "service_worker": "src/background.js" + }, + "action": {} +} diff --git a/src/background.js b/src/background.js new file mode 100644 index 0000000..8fa456b --- /dev/null +++ b/src/background.js @@ -0,0 +1,5 @@ +chrome.action.onClicked.addListener((tab) => { + if (!tab.pinned) { + chrome.tabs.remove(tab.id); + } +});