Merge branch 'master' of https://github.com/pemic/qutebrowser into pemic-master

This commit is contained in:
Florian Bruhin 2015-10-08 10:39:33 +02:00
commit 2c8aa26c93
4 changed files with 18 additions and 2 deletions

View File

@ -15,6 +15,10 @@ mpv, a simple key binding to something like `:spawn mpv {url}` should suffice.
Also note userscripts need to have the executable bit set (`chmod +x`) for Also note userscripts need to have the executable bit set (`chmod +x`) for
qutebrowser to run them. qutebrowser to run them.
To call a userscript, it needs to be stored in your data directory under
`userscripts` (for example: `~/.local/share/qutebrowser/userscripts/myscript`),
or just use an absolute path.
Getting information Getting information
------------------- -------------------

View File

@ -948,7 +948,9 @@ class CommandDispatcher:
useful here. useful here.
Args: Args:
userscript: Run the command as a userscript. userscript: Run the command as a userscript. Either store the
userscript in ~/.local/share/qutebrowser/userscripts
(or $XDG_DATA_DIR), or use an absolute path.
verbose: Show notifications when the command started/exited. verbose: Show notifications when the command started/exited.
detach: Whether the command should be detached from qutebrowser. detach: Whether the command should be detached from qutebrowser.
cmdline: The commandline to execute. cmdline: The commandline to execute.

View File

@ -749,7 +749,10 @@ class HintManager(QObject):
- With `spawn`: The executable and arguments to spawn. - With `spawn`: The executable and arguments to spawn.
`{hint-url}` will get replaced by the selected `{hint-url}` will get replaced by the selected
URL. URL.
- With `userscript`: The userscript to execute. - With `userscript`: The userscript to execute. Either store
the userscript in
~/.local/share/qutebrowser/userscripts (or
$XDG_DATA_DIR), or use an absolute path.
- With `fill`: The command to fill the statusbar with. - With `fill`: The command to fill the statusbar with.
`{hint-url}` will get replaced by the selected `{hint-url}` will get replaced by the selected
URL. URL.

View File

@ -344,6 +344,13 @@ def run(cmd, *args, win_id, env, verbose=False):
if user_agent is not None: if user_agent is not None:
env['QUTE_USER_AGENT'] = user_agent env['QUTE_USER_AGENT'] = user_agent
cmd = os.path.expanduser(cmd) cmd = os.path.expanduser(cmd)
# if cmd is not given as an absolute path, look it up
# ~/.local/share/qutebrowser/userscripts (or $XDG_DATA_DIR)
if not os.path.isabs(cmd):
log.misc.debug("{} is no absolute path".format(cmd))
cmd = os.path.join(standarddir.data(), "userscripts", cmd)
runner.run(cmd, *args, env=env, verbose=verbose) runner.run(cmd, *args, env=env, verbose=verbose)
runner.finished.connect(commandrunner.deleteLater) runner.finished.connect(commandrunner.deleteLater)
runner.finished.connect(runner.deleteLater) runner.finished.connect(runner.deleteLater)