From d592651c504b57901b5c33c23041da9063a3a80b Mon Sep 17 00:00:00 2001 From: thuck Date: Sun, 6 Nov 2016 23:24:24 +0100 Subject: [PATCH] Change command from pin/unpin to tab-pin --- qutebrowser/browser/commands.py | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 5511dfeed..4fb076d80 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -247,28 +247,22 @@ class CommandDispatcher: self._tabbed_browser.close_tab(tab) tabbar.setSelectionBehaviorOnRemove(old_selection_behavior) - @cmdutils.register(instance='command-dispatcher', scope='window', name='pin') + @cmdutils.register(instance='command-dispatcher', scope='window', name='tab-pin') @cmdutils.argument('index') @cmdutils.argument('count', count=True) - def tab_pin(self, index=1, count=None): + def tab_pin(self, index=None, count=None): tab = self._cntwidget(count) if tab is None: return - tab.pin = True - self.tab_move(int(index)) - @cmdutils.register(instance='command-dispatcher', scope='window', name='unpin') - @cmdutils.argument('index') - @cmdutils.argument('count', count=True) - def tab_unpin(self, index=None, count=None): - tab = self._cntwidget(count) - if tab is None: - return - tab.pin = False - if index is not None: - self.tab_move(int(index)) + tab.pin = not tab.pin + + if tab.pin is True: + index = 1 if index is None else int(index) else: - self.tab_move(self._count()) + index = self._count() if index is None else int(index) + + self.tab_move(index) @cmdutils.register(instance='command-dispatcher', name='open', maxsplit=0, scope='window')