├── pin_16.png ├── pin_48.png ├── pin_128.png ├── tab_pinner.zip ├── Makefile ├── README.md ├── manifest.json ├── LICENSE └── tab_pinner.js /pin_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbuck/tab-pinner/HEAD/pin_16.png -------------------------------------------------------------------------------- /pin_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbuck/tab-pinner/HEAD/pin_48.png -------------------------------------------------------------------------------- /pin_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbuck/tab-pinner/HEAD/pin_128.png -------------------------------------------------------------------------------- /tab_pinner.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbuck/tab-pinner/HEAD/tab_pinner.zip -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | ZIP=zip 2 | FILES=manifest.json tab_pinner.js pin_16.png pin_48.png pin_128.png 3 | ARCHIVE=tab_pinner.zip 4 | 5 | clean: $(ARCHIVE) 6 | rm -rf $(ARCHIVE) 7 | 8 | pack: $(FILES) clean 9 | $(ZIP) $(ARCHIVE) $(FILES) 10 | 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [Visit the Extension in the Web Store](https://chrome.google.com/webstore/detail/tab-pinner-keyboard-short/mbcjcnomlakhkechnbhmfjhnnllpbmlh?utm_source=chrome-ntp-icon) 2 | 3 | Simple Chrome extension to pin tabs in Chrome from the keyboard. 4 | 5 | Dead simple, no fluff extension. 6 | 7 | I'm releasing this under the MIT license, but you shouldn't publish you're own version. 8 | You're free to modify and publish this as part of a larger extension. 9 | 10 | It's outside the scope of the license but I'd love to ask, if you do use this to build 11 | another extension and release that extension, think about open sourcing the extension and 12 | releasing it for free too! 13 | -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 3, 3 | "name": "Tab Pinner (Keyboard Shortcuts)", 4 | "description": "Pin or Unpin a tab easily from the keyboard", 5 | "version": "1.2.1", 6 | "background": { 7 | "service_worker": "tab_pinner.js" 8 | }, 9 | "commands": { 10 | "tab_pinner_pin_all_tabs": { 11 | "description": "Pin all tabs in the current window." 12 | }, 13 | "tab_pinner_pin_unpin_tab": { 14 | "description": "Pin or unpin the current tab.", 15 | "suggested_key": { 16 | "default": "Ctrl+Shift+X" 17 | } 18 | }, 19 | "tab_pinner_unpin_all_tabs": { 20 | "description": "Unpin all pinned tabs in the current window.", 21 | "suggested_key": { 22 | "default": "Alt+Shift+X" 23 | } 24 | } 25 | }, 26 | "icons": { 27 | "128": "pin_128.png", 28 | "16": "pin_16.png", 29 | "48": "pin_48.png" 30 | }, 31 | "permissions": [] 32 | } 33 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Brandon Buck 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /tab_pinner.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 Brandon Buck, All Rights Reserved 2 | 3 | const PIN_UNPIN_TAB = "tab_pinner_pin_unpin_tab"; 4 | const UNPIN_ALL = "tab_pinner_unpin_all_tabs"; 5 | const PIN_ALL = "tab_pinner_pin_all_tabs"; 6 | 7 | /** 8 | * Handles keyboard shortcut commands, responding only to the tab pin/unpin 9 | * commands. 10 | * @param {string} command The name of the keyboard shortcut that was used. 11 | */ 12 | async function handleCommand(command) { 13 | const currentWindow = await chrome.windows.getCurrent({ populate: true }); 14 | 15 | switch (command) { 16 | case PIN_UNPIN_TAB: 17 | await Promise.all( 18 | currentWindow.tabs 19 | .filter((t) => t.active) 20 | .map((tab) => chrome.tabs.update(tab.id, { pinned: !tab.pinned }))); 21 | break; 22 | 23 | case UNPIN_ALL: 24 | await Promise.all( 25 | currentWindow.tabs.map((t) => chrome.tabs.update(t.id, { pinned: false }))); 26 | break; 27 | 28 | case PIN_ALL: 29 | await Promise.all( 30 | currentWindow.tabs.map((t) => chrome.tabs.update(t.id, { pinned: true }))); 31 | break; 32 | } 33 | } 34 | 35 | chrome.commands.onCommand.addListener(handleCommand); 36 | --------------------------------------------------------------------------------