Skip to content

Commit 51643d8

Browse files
committed
Merge pull request philc#926 from fukayatsu/toggle-pin-tab
Add shortcut to pin/unpin Tab
2 parents 5ebc1aa + 6ce9c81 commit 51643d8

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ Manipulating tabs:
7474
x close current tab
7575
X restore closed tab (i.e. unwind the 'x' command)
7676
T search through your open tabs
77+
. pin/unpin current tab
7778

7879
Additional advanced browsing commands:
7980

background_scripts/commands.coffee

+4-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ Commands =
100100
historyNavigation:
101101
["goBack", "goForward"]
102102
tabManipulation:
103-
["nextTab", "previousTab", "firstTab", "lastTab", "createTab", "duplicateTab", "removeTab", "restoreTab", "moveTabToNewWindow"]
103+
["nextTab", "previousTab", "firstTab", "lastTab", "createTab", "duplicateTab", "removeTab", "restoreTab", "moveTabToNewWindow", "togglePinTab"]
104104
misc:
105105
["showHelp"]
106106

@@ -170,6 +170,8 @@ defaultKeyMappings =
170170
"x": "removeTab"
171171
"X": "restoreTab"
172172

173+
".": "togglePinTab"
174+
173175
"o": "Vomnibar.activate"
174176
"O": "Vomnibar.activateInNewTab"
175177

@@ -245,6 +247,7 @@ commandDescriptions =
245247
removeTab: ["Close current tab", { background: true, noRepeat: true }]
246248
restoreTab: ["Restore closed tab", { background: true }]
247249
moveTabToNewWindow: ["Move tab to new window", { background: true }]
250+
togglePinTab: ["Pin/unpin current tab", { background: true }]
248251

249252
"Vomnibar.activate": ["Open URL, bookmark, or history entry"]
250253
"Vomnibar.activateInNewTab": ["Open URL, bookmark, history entry, in a new tab"]

background_scripts/main.coffee

+3
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,9 @@ BackgroundCommands =
257257
callback()))
258258
openCopiedUrlInCurrentTab: (request) -> openUrlInCurrentTab({ url: Clipboard.paste() })
259259
openCopiedUrlInNewTab: (request) -> openUrlInNewTab({ url: Clipboard.paste() })
260+
togglePinTab: (request) ->
261+
chrome.tabs.getSelected(null, (tab) ->
262+
chrome.tabs.update(tab.id, { pinned: !tab.pinned }))
260263
showHelp: (callback, frameId) ->
261264
chrome.tabs.getSelected(null, (tab) ->
262265
chrome.tabs.sendMessage(tab.id,

0 commit comments

Comments
 (0)