Skip to content

Commit

Permalink
feat: add a new max_clients config param
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrinux committed Nov 22, 2023
1 parent c097cbb commit eaff815
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ impl Default for ConfigFormatRaw {

#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)]
pub struct ConfigFormatRaw {
#[serde(default)]
pub max_clients: Option<i32>,
#[serde(default)]
pub dedup: bool,
#[serde(default)]
Expand Down Expand Up @@ -263,6 +265,7 @@ version = "1.1.11"
# dedup_inactive_fullscreen = false # dedup more
# window delimiter
# delim = " "
# max_clients = 30
# available formatter:
# {counter_sup} - superscripted count of clients on the workspace, and simple {counter}, {delim}
Expand Down
6 changes: 6 additions & 0 deletions src/renamer/formatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ impl Renamer {
let workspace_output = counted
.iter_mut()
.map(|(client, counter)| self.handle_new_client(client, *counter, config))
.take(
config
.format
.max_clients
.map_or(usize::MAX, |max| max as usize),
)
.collect::<Vec<String>>();

let delimiter = formatter("{delim}", &vars);
Expand Down

0 comments on commit eaff815

Please sign in to comment.