diff options
Diffstat (limited to 'menubar/model.swift')
| -rw-r--r-- | menubar/model.swift | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/menubar/model.swift b/menubar/model.swift index a17b009..8bed858 100644 --- a/menubar/model.swift +++ b/menubar/model.swift @@ -228,9 +228,12 @@ func fetchRows() -> [Row] { "#{session_name}", "#{window_name}", "#{window_panes}", "#{pane_index}", "#{pane_current_path}", ].joined(separator: "\t") guard let out = tmux(["list-panes", "-a", "-F", format]) else { return [] } + // A pane in several sessions (a session group, a linked window) is + // listed once, under its first session, as the daemon counts it. + var listed = Set<String>() let rows: [Row] = out.split(separator: "\n").compactMap { line in let f = line.split(separator: "\t", omittingEmptySubsequences: false).map(String.init) - guard f.count >= 10, !f[1].isEmpty else { return nil } + guard f.count >= 10, !f[1].isEmpty, listed.insert(f[0]).inserted else { return nil } let status = Status(rawValue: f[2]) ?? .unknown guard status != .unknown else { return nil } let window = (Int(f[7]) ?? 1) > 1 ? "\(f[6]).\(f[8])" : f[6] |
