@martintrojer/murmur 0.2.0 → 0.2.1

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/dist/index.js CHANGED
@@ -62,6 +62,10 @@ function runTmux(args) {
62
62
  return null;
63
63
  }
64
64
  }
65
+ function chosenWindowName(name, autoRename) {
66
+ if (autoRename === "1") return null;
67
+ return name || null;
68
+ }
65
69
  function exactSession(session) {
66
70
  return `=${session}`;
67
71
  }
@@ -81,16 +85,16 @@ var tmux = {
81
85
  "-t",
82
86
  pane,
83
87
  "-p",
84
- "#{session_id} #{window_id} #{session_name} #{window_name}"
88
+ "#{session_id} #{window_id} #{session_name} #{window_name} #{?automatic-rename,1,0}"
85
89
  ]);
86
- const [session, window, sessionName, windowName] = fields?.split(" ") ?? [];
90
+ const [session, window, sessionName, windowName, autoRename] = fields?.split(" ") ?? [];
87
91
  if (!session || !window) return null;
88
92
  return {
89
93
  session: asSessionId(session),
90
94
  window: asWindowId(window),
91
95
  pane,
92
96
  session_name: sessionName || null,
93
- window_name: windowName || null
97
+ window_name: chosenWindowName(windowName, autoRename)
94
98
  };
95
99
  },
96
100
  // Which of this host's PANES still exist. The only liveness question tmux is
@@ -611,7 +615,7 @@ function stripInvocation(message) {
611
615
  function normalizeFailure(message) {
612
616
  return stripInvocation(message).replace(/\s+/g, " ").trim();
613
617
  }
614
- async function collect(store, channel, now = Date.now(), deadline) {
618
+ async function collect(store, channel, now = Date.now(), deadline, mux = tmux) {
615
619
  const results = [];
616
620
  let timer;
617
621
  try {
@@ -658,7 +662,7 @@ async function collect(store, channel, now = Date.now(), deadline) {
658
662
  clearTimeout(timer);
659
663
  }
660
664
  try {
661
- store.reconcileLocal({ panes: tmux.livePanes(), now });
665
+ store.reconcileLocal({ panes: mux.livePanes(), now });
662
666
  } catch {
663
667
  }
664
668
  return results;
@@ -783,9 +787,9 @@ function status(store, identity, now = Date.now()) {
783
787
  }))
784
788
  };
785
789
  }
786
- async function statusWithCollect(store, identity, now = Date.now(), channel = ssh) {
790
+ async function statusWithCollect(store, identity, now = Date.now(), channel = ssh, mux = tmux) {
787
791
  try {
788
- await collect(store, channel, now);
792
+ await collect(store, channel, now, void 0, mux);
789
793
  } catch {
790
794
  }
791
795
  return status(store, identity, now);