Fixed issue #943 and changed the docs accordingly
This commit is contained in:
parent
224ab3237d
commit
6be5c65c36
@ -261,7 +261,7 @@ Start hinting.
|
|||||||
- 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 your data directory 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.
|
||||||
@ -580,7 +580,7 @@ Note the {url} variable which gets replaced by the current URL might be useful h
|
|||||||
* +'cmdline'+: The commandline to execute.
|
* +'cmdline'+: The commandline to execute.
|
||||||
|
|
||||||
==== optional arguments
|
==== optional arguments
|
||||||
* +*-u*+, +*--userscript*+: Run the command as a userscript.
|
* +*-u*+, +*--userscript*+: Run the command as a userscript. Either store it in your data directory or use an absolute path.
|
||||||
* +*-v*+, +*--verbose*+: Show notifications when the command started/exited.
|
* +*-v*+, +*--verbose*+: Show notifications when the command started/exited.
|
||||||
* +*-d*+, +*--detach*+: Whether the command should be detached from qutebrowser.
|
* +*-d*+, +*--detach*+: Whether the command should be detached from qutebrowser.
|
||||||
|
|
||||||
|
@ -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
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
|
@ -344,6 +344,14 @@ 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)
|
||||||
|
|
||||||
|
# check if userscript is in absolute path or in $XDG_DATA_DIRS
|
||||||
|
if not os.path.isabs(cmd) :
|
||||||
|
log.misc.debug("{} is no absoulte path".format(cmd))
|
||||||
|
c = os.path.join(standarddir.data(),"userscripts", cmd)
|
||||||
|
if os.path.isfile(c):
|
||||||
|
cmd = c
|
||||||
|
|
||||||
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user