From 19f75984e344a46d3ab0dffe56b6659ce53fa672 Mon Sep 17 00:00:00 2001 From: Joel Torstensson Date: Mon, 22 Dec 2014 21:57:37 +0100 Subject: [PATCH 1/2] Implemented fullscreen mode. Fix #385 --- qutebrowser/browser/commands.py | 11 +++++++++++ qutebrowser/config/configdata.py | 1 + 2 files changed, 12 insertions(+) diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 0a6e280fc..f0d6ec7ae 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -243,6 +243,17 @@ class CommandDispatcher: "'previous'!") return None + @cmdutils.register(instance='command-dispatcher', name='fullscreen', + scope='window') + def full_screen(self): + """Toggle fullscreen mode.""" + main_window = objreg.get('main-window', scope='window', + window=self._win_id) + if main_window.isFullScreen(): + main_window.showNormal() + else: + main_window.showFullScreen() + @cmdutils.register(instance='command-dispatcher', scope='window') def tab_close(self, left=False, right=False, opposite=False, count: {'special': 'count'}=None): diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index 8dd8de302..1416e8460 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -946,6 +946,7 @@ KEY_DATA = collections.OrderedDict([ ('forward', ['L']), ('forward -t', ['tl']), ('forward -w', ['wl']), + ('fullscreen', ['']), ('hint', ['f']), ('hint all tab', ['F']), ('hint all window', ['wf']), From 8746715bf00b83d8082a62cd91120c20c2306d74 Mon Sep 17 00:00:00 2001 From: Joel Torstensson Date: Mon, 22 Dec 2014 22:56:52 +0100 Subject: [PATCH 2/2] Moved fullscreen method. --- qutebrowser/browser/commands.py | 11 ----------- qutebrowser/mainwindow/mainwindow.py | 8 ++++++++ 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index f0d6ec7ae..0a6e280fc 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -243,17 +243,6 @@ class CommandDispatcher: "'previous'!") return None - @cmdutils.register(instance='command-dispatcher', name='fullscreen', - scope='window') - def full_screen(self): - """Toggle fullscreen mode.""" - main_window = objreg.get('main-window', scope='window', - window=self._win_id) - if main_window.isFullScreen(): - main_window.showNormal() - else: - main_window.showFullScreen() - @cmdutils.register(instance='command-dispatcher', scope='window') def tab_close(self, left=False, right=False, opposite=False, count: {'special': 'count'}=None): diff --git a/qutebrowser/mainwindow/mainwindow.py b/qutebrowser/mainwindow/mainwindow.py index 379f7b80f..a3c3fa0e4 100644 --- a/qutebrowser/mainwindow/mainwindow.py +++ b/qutebrowser/mainwindow/mainwindow.py @@ -305,6 +305,14 @@ class MainWindow(QWidget): """ super().close() + @cmdutils.register(instance='main-window', scope='window') + def fullscreen(self): + """Toggle fullscreen mode.""" + if self.isFullScreen(): + self.showNormal() + else: + self.showFullScreen() + def resizeEvent(self, e): """Extend resizewindow's resizeEvent to adjust completion.