@@ -340,10 +340,13 @@ def delete_page_by_label(self, label, kill=True, prompt=0):
340
340
def delete_page_current (self , kill = True , prompt = 0 ):
341
341
self .delete_page (self .get_current_page (), kill , prompt )
342
342
343
- def new_page (self , directory = None , position = None ):
344
- terminal = self .terminal_spawn (directory )
343
+ def new_page (self , directory = None , position = None , empty = False ):
345
344
terminal_box = TerminalBox ()
346
- terminal_box .set_terminal (terminal )
345
+ if empty :
346
+ terminal = None
347
+ else :
348
+ terminal = self .terminal_spawn (directory )
349
+ terminal_box .set_terminal (terminal )
347
350
root_terminal_box = RootTerminalBox (self .guake , self )
348
351
root_terminal_box .set_child (terminal_box )
349
352
page_num = self .insert_page (
@@ -358,7 +361,8 @@ def new_page(self, directory=None, position=None):
358
361
)
359
362
# this is needed to initially set the last_terminal_focused,
360
363
# one could also call terminal.get_parent().on_terminal_focus()
361
- self .terminal_attached (terminal )
364
+ if not empty :
365
+ self .terminal_attached (terminal )
362
366
self .hide_tabbar_if_one_tab ()
363
367
364
368
if self .guake :
@@ -405,14 +409,17 @@ def terminal_attached(self, terminal):
405
409
terminal .emit ("focus" , Gtk .DirectionType .TAB_FORWARD )
406
410
self .emit ("terminal-spawned" , terminal , terminal .pid )
407
411
408
- def new_page_with_focus (self , directory = None , label = None , user_set = False , position = None ):
409
- box , page_num , terminal = self .new_page (directory , position = position )
412
+ def new_page_with_focus (
413
+ self , directory = None , label = None , user_set = False , position = None , empty = False
414
+ ):
415
+ box , page_num , terminal = self .new_page (directory , position = position , empty = empty )
410
416
self .set_current_page (page_num )
411
417
if not label :
412
418
self .rename_page (page_num , _ ("Terminal" ), False )
413
419
else :
414
420
self .rename_page (page_num , label , user_set )
415
- terminal .grab_focus ()
421
+ if terminal is not None :
422
+ terminal .grab_focus ()
416
423
return box , page_num , terminal
417
424
418
425
def rename_page (self , page_index , new_text , user_set = False ):
0 commit comments