list attach symbol is now configurable

This commit is contained in:
Valerie Wolfe 2024-03-06 16:12:54 -05:00
parent 9c814c43f4
commit be593c82e7
2 changed files with 11 additions and 3 deletions

View file

@ -85,6 +85,10 @@ using an AUR package manager such as <a href="https://github.com/Morganamilo/par
Install the package using Cargo with the command <code>cargo install tmux-remux</code>.
</details>
## Configuration
The pretty-print attached symbol (default: `*`) can be set manually by setting `REMUX_ATTACH_SYMBOL`.
## Libraries
- [pico-args](https://crates.io/crates/pico_args) — argument parsing

View file

@ -1,5 +1,6 @@
//! globally available tmux commands.
use std::{
env::var,
ffi::OsString,
process::exit
};
@ -117,6 +118,9 @@ pub fn list() {
return;
}
// get attached session symbol
let attach_symbol = var("REMUX_ATTACH_SYMBOL").unwrap_or("*".to_string());
// pretty print session list
println!("sessions:");
for session in sessions.into_iter() {
@ -125,9 +129,9 @@ pub fn list() {
let attached = session.attached.unwrap_or(0) > 0;
println!(
" {group} ({bold}{blue}{id}{reset}) {bold}{green}{attach_sym}{reset}",
// value
attach_sym = if attached { "\u{F0339}" } else { "" },
" {group} ({bold}{blue}{id}{reset}) {bold}{green}{attach}{reset}",
// values
attach = if attached { attach_symbol.clone() } else { "".to_string() },
// formatting
bold = style::Bold,
blue = color::Fg(color::Blue),