workmap 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- workmap/__init__.py +30 -0
- workmap/__main__.py +15 -0
- workmap/actions.py +350 -0
- workmap/audit.py +153 -0
- workmap/cli.py +789 -0
- workmap/config.py +589 -0
- workmap/demo.py +94 -0
- workmap/drivers/__init__.py +93 -0
- workmap/drivers/apple_terminal.py +578 -0
- workmap/layout.py +64 -0
- workmap/model.py +719 -0
- workmap/multiplexer.py +201 -0
- workmap/procs.py +504 -0
- workmap/scan.py +413 -0
- workmap/setup.py +400 -0
- workmap/shell.py +117 -0
- workmap/terminal.py +50 -0
- workmap/themes.py +45 -0
- workmap/tui/__init__.py +6 -0
- workmap/tui/app.py +1090 -0
- workmap/tui/onboarding.py +266 -0
- workmap/tui/text.py +156 -0
- workmap/tui/widgets.py +189 -0
- workmap-0.1.0.dist-info/METADATA +258 -0
- workmap-0.1.0.dist-info/RECORD +28 -0
- workmap-0.1.0.dist-info/WHEEL +4 -0
- workmap-0.1.0.dist-info/entry_points.txt +2 -0
- workmap-0.1.0.dist-info/licenses/LICENSE +21 -0
workmap/layout.py
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"""Screen geometry for `organize`: how to divide the desktop into regions.
|
|
2
|
+
|
|
3
|
+
Pure arithmetic plus one call into the terminal driver to place windows."""
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
from . import terminal
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def _usable_desktop() -> tuple[int, int, int, int]:
|
|
10
|
+
"""left, top, right, bottom, leaves room for menu bar + dock."""
|
|
11
|
+
x1, y1, x2, y2 = terminal.desktop_bounds()
|
|
12
|
+
return x1 + 6, y1 + 28, x2 - 6, y2 - 56
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _grid_shape(n: int) -> tuple[int, int]:
|
|
16
|
+
if n <= 1:
|
|
17
|
+
return 1, 1
|
|
18
|
+
if n == 2:
|
|
19
|
+
return 1, 2
|
|
20
|
+
if n <= 4:
|
|
21
|
+
return 2, 2
|
|
22
|
+
if n <= 6:
|
|
23
|
+
return 2, 3
|
|
24
|
+
cols = 3 if n <= 9 else 4
|
|
25
|
+
rows = (n + cols - 1) // cols
|
|
26
|
+
return rows, cols
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def tile_windows_in_rect(
|
|
30
|
+
window_ids: list[int],
|
|
31
|
+
rect: tuple[int, int, int, int],
|
|
32
|
+
*,
|
|
33
|
+
front: bool = True,
|
|
34
|
+
) -> int:
|
|
35
|
+
"""Tile windows inside (left, top, right, bottom).
|
|
36
|
+
|
|
37
|
+
Returns how many windows actually moved, which is not always how many were
|
|
38
|
+
asked to: see `place_windows`.
|
|
39
|
+
"""
|
|
40
|
+
if not window_ids:
|
|
41
|
+
return 0
|
|
42
|
+
left, top, right, bottom = rect
|
|
43
|
+
width = max(320, right - left)
|
|
44
|
+
height = max(240, bottom - top)
|
|
45
|
+
rows, cols = _grid_shape(len(window_ids))
|
|
46
|
+
cell_w, cell_h = width // cols, height // rows
|
|
47
|
+
gap = 4
|
|
48
|
+
placements = []
|
|
49
|
+
for i, wid in enumerate(window_ids):
|
|
50
|
+
row, col = i // cols, i % cols
|
|
51
|
+
placements.append((wid, (
|
|
52
|
+
left + col * cell_w + gap,
|
|
53
|
+
top + row * cell_h + gap,
|
|
54
|
+
left + (col + 1) * cell_w - gap,
|
|
55
|
+
top + (row + 1) * cell_h - gap,
|
|
56
|
+
)))
|
|
57
|
+
return terminal.place_windows(placements, front_first=front)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def gather_windows(window_ids: list[int]) -> int:
|
|
61
|
+
"""Legacy helper: tile across the full usable desktop."""
|
|
62
|
+
left, top, right, bottom = _usable_desktop()
|
|
63
|
+
return tile_windows_in_rect(window_ids, (left, top, right, bottom),
|
|
64
|
+
front=True)
|