tmux_styler.Statusbar.Segments.TmuxInfo
1from . import DefinedSegment 2from ...ContextVars import ContextVar 3 4 5def window_info() -> DefinedSegment: 6 """ 7 Segment that displays window information, the window index, flags, and name. 8 """ 9 return [ContextVar.WINDOW_INDEX, ContextVar.WINDOW_FLAGS, " | ", ContextVar.WINDOW_NAME] 10 11 12def session_name() -> DefinedSegment: 13 """ 14 The name of the current session. 15 """ 16 return [ContextVar.SESSION_NAME] 17 18 19def cwd(max_length: int = 30) -> DefinedSegment: 20 """ 21 The current/present working directory. 22 23 Parameters: 24 ----------- 25 `max_length` (int): 26 The maximum length of the path. Defaults to 30. 27 """ 28 path = ContextVar.PANE_CURRENT_PATH.current_value()[1:-1] 29 if len(path) > max_length: 30 path = path[-max_length+3:] 31 index = path.find("/") 32 if index != -1: 33 path = "..." + path[index:] 34 else: 35 path = "..." + path 36 37 return path
def
window_info() -> str | tmux_styler.ContextVars.ContextVar | list[str | tmux_styler.ContextVars.ContextVar]:
6def window_info() -> DefinedSegment: 7 """ 8 Segment that displays window information, the window index, flags, and name. 9 """ 10 return [ContextVar.WINDOW_INDEX, ContextVar.WINDOW_FLAGS, " | ", ContextVar.WINDOW_NAME]
Segment that displays window information, the window index, flags, and name.
def
session_name() -> str | tmux_styler.ContextVars.ContextVar | list[str | tmux_styler.ContextVars.ContextVar]:
13def session_name() -> DefinedSegment: 14 """ 15 The name of the current session. 16 """ 17 return [ContextVar.SESSION_NAME]
The name of the current session.
def
cwd( max_length: int = 30) -> str | tmux_styler.ContextVars.ContextVar | list[str | tmux_styler.ContextVars.ContextVar]:
20def cwd(max_length: int = 30) -> DefinedSegment: 21 """ 22 The current/present working directory. 23 24 Parameters: 25 ----------- 26 `max_length` (int): 27 The maximum length of the path. Defaults to 30. 28 """ 29 path = ContextVar.PANE_CURRENT_PATH.current_value()[1:-1] 30 if len(path) > max_length: 31 path = path[-max_length+3:] 32 index = path.find("/") 33 if index != -1: 34 path = "..." + path[index:] 35 else: 36 path = "..." + path 37 38 return path
The current/present working directory.
Parameters:
max_length
(int):
The maximum length of the path. Defaults to 30.