summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Singleton <matt@xcolour.net>2022-01-16 12:02:38 -0600
committerMatt Singleton <matt@xcolour.net>2022-01-16 13:04:41 -0600
commitb7b84113cc21f444b6ffdd86cf39008bc15e8f83 (patch)
tree68d7d99ff2e718f4eaa2560657dd2cf5166204f2
parentfdf5165ebb37cf7cf7c02bec0f7c35f800ade755 (diff)
basic keybindings
-rw-r--r--TODO.md15
-rwxr-xr-xbrowser.py11
2 files changed, 19 insertions, 7 deletions
diff --git a/TODO.md b/TODO.md
index c0e33d7..dc5ba0c 100644
--- a/TODO.md
+++ b/TODO.md
@@ -1,13 +1,14 @@
- [x] open non-gemini links externally and display differently
- [ ] keyboard navigation
- - vim-style
- - scroll
- - highlight and follow links
- - forward and back
- - url bar
- - [ ] search in page
- - [ ] work with search pages
+ - [x] scroll
+ - [ ] highlight and follow links
+ - [x] forward and back
+ - [ ] url bar
+ - [ ] search in page
- [x] stdlib url parsing in gemini module
- [x] nice typography
- [x] html templates
- [ ] deal with non utf8 charsets
+ - [ ] handle all response codes
+ - [ ] errors (4x, 5x)
+ - [ ] search
diff --git a/browser.py b/browser.py
index 54cace9..8a542f9 100755
--- a/browser.py
+++ b/browser.py
@@ -87,6 +87,17 @@ class GBrowser(QtWidgets.QMainWindow):
self.setWindowTitle('Gemini Browser')
self.show()
+ # Shortcuts
+ down_shortcut = QtGui.QShortcut(QtGui.QKeySequence(QtCore.Qt.Key_J), self)
+ down_event = QtGui.QKeyEvent(QtCore.QEvent.KeyPress, QtCore.Qt.Key_Down, QtCore.Qt.NoModifier)
+ down_shortcut.activated.connect(lambda: QtWidgets.QApplication.sendEvent(self._browser.focusProxy(), down_event))
+ up_shortcut = QtGui.QShortcut(QtGui.QKeySequence(QtCore.Qt.Key_K), self)
+ up_event = QtGui.QKeyEvent(QtCore.QEvent.KeyPress, QtCore.Qt.Key_Up, QtCore.Qt.NoModifier)
+ up_shortcut.activated.connect(lambda: QtWidgets.QApplication.sendEvent(self._browser.focusProxy(), up_event))
+ back_shortcut = QtGui.QShortcut(QtGui.QKeySequence(QtCore.Qt.Key_H), self, self._browser.back)
+ forward_shortcut = QtGui.QShortcut(QtGui.QKeySequence(QtCore.Qt.Key_L), self, self._browser.forward)
+ reload_shortcut = QtGui.QShortcut(QtGui.QKeySequence("Shift+R"), self, self._browser.reload)
+
def set_status_url(self, url):
if url:
self.statusBar().showMessage(url)