Add rapid window hinting.
This commit is contained in:
parent
52e72a8bec
commit
8eb0489357
@ -38,8 +38,9 @@ ElemTuple = collections.namedtuple('ElemTuple', ['elem', 'label'])
|
|||||||
|
|
||||||
|
|
||||||
Target = usertypes.enum('Target', ['normal', 'tab', 'tab_bg', 'window', 'yank',
|
Target = usertypes.enum('Target', ['normal', 'tab', 'tab_bg', 'window', 'yank',
|
||||||
'yank_primary', 'fill', 'rapid', 'download',
|
'yank_primary', 'fill', 'rapid',
|
||||||
'userscript', 'spawn'])
|
'rapid_win', 'download', 'userscript',
|
||||||
|
'spawn'])
|
||||||
|
|
||||||
|
|
||||||
@pyqtSlot(usertypes.KeyMode)
|
@pyqtSlot(usertypes.KeyMode)
|
||||||
@ -132,6 +133,7 @@ class HintManager(QObject):
|
|||||||
Target.yank_primary: "Yank hint to primary selection...",
|
Target.yank_primary: "Yank hint to primary selection...",
|
||||||
Target.fill: "Set hint in commandline...",
|
Target.fill: "Set hint in commandline...",
|
||||||
Target.rapid: "Follow hint (rapid mode)...",
|
Target.rapid: "Follow hint (rapid mode)...",
|
||||||
|
Target.rapid_win: "Follow hint in new window (rapid mode)...",
|
||||||
Target.download: "Download hint...",
|
Target.download: "Download hint...",
|
||||||
Target.userscript: "Call userscript via hint...",
|
Target.userscript: "Call userscript via hint...",
|
||||||
Target.spawn: "Spawn command via hint...",
|
Target.spawn: "Spawn command via hint...",
|
||||||
@ -305,6 +307,8 @@ class HintManager(QObject):
|
|||||||
"""
|
"""
|
||||||
if self._context.target == Target.rapid:
|
if self._context.target == Target.rapid:
|
||||||
target = Target.tab_bg
|
target = Target.tab_bg
|
||||||
|
elif self._context.target == Target.rapid_win:
|
||||||
|
target = Target.window
|
||||||
else:
|
else:
|
||||||
target = self._context.target
|
target = self._context.target
|
||||||
self.set_open_target.emit(target.name)
|
self.set_open_target.emit(target.name)
|
||||||
@ -561,6 +565,8 @@ class HintManager(QObject):
|
|||||||
- `fill`: Fill the commandline with the command given as
|
- `fill`: Fill the commandline with the command given as
|
||||||
argument.
|
argument.
|
||||||
- `rapid`: Open the link in a new tab and stay in hinting mode.
|
- `rapid`: Open the link in a new tab and stay in hinting mode.
|
||||||
|
- `rapid-win`: Open the link in a new window and stay in
|
||||||
|
hinting mode.
|
||||||
- `download`: Download the link.
|
- `download`: Download the link.
|
||||||
- `userscript`: Call an userscript with `$QUTE_URL` set to the
|
- `userscript`: Call an userscript with `$QUTE_URL` set to the
|
||||||
link.
|
link.
|
||||||
@ -664,6 +670,7 @@ class HintManager(QObject):
|
|||||||
Target.tab_bg: self._click,
|
Target.tab_bg: self._click,
|
||||||
Target.window: self._click,
|
Target.window: self._click,
|
||||||
Target.rapid: self._click,
|
Target.rapid: self._click,
|
||||||
|
Target.rapid_win: self._click,
|
||||||
# _download needs a QWebElement to get the frame.
|
# _download needs a QWebElement to get the frame.
|
||||||
Target.download: self._download,
|
Target.download: self._download,
|
||||||
}
|
}
|
||||||
@ -688,7 +695,7 @@ class HintManager(QObject):
|
|||||||
url_handlers[self._context.target](url)
|
url_handlers[self._context.target](url)
|
||||||
else:
|
else:
|
||||||
raise ValueError("No suitable handler found!")
|
raise ValueError("No suitable handler found!")
|
||||||
if self._context.target != Target.rapid:
|
if self._context.target not in (Target.rapid, Target.rapid_win):
|
||||||
modeman.maybe_leave(self._win_id, usertypes.KeyMode.hint,
|
modeman.maybe_leave(self._win_id, usertypes.KeyMode.hint,
|
||||||
'followed')
|
'followed')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user