@@ -494,69 +494,3 @@ def find_current_attached_session(self):
494494
495495 def first_window_pass (self , i , session , append ):
496496 return len (session .windows ) == 1 and i == 1 and not append
497-
498-
499- def freeze (session ):
500- """
501- Freeze live tmux session and Return session config :py:obj:`dict`.
502-
503- Parameters
504- ----------
505- session : :class:`libtmux.Session`
506- session object
507-
508- Returns
509- -------
510- dict
511- tmuxp compatible workspace config
512- """
513- sconf = {"session_name" : session ["session_name" ], "windows" : []}
514-
515- for w in session .windows :
516- wconf = {
517- "options" : w .show_window_options (),
518- "window_name" : w .name ,
519- "layout" : w .layout ,
520- "panes" : [],
521- }
522- if w .get ("window_active" , "0" ) == "1" :
523- wconf ["focus" ] = "true"
524-
525- # If all panes have same path, set 'start_directory' instead
526- # of using 'cd' shell commands.
527- def pane_has_same_path (p ):
528- return w .panes [0 ].current_path == p .current_path
529-
530- if all (pane_has_same_path (p ) for p in w .panes ):
531- wconf ["start_directory" ] = w .panes [0 ].current_path
532-
533- for p in w .panes :
534- pconf = {"shell_command" : []}
535-
536- if "start_directory" not in wconf :
537- pconf ["shell_command" ].append ("cd " + p .current_path )
538-
539- if p .get ("pane_active" , "0" ) == "1" :
540- pconf ["focus" ] = "true"
541-
542- current_cmd = p .current_command
543-
544- def filter_interpretters_and_shells ():
545- return current_cmd .startswith ("-" ) or any (
546- current_cmd .endswith (cmd ) for cmd in ["python" , "ruby" , "node" ]
547- )
548-
549- if filter_interpretters_and_shells ():
550- current_cmd = None
551-
552- if current_cmd :
553- pconf ["shell_command" ].append (current_cmd )
554- else :
555- if not len (pconf ["shell_command" ]):
556- pconf = "pane"
557-
558- wconf ["panes" ].append (pconf )
559-
560- sconf ["windows" ].append (wconf )
561-
562- return sconf
0 commit comments