tmux_styler.Statusbar.WindowList

 1from enum import Enum
 2from .Segment import *
 3
 4
 5class WindowListAlignment(Enum):
 6    """
 7    Alignment/justification of the window list.
 8
 9    Attributes:
10    -----------
11        `LEFT` (str): Left justify window list (place on the left part of the status line)
12
13        `RIGHT` (str): Right justify window list (place on the right part of the status line)
14
15        `CENTER` (str): Center the window list, relative center of the status line left/right
16
17        `ABS_CENTER` (str): Center the window list, but absolute center of the status line
18    """
19
20    LEFT = "left"
21    """
22    Left justify window list (place on the left part of the status line)
23    """
24
25    RIGHT = "right"
26    """
27    Right justify window list (place on the right part of the status line)
28    """
29
30    CENTER = "centre"
31    """
32    Center the window list, relative center of the status line left/right
33    """
34
35    ABS_CENTER = "absolute-centre"
36    """
37    Center the window list, but absolute center of the status line
38    """
39
40    def __str__(self):
41        """
42        String representation of the alignment
43        """
44        return self.value
45
46
47class WindowList:
48    """
49    The tmux window list
50    """
51
52    active: Segment
53    """
54    Segment to use for the currently active window
55    """
56
57    inactive: Segment
58    """
59    Segment to use for inactive windows
60    """
61
62    alignment: WindowListAlignment = WindowListAlignment.LEFT
63    """
64    Alignment/justification of the window list.
65    """
66
67    style: Style | None
68
69    def __init__(self, active: Segment, inactive: Segment):
70        """
71        Style the window list
72        """
73        self.active = active
74        self.inactive = inactive
75
76    def __commands(self) -> list[str]:
77        """
78        Returns the commands to run to get the window list
79        """
80        return [
81            # Justify
82            f'tmux set -g status-justify {str(self.alignment)}',
83            # Active
84            'tmux set -g window-status-current-format "#(tmux-styler -sw active)"',
85            # Inactive
86            'tmux set -g window-status-format "#(tmux-styler -sw inactive)"',
87            # Handle separators myself
88            f'tmux set -g window-status-separator ""',
89        ]
class WindowListAlignment(enum.Enum):
 6class WindowListAlignment(Enum):
 7    """
 8    Alignment/justification of the window list.
 9
10    Attributes:
11    -----------
12        `LEFT` (str): Left justify window list (place on the left part of the status line)
13
14        `RIGHT` (str): Right justify window list (place on the right part of the status line)
15
16        `CENTER` (str): Center the window list, relative center of the status line left/right
17
18        `ABS_CENTER` (str): Center the window list, but absolute center of the status line
19    """
20
21    LEFT = "left"
22    """
23    Left justify window list (place on the left part of the status line)
24    """
25
26    RIGHT = "right"
27    """
28    Right justify window list (place on the right part of the status line)
29    """
30
31    CENTER = "centre"
32    """
33    Center the window list, relative center of the status line left/right
34    """
35
36    ABS_CENTER = "absolute-centre"
37    """
38    Center the window list, but absolute center of the status line
39    """
40
41    def __str__(self):
42        """
43        String representation of the alignment
44        """
45        return self.value

Alignment/justification of the window list.

Attributes:

`LEFT` (str): Left justify window list (place on the left part of the status line)

`RIGHT` (str): Right justify window list (place on the right part of the status line)

`CENTER` (str): Center the window list, relative center of the status line left/right

`ABS_CENTER` (str): Center the window list, but absolute center of the status line
LEFT = <WindowListAlignment.LEFT: 'left'>

Left justify window list (place on the left part of the status line)

RIGHT = <WindowListAlignment.RIGHT: 'right'>

Right justify window list (place on the right part of the status line)

CENTER = <WindowListAlignment.CENTER: 'centre'>

Center the window list, relative center of the status line left/right

ABS_CENTER = <WindowListAlignment.ABS_CENTER: 'absolute-centre'>

Center the window list, but absolute center of the status line

Inherited Members
enum.Enum
name
value
class WindowList:
48class WindowList:
49    """
50    The tmux window list
51    """
52
53    active: Segment
54    """
55    Segment to use for the currently active window
56    """
57
58    inactive: Segment
59    """
60    Segment to use for inactive windows
61    """
62
63    alignment: WindowListAlignment = WindowListAlignment.LEFT
64    """
65    Alignment/justification of the window list.
66    """
67
68    style: Style | None
69
70    def __init__(self, active: Segment, inactive: Segment):
71        """
72        Style the window list
73        """
74        self.active = active
75        self.inactive = inactive
76
77    def __commands(self) -> list[str]:
78        """
79        Returns the commands to run to get the window list
80        """
81        return [
82            # Justify
83            f'tmux set -g status-justify {str(self.alignment)}',
84            # Active
85            'tmux set -g window-status-current-format "#(tmux-styler -sw active)"',
86            # Inactive
87            'tmux set -g window-status-format "#(tmux-styler -sw inactive)"',
88            # Handle separators myself
89            f'tmux set -g window-status-separator ""',
90        ]

The tmux window list

70    def __init__(self, active: Segment, inactive: Segment):
71        """
72        Style the window list
73        """
74        self.active = active
75        self.inactive = inactive

Style the window list

Segment to use for the currently active window

Segment to use for inactive windows

Alignment/justification of the window list.

style: tmux_styler.Style.Style | None