Add a greasemonkey.init()
This also creates the greasemonkey directory if it doesn't exist yet, for discoverability.
This commit is contained in:
parent
0c792d228e
commit
dd63508be7
@ -492,8 +492,7 @@ def _init_modules(args, crash_handler):
|
|||||||
objreg.register('cache', diskcache)
|
objreg.register('cache', diskcache)
|
||||||
|
|
||||||
log.init.debug("Initializing Greasemonkey...")
|
log.init.debug("Initializing Greasemonkey...")
|
||||||
gm_manager = greasemonkey.GreasemonkeyManager()
|
greasemonkey.init()
|
||||||
objreg.register('greasemonkey', gm_manager)
|
|
||||||
|
|
||||||
log.init.debug("Misc initialization...")
|
log.init.debug("Misc initialization...")
|
||||||
macros.init()
|
macros.init()
|
||||||
|
@ -29,7 +29,7 @@ import glob
|
|||||||
import attr
|
import attr
|
||||||
from PyQt5.QtCore import pyqtSignal, QObject, QUrl
|
from PyQt5.QtCore import pyqtSignal, QObject, QUrl
|
||||||
|
|
||||||
from qutebrowser.utils import log, standarddir, jinja
|
from qutebrowser.utils import log, standarddir, jinja, objreg
|
||||||
from qutebrowser.commands import cmdutils
|
from qutebrowser.commands import cmdutils
|
||||||
|
|
||||||
|
|
||||||
@ -209,3 +209,14 @@ class GreasemonkeyManager(QObject):
|
|||||||
def all_scripts(self):
|
def all_scripts(self):
|
||||||
"""Return all scripts found in the configured script directory."""
|
"""Return all scripts found in the configured script directory."""
|
||||||
return self._run_start + self._run_end + self._run_idle
|
return self._run_start + self._run_end + self._run_idle
|
||||||
|
|
||||||
|
|
||||||
|
def init():
|
||||||
|
"""Initialize Greasemonkey support."""
|
||||||
|
gm_manager = GreasemonkeyManager()
|
||||||
|
objreg.register('greasemonkey', gm_manager)
|
||||||
|
|
||||||
|
try:
|
||||||
|
os.mkdir(_scripts_dir())
|
||||||
|
except FileExistsError:
|
||||||
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user