added option to suppress window raising

This commit is contained in:
Anton S 2017-10-10 01:30:58 +03:00
parent 552d041422
commit 00f0e519a9
2 changed files with 5 additions and 4 deletions

View File

@ -299,7 +299,7 @@ def process_pos_args(args, via_ipc=False, cwd=None, target_arg=None):
cmd, e))
def open_url(url, target=None):
def open_url(url, target=None, force_raise=None):
"""Open an URLs in new window/tab
Args:
@ -308,7 +308,8 @@ def open_url(url, target=None):
"""
target = target or config.val.new_instance_open_target
background = target in ['tab-bg', 'tab-bg-silent']
win_id = mainwindow.get_window(True, force_target=target)
win_id = mainwindow.get_window(True, force_target=target,
force_raise=force_raise)
tabbed_browser = objreg.get('tabbed-browser', scope='window',
window=win_id)
log.init.debug("About to open URL {}".format(url))

View File

@ -43,7 +43,7 @@ win_id_gen = itertools.count(0)
def get_window(via_ipc, force_window=False, force_tab=False,
force_target=None):
force_target=None, force_raise=None):
"""Helper function for app.py to get a window id.
Args:
@ -84,7 +84,7 @@ def get_window(via_ipc, force_window=False, force_tab=False,
window.show()
should_raise = True
if should_raise:
if (force_raise is True) or (force_raise is None and should_raise):
raise_window(window)
return window.win_id