@@ -44,7 +44,7 @@ def __init__(
4444 self ,
4545 command_timeout : float | None = 10.0 ,
4646 notification_queue_size : int = 4096 ,
47- session_name : str | None = None ,
47+ internal_session_name : str | None = None ,
4848 attach_to : str | None = None ,
4949 ) -> None :
5050 """Initialize control mode engine.
@@ -55,7 +55,7 @@ def __init__(
5555 Timeout for tmux commands in seconds. Default: 10.0
5656 notification_queue_size : int
5757 Size of notification queue. Default: 4096
58- session_name : str, optional
58+ internal_session_name : str, optional
5959 Custom name for internal control session.
6060 Default: "libtmux_control_mode"
6161
@@ -81,7 +81,7 @@ def __init__(
8181 notification_queue_size = notification_queue_size ,
8282 )
8383 self ._restarts = 0
84- self ._session_name = session_name or "libtmux_control_mode"
84+ self ._internal_session_name = internal_session_name or "libtmux_control_mode"
8585 self ._attach_to = attach_to
8686
8787 # Lifecycle ---------------------------------------------------------
@@ -183,7 +183,14 @@ def get_stats(self) -> EngineStats:
183183 """Return diagnostic statistics for the engine."""
184184 return self ._protocol .get_stats (restarts = self ._restarts )
185185
186- def filter_attached_sessions (
186+ @property
187+ def internal_session_names (self ) -> set [str ]:
188+ """Session names reserved for the engine's control connection."""
189+ if self ._attach_to :
190+ return set ()
191+ return {self ._internal_session_name }
192+
193+ def exclude_internal_sessions (
187194 self ,
188195 sessions : list [Session ],
189196 * ,
@@ -217,7 +224,7 @@ def filter_attached_sessions(
217224
218225 # Never expose the internal control session we create to hold the
219226 # control client when attach_to is unset.
220- if not self ._attach_to and sess_name == self ._session_name :
227+ if not self ._attach_to and sess_name == self ._internal_session_name :
221228 continue
222229
223230 clients = pid_map .get (sess_name , [])
@@ -314,15 +321,15 @@ def _start_process(self, server_args: tuple[str | int, ...]) -> None:
314321 "new-session" ,
315322 "-A" ,
316323 "-s" ,
317- self ._session_name ,
324+ self ._internal_session_name ,
318325 ]
319326 bootstrap_argv = [
320327 tmux_bin ,
321328 * [str (a ) for a in server_args ],
322329 "new-session" ,
323330 "-A" ,
324331 "-s" ,
325- self ._session_name ,
332+ self ._internal_session_name ,
326333 ]
327334
328335 logger .debug ("Starting Control Mode process: %s" , cmd )
0 commit comments