@humanu/orchestra 0.5.78 → 0.5.79
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.
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -524,7 +524,7 @@ _tmux_workspace_session_rows() {
|
|
|
524
524
|
have_cmd python3 || return 0
|
|
525
525
|
|
|
526
526
|
active_file="$(mktemp)"
|
|
527
|
-
tmux list-sessions -F '#{session_name}' > "$active_file" 2>/dev/null || {
|
|
527
|
+
tmux list-sessions -F $'#{session_name}\t#{session_last_attached}\t#{session_activity}' > "$active_file" 2>/dev/null || {
|
|
528
528
|
rm -f "$active_file"
|
|
529
529
|
return 0
|
|
530
530
|
}
|
|
@@ -534,8 +534,22 @@ import sqlite3
|
|
|
534
534
|
import sys
|
|
535
535
|
|
|
536
536
|
db_path, repo_root, current_session, active_path, mode = sys.argv[1:6]
|
|
537
|
+
def parse_tmux_time(value):
|
|
538
|
+
try:
|
|
539
|
+
return int(value.strip() or "0")
|
|
540
|
+
except ValueError:
|
|
541
|
+
return 0
|
|
542
|
+
|
|
543
|
+
active = {}
|
|
537
544
|
with open(active_path, "r", encoding="utf-8") as handle:
|
|
538
|
-
|
|
545
|
+
for raw_line in handle:
|
|
546
|
+
parts = raw_line.rstrip("\n").split("\t")
|
|
547
|
+
name = parts[0].strip() if parts else ""
|
|
548
|
+
if not name:
|
|
549
|
+
continue
|
|
550
|
+
last_attached = parse_tmux_time(parts[1]) if len(parts) > 1 else 0
|
|
551
|
+
activity = parse_tmux_time(parts[2]) if len(parts) > 2 else 0
|
|
552
|
+
active[name] = (last_attached, activity)
|
|
539
553
|
|
|
540
554
|
conn = sqlite3.connect(db_path)
|
|
541
555
|
rows = conn.execute(
|
|
@@ -552,30 +566,33 @@ filtered = []
|
|
|
552
566
|
seen = set()
|
|
553
567
|
for name, display_name in rows:
|
|
554
568
|
if name in active and name not in seen:
|
|
555
|
-
filtered.append((name, display_name or ""))
|
|
569
|
+
filtered.append((name, display_name or "", len(filtered)))
|
|
556
570
|
seen.add(name)
|
|
557
571
|
|
|
558
572
|
if not filtered:
|
|
559
573
|
raise SystemExit(0)
|
|
560
574
|
|
|
575
|
+
filtered.sort(
|
|
576
|
+
key=lambda row: (
|
|
577
|
+
row[0] != current_session,
|
|
578
|
+
-active.get(row[0], (0, 0))[0],
|
|
579
|
+
-active.get(row[0], (0, 0))[1],
|
|
580
|
+
row[2],
|
|
581
|
+
)
|
|
582
|
+
)
|
|
583
|
+
|
|
561
584
|
max_tabs = 8
|
|
562
585
|
if mode == "all" or len(filtered) <= max_tabs:
|
|
563
586
|
visible = filtered
|
|
564
587
|
prefix = suffix = False
|
|
565
588
|
else:
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
current_index = 0
|
|
570
|
-
start = max(0, min(current_index - 2, len(filtered) - max_tabs))
|
|
571
|
-
end = min(len(filtered), start + max_tabs)
|
|
572
|
-
visible = filtered[start:end]
|
|
573
|
-
prefix = start > 0
|
|
574
|
-
suffix = end < len(filtered)
|
|
589
|
+
visible = filtered[:max_tabs]
|
|
590
|
+
prefix = False
|
|
591
|
+
suffix = True
|
|
575
592
|
|
|
576
593
|
if prefix:
|
|
577
594
|
print("__ellipsis__\t")
|
|
578
|
-
for name, display_name in visible:
|
|
595
|
+
for name, display_name, _ in visible:
|
|
579
596
|
print(f"{name}\t{display_name}")
|
|
580
597
|
if suffix:
|
|
581
598
|
print("__ellipsis__\t")
|
|
@@ -644,21 +661,10 @@ _tmux_workspace_session_tabs() {
|
|
|
644
661
|
printf '%s' "$tabs"
|
|
645
662
|
}
|
|
646
663
|
|
|
647
|
-
_tmux_current_session_label() {
|
|
648
|
-
local session_display_name="$1"
|
|
649
|
-
local label escaped_label
|
|
650
|
-
|
|
651
|
-
label="$(_tmux_truncate_tab_label "$session_display_name" 28)"
|
|
652
|
-
escaped_label="$(_tmux_status_escape_text "$label")"
|
|
653
|
-
printf '#[fg=#ffffff,bg=#3d59a1,bold] %s #[fg=#3d59a1,bg=#1a1b26,nobold]│#[default]' "$escaped_label"
|
|
654
|
-
}
|
|
655
|
-
|
|
656
664
|
_tmux_orchestra_status_left() {
|
|
657
665
|
local session_name="$1"
|
|
658
666
|
local session_display_name="$3"
|
|
659
|
-
|
|
660
|
-
"$(_tmux_current_session_label "$session_display_name")" \
|
|
661
|
-
"$(_tmux_workspace_session_tabs "$session_name" "$session_display_name")"
|
|
667
|
+
_tmux_workspace_session_tabs "$session_name" "$session_display_name"
|
|
662
668
|
}
|
|
663
669
|
|
|
664
670
|
_tmux_orchestra_status_right() {
|