diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index bacedd380..58b1f4d01 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -771,13 +771,6 @@ class CommandDispatcher: raise cmdexc.CommandError("Can't zoom {}%!".format(level)) message.info(self._win_id, "Zoom level: {}%".format(level)) - @cmdutils.register(instance='command-dispatcher', scope='window') - def window_only(self): - """Close all windows except for the current one.""" - for win_id, window in objreg.window_registry.items(): - if win_id != self._win_id: - window.close() - @cmdutils.register(instance='command-dispatcher', scope='window') def tab_only(self, left=False, right=False): """Close all tabs except for the current one. diff --git a/qutebrowser/misc/utilcmds.py b/qutebrowser/misc/utilcmds.py index 9622db367..e99ad45fb 100644 --- a/qutebrowser/misc/utilcmds.py +++ b/qutebrowser/misc/utilcmds.py @@ -247,3 +247,12 @@ def log_capacity(capacity: int): raise cmdexc.CommandError("Can't set a negative log capacity!") else: log.ram_handler.change_log_capacity(capacity) + + +@cmdutils.register() +@cmdutils.argument('current_win_id', win_id=True) +def window_only(current_win_id): + """Close all windows except for the current one.""" + for win_id, window in objreg.window_registry.items(): + if win_id != current_win_id: + window.close()