diff options
Diffstat (limited to 'crates/dinggerd/src/tmux.rs')
| -rw-r--r-- | crates/dinggerd/src/tmux.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/crates/dinggerd/src/tmux.rs b/crates/dinggerd/src/tmux.rs index 326eda9..6189c4b 100644 --- a/crates/dinggerd/src/tmux.rs +++ b/crates/dinggerd/src/tmux.rs @@ -12,6 +12,8 @@ pub struct Pane { pub display_target: String, /// Last OSC title the pane's application set, from `#{pane_title}`. pub pane_title: String, + /// Working directory of the pane's foreground process. + pub cwd: String, pub dead: bool, /// The pane's window is the current window of its session. pub window_active: bool, @@ -24,6 +26,7 @@ pub struct Pane { pub written_ack: String, pub written_since: String, pub written_hook: String, + pub written_name: String, } impl Pane { @@ -73,14 +76,16 @@ pub fn list_panes() -> Result<Vec<Pane>, String> { "#{@dingger_hook}\t", "#{session_name}:#{window_name}\t", "#{window_panes}\t", - "#{pane_index}", + "#{pane_index}\t", + "#{pane_current_path}\t", + "#{@agent_name}", ); let out = run_tmux(&["list-panes", "-a", "-F", format])?; let mut panes = Vec::new(); let mut process_tree = None; for line in out.lines() { let fields: Vec<&str> = line.split('\t').collect(); - if fields.len() < 16 { + if fields.len() < 18 { continue; } let current_command = fields[1]; @@ -106,6 +111,7 @@ pub fn list_panes() -> Result<Vec<Pane>, String> { pane_id: fields[0].to_string(), display_target, pane_title: fields[2].to_string(), + cwd: fields[16].to_string(), dead: fields[3] == "1", window_active: fields[4] == "1", session_attached: fields[5] != "0", @@ -115,6 +121,7 @@ pub fn list_panes() -> Result<Vec<Pane>, String> { written_ack: fields[10].to_string(), written_since: fields[11].to_string(), written_hook: fields[12].to_string(), + written_name: fields[17].to_string(), }); } Ok(panes) |
