| 1 |
"""Constant variables for libtmux.""" |
| 2 |
|
| 3 |
from __future__ import annotations |
| 4 |
|
| 5 |
import enum |
| 6 |
|
| 7 |
|
| 8 |
class ResizeAdjustmentDirection(enum.Enum): |
| 9 |
"""Used for *adjustment* in ``resize_window``, ``resize_pane``.""" |
| 10 |
|
| 11 |
Up = "UP" |
| 12 |
Down = "DOWN" |
| 13 |
Left = "LEFT" |
| 14 |
Right = "RIGHT" |
| 15 |
|
| 16 |
|
| 17 |
RESIZE_ADJUSTMENT_DIRECTION_FLAG_MAP: dict[ResizeAdjustmentDirection, str] = { |
| 18 |
ResizeAdjustmentDirection.Up: "-U", |
| 19 |
ResizeAdjustmentDirection.Down: "-D", |
| 20 |
ResizeAdjustmentDirection.Left: "-L", |
| 21 |
ResizeAdjustmentDirection.Right: "-R", |
| 22 |
} |
| 23 |
|
| 24 |
|
| 25 |
class WindowDirection(enum.Enum): |
| 26 |
"""Used for *adjustment* in :meth:`Session.new_window()`.""" |
| 27 |
|
| 28 |
Before = "BEFORE" |
| 29 |
After = "AFTER" |
| 30 |
|
| 31 |
|
| 32 |
WINDOW_DIRECTION_FLAG_MAP: dict[WindowDirection, str] = { |
| 33 |
WindowDirection.Before: "-b", |
| 34 |
WindowDirection.After: "-a", |
| 35 |
} |
| 36 |
|
| 37 |
|
| 38 |
class PaneDirection(enum.Enum): |
| 39 |
"""Used for *adjustment* in :meth:`Pane.split()`.""" |
| 40 |
|
| 41 |
Above = "ABOVE" |
| 42 |
Below = "BELOW" |
| 43 |
Right = "RIGHT" |
| 44 |
Left = "LEFT" |
| 45 |
|
| 46 |
|
| 47 |
PANE_DIRECTION_FLAG_MAP: dict[PaneDirection, list[str]] = { |
| 48 |
|
| 49 |
PaneDirection.Above: ["-v", "-b"], |
| 50 |
PaneDirection.Below: ["-v"], |
| 51 |
PaneDirection.Right: ["-h"], |
| 52 |
PaneDirection.Left: ["-h", "-b"], |
| 53 |
} |
| 54 |
|
| 55 |
|
| 56 |
class _DefaultOptionScope: |
| 57 |
|
| 58 |
... |
| 59 |
|
| 60 |
|
| 61 |
DEFAULT_OPTION_SCOPE: _DefaultOptionScope = _DefaultOptionScope() |
| 62 |
|
| 63 |
|
| 64 |
class OptionScope(enum.Enum): |
| 65 |
"""Scope used with ``set-option`` and ``show-option(s)`` commands.""" |
| 66 |
|
| 67 |
Server = "SERVER" |
| 68 |
Session = "SESSION" |
| 69 |
Window = "WINDOW" |
| 70 |
Pane = "PANE" |
| 71 |
|
| 72 |
|
| 73 |
OPTION_SCOPE_FLAG_MAP: dict[OptionScope, str] = { |
| 74 |
OptionScope.Server: "-s", |
| 75 |
OptionScope.Session: "", |
| 76 |
OptionScope.Window: "-w", |
| 77 |
OptionScope.Pane: "-p", |
| 78 |
} |
| 79 |
|
| 80 |
HOOK_SCOPE_FLAG_MAP: dict[OptionScope, str] = { |
| 81 |
OptionScope.Server: "-g", |
| 82 |
OptionScope.Session: "", |
| 83 |
OptionScope.Window: "-w", |
| 84 |
OptionScope.Pane: "-p", |
| 85 |
} |