Support opening multiple windows via init args.
This commit is contained in:
parent
e6fe358d73
commit
6e61f4c586
@ -219,12 +219,17 @@ class Application(QApplication):
|
|||||||
# we make sure the GUI is refreshed here, so the start seems faster.
|
# we make sure the GUI is refreshed here, so the start seems faster.
|
||||||
self.processEvents(QEventLoop.ExcludeUserInputEvents |
|
self.processEvents(QEventLoop.ExcludeUserInputEvents |
|
||||||
QEventLoop.ExcludeSocketNotifiers)
|
QEventLoop.ExcludeSocketNotifiers)
|
||||||
tabbed_browser = objreg.get('tabbed-browser', scope='window', window=0)
|
win_id = 0
|
||||||
for cmd in self._args.command:
|
for cmd in self._args.command:
|
||||||
if cmd.startswith(':'):
|
if cmd.startswith(':'):
|
||||||
log.init.debug("Startup cmd {}".format(cmd))
|
log.init.debug("Startup cmd {}".format(cmd))
|
||||||
self._commandrunner.run_safely_init(0, cmd.lstrip(':'))
|
self._commandrunner.run_safely_init(0, cmd.lstrip(':'))
|
||||||
|
elif not cmd:
|
||||||
|
log.init.debug("Empty argument")
|
||||||
|
win_id = mainwindow.create_window(True)
|
||||||
else:
|
else:
|
||||||
|
tabbed_browser = objreg.get('tabbed-browser', scope='window',
|
||||||
|
window=win_id)
|
||||||
log.init.debug("Startup URL {}".format(cmd))
|
log.init.debug("Startup URL {}".format(cmd))
|
||||||
try:
|
try:
|
||||||
url = urlutils.fuzzy_url(cmd)
|
url = urlutils.fuzzy_url(cmd)
|
||||||
@ -234,6 +239,9 @@ class Application(QApplication):
|
|||||||
else:
|
else:
|
||||||
tabbed_browser.tabopen(url)
|
tabbed_browser.tabopen(url)
|
||||||
|
|
||||||
|
for win_id in objreg.window_registry:
|
||||||
|
tabbed_browser = objreg.get('tabbed-browser', scope='window',
|
||||||
|
window=win_id)
|
||||||
if tabbed_browser.count() == 0:
|
if tabbed_browser.count() == 0:
|
||||||
log.init.debug("Opening startpage")
|
log.init.debug("Opening startpage")
|
||||||
for urlstr in config.get('general', 'startpage'):
|
for urlstr in config.get('general', 'startpage'):
|
||||||
|
@ -91,7 +91,8 @@ def get_argparser():
|
|||||||
parser.add_argument('command', nargs='*', help="Commands to execute on "
|
parser.add_argument('command', nargs='*', help="Commands to execute on "
|
||||||
"startup.", metavar=':command')
|
"startup.", metavar=':command')
|
||||||
# URLs will actually be in command
|
# URLs will actually be in command
|
||||||
parser.add_argument('url', nargs='*', help="URLs to open on startup.")
|
parser.add_argument('url', nargs='*', help="URLs to open on startup "
|
||||||
|
"(empty as a window separator).")
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user