Add passthrough mode

This commit is contained in:
Florian Bruhin 2014-04-25 07:13:57 +02:00
parent 3407f3131d
commit 405194d040
2 changed files with 15 additions and 0 deletions

View File

@ -128,6 +128,7 @@ class QuteBrowser(QApplication):
'normal': NormalKeyParser(self),
'hint': HintKeyParser(self),
'insert': PassthroughKeyParser('keybind.insert', self),
'passthrough': PassthroughKeyParser('keybind.passthrough', self),
}
self._init_cmds()
self.mainwindow = MainWindow()
@ -136,6 +137,9 @@ class QuteBrowser(QApplication):
modes.manager.register('hint', self._keyparsers['hint'].handle)
modes.manager.register('insert', self._keyparsers['insert'].handle,
passthrough=True)
modes.manager.register('passthrough',
self._keyparsers['passthrough'].handle,
passthrough=True)
modes.manager.register('command', None, passthrough=True)
self.modeman = modes.manager # for commands
self.installEventFilter(modes.manager)

View File

@ -88,6 +88,11 @@ SECTION_DESC = {
"Since normal keypresses are passed through, only special keys are "
"supported in this mode.\n"
"An useful command to map here is the hidden command leave_mode."),
'keybind.passthrough': (
"Keybindings for hint passthrough.\n"
"Since normal keypresses are passed through, only special keys are "
"supported in this mode.\n"
"An useful command to map here is the hidden command leave_mode."),
'aliases': (
"Aliases for commands.\n"
"By default, no aliases are defined. Example which adds a new command "
@ -415,6 +420,7 @@ DATA = OrderedDict([
('PP', 'tabpaste sel'),
('-', 'zoomout'),
('+', 'zoomin'),
('<Ctrl-V>', 'enter_mode passthrough'),
('<Ctrl-Q>', 'quit'),
('<Ctrl-Shift-T>', 'undo'),
('<Ctrl-W>', 'tabclose'),
@ -437,6 +443,11 @@ DATA = OrderedDict([
('<Ctrl-C>', 'leave_mode'),
)),
('keybind.passthrough', sect.ValueList(
types.KeyBindingName(), types.KeyBinding(),
('<Escape>', 'leave_mode'),
)),
('aliases', sect.ValueList(
types.Command(), types.Command(),
)),