diff --git a/qutebrowser/app.py b/qutebrowser/app.py index 09b2adfc1..aa9666d74 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -142,8 +142,6 @@ def init(args, crash_handler): pre_text="Error while initializing") sys.exit(usertypes.Exit.err_init) - _process_args(args) - log.init.debug("Initializing eventfilter...") event_filter = EventFilter(qApp) qApp.installEventFilter(event_filter) @@ -154,12 +152,12 @@ def init(args, crash_handler): config_obj.style_changed.connect(style.get_stylesheet.cache_clear) qApp.focusChanged.connect(on_focus_changed) + _process_args(args) + QDesktopServices.setUrlHandler('http', open_desktopservices_url) QDesktopServices.setUrlHandler('https', open_desktopservices_url) QDesktopServices.setUrlHandler('qute', open_desktopservices_url) - macros.init() - QTimer.singleShot(10, functools.partial(_init_late_modules, args)) log.init.debug("Init done!") @@ -449,6 +447,7 @@ def _init_modules(args, crash_handler): os.environ['QT_WAYLAND_DISABLE_WINDOWDECORATION'] = '1' else: os.environ.pop('QT_WAYLAND_DISABLE_WINDOWDECORATION', None) + macros.init() # Init backend-specific stuff browsertab.init() diff --git a/tests/end2end/test_invocations.py b/tests/end2end/test_invocations.py index 253b4b236..bcb8b04e6 100644 --- a/tests/end2end/test_invocations.py +++ b/tests/end2end/test_invocations.py @@ -249,3 +249,15 @@ def test_webengine_download_suffix(request, quteproc_new, tmpdir): files = download_dir.listdir() assert len(files) == 1 assert files[0].basename == 'download.bin' + + +def test_command_on_start(request, quteproc_new): + """Make sure passing a command on start works. + + See https://github.com/qutebrowser/qutebrowser/issues/2408 + """ + args = (['--temp-basedir'] + _base_args(request.config) + + [':quickmark-add https://www.example.com/ example']) + quteproc_new.start(args) + quteproc_new.send_cmd(':quit') + quteproc_new.wait_for_quit()