Fix launcher opening after a dbus enabled window is already open
This commit is contained in:
parent
297c349ebf
commit
8c8248234c
86
terminator
86
terminator
|
@ -65,52 +65,54 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
OPTIONS = terminatorlib.optionparse.parse_options()
|
OPTIONS = terminatorlib.optionparse.parse_options()
|
||||||
|
|
||||||
# Attempt to import our dbus server. If one exists already we will just
|
|
||||||
# connect to that and ask for a new window. If not, we will create one and
|
|
||||||
# continue. Failure to import dbus, or the global config option "dbus"
|
|
||||||
# being False will cause us to continue without the dbus server and open a
|
|
||||||
# window.
|
|
||||||
try:
|
|
||||||
if OPTIONS.nodbus:
|
|
||||||
dbg('dbus disabled by command line')
|
|
||||||
raise ImportError
|
|
||||||
from terminatorlib import ipc
|
|
||||||
import dbus
|
|
||||||
try:
|
|
||||||
dbus_service = ipc.DBusService()
|
|
||||||
except ipc.DBusException:
|
|
||||||
dbg('Unable to become master process, operating via DBus')
|
|
||||||
# get rid of the None and True types so dbus can handle them (empty
|
|
||||||
# and 'True' strings are used instead), also arrays are joined
|
|
||||||
# (the -x argument for example)
|
|
||||||
optionslist = {}
|
|
||||||
for opt, val in OPTIONS.__dict__.items():
|
|
||||||
if type(val) == type([]):
|
|
||||||
val = ' '.join(val)
|
|
||||||
if val == True:
|
|
||||||
val = 'True'
|
|
||||||
optionslist[opt] = val and '%s'%val or ''
|
|
||||||
optionslist = dbus.Dictionary(optionslist, signature='ss')
|
|
||||||
if OPTIONS.new_tab:
|
|
||||||
dbg('Requesting a new tab')
|
|
||||||
ipc.new_tab(optionslist)
|
|
||||||
else:
|
|
||||||
dbg('Requesting a new window')
|
|
||||||
ipc.new_window(optionslist)
|
|
||||||
sys.exit()
|
|
||||||
except ImportError:
|
|
||||||
dbg('dbus not imported')
|
|
||||||
pass
|
|
||||||
|
|
||||||
MAKER = Factory()
|
|
||||||
TERMINATOR = Terminator()
|
|
||||||
TERMINATOR.set_origcwd(ORIGCWD)
|
|
||||||
TERMINATOR.set_dbus_data(dbus_service)
|
|
||||||
TERMINATOR.reconfigure()
|
|
||||||
if OPTIONS.select:
|
if OPTIONS.select:
|
||||||
# launch gui, return selection
|
# launch gui, return selection
|
||||||
LAYOUTLAUNCHER=LayoutLauncher()
|
LAYOUTLAUNCHER=LayoutLauncher()
|
||||||
else:
|
else:
|
||||||
|
|
||||||
|
# Attempt to import our dbus server. If one exists already we will just
|
||||||
|
# connect to that and ask for a new window. If not, we will create one and
|
||||||
|
# continue. Failure to import dbus, or the global config option "dbus"
|
||||||
|
# being False will cause us to continue without the dbus server and open a
|
||||||
|
# window.
|
||||||
|
try:
|
||||||
|
if OPTIONS.nodbus:
|
||||||
|
dbg('dbus disabled by command line')
|
||||||
|
raise ImportError
|
||||||
|
from terminatorlib import ipc
|
||||||
|
import dbus
|
||||||
|
try:
|
||||||
|
dbus_service = ipc.DBusService()
|
||||||
|
except ipc.DBusException:
|
||||||
|
dbg('Unable to become master process, operating via DBus')
|
||||||
|
# get rid of the None and True types so dbus can handle them (empty
|
||||||
|
# and 'True' strings are used instead), also arrays are joined
|
||||||
|
# (the -x argument for example)
|
||||||
|
optionslist = {}
|
||||||
|
for opt, val in OPTIONS.__dict__.items():
|
||||||
|
if type(val) == type([]):
|
||||||
|
val = ' '.join(val)
|
||||||
|
if val == True:
|
||||||
|
val = 'True'
|
||||||
|
optionslist[opt] = val and '%s'%val or ''
|
||||||
|
optionslist = dbus.Dictionary(optionslist, signature='ss')
|
||||||
|
if OPTIONS.new_tab:
|
||||||
|
dbg('Requesting a new tab')
|
||||||
|
ipc.new_tab(optionslist)
|
||||||
|
else:
|
||||||
|
dbg('Requesting a new window')
|
||||||
|
ipc.new_window(optionslist)
|
||||||
|
sys.exit()
|
||||||
|
except ImportError:
|
||||||
|
dbg('dbus not imported')
|
||||||
|
pass
|
||||||
|
|
||||||
|
MAKER = Factory()
|
||||||
|
TERMINATOR = Terminator()
|
||||||
|
TERMINATOR.set_origcwd(ORIGCWD)
|
||||||
|
TERMINATOR.set_dbus_data(dbus_service)
|
||||||
|
TERMINATOR.reconfigure()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
dbg('Creating a terminal with layout: %s' % OPTIONS.layout)
|
dbg('Creating a terminal with layout: %s' % OPTIONS.layout)
|
||||||
TERMINATOR.create_layout(OPTIONS.layout)
|
TERMINATOR.create_layout(OPTIONS.layout)
|
||||||
|
|
Loading…
Reference in New Issue