From d06a3ccc8740f7c2f8a02c90ed47138fe469f3ad Mon Sep 17 00:00:00 2001 From: tjex Date: Sat, 14 Dec 2024 18:22:10 +0100 Subject: [PATCH 1/8] add unselected dim config option --- src/config.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/config.rs b/src/config.rs index da608ce0..709a10e9 100644 --- a/src/config.rs +++ b/src/config.rs @@ -146,6 +146,7 @@ impl Config { let uda_selection_dim = Self::get_uda_selection_dim(data); let uda_selection_blink = Self::get_uda_selection_blink(data); let uda_selection_reverse = Self::get_uda_selection_reverse(data); + let uda_unselected_dim = Self::get_uda_unselected_dim(data); let uda_calendar_months_per_row = Self::get_uda_months_per_row(data); let uda_style_report_selection = Self::get_uda_style("report.selection", data); let uda_style_report_scrollbar = Self::get_uda_style("report.scrollbar", data); @@ -213,6 +214,7 @@ impl Config { uda_selection_dim, uda_selection_blink, uda_selection_reverse, + uda_unselected_dim, uda_calendar_months_per_row, uda_style_report_selection, uda_style_context_active, @@ -691,8 +693,8 @@ impl Config { .unwrap_or(false) } - fn get_uda_selection_dim(data: &str) -> bool { - Self::get_config("uda.taskwarrior-tui.selection.dim", data) + fn get_uda_unselected_dim(data: &str) -> bool { + Self::get_config("uda.taskwarrior-tui.unselected.dim", data) .unwrap_or_default() .get_bool() .unwrap_or(false) @@ -712,6 +714,13 @@ impl Config { .unwrap_or(false) } + fn get_uda_selection_dim(data: &str) -> bool { + Self::get_config("uda.taskwarrior-tui.selection.dim", data) + .unwrap_or_default() + .get_bool() + .unwrap_or(false) + } + fn get_uda_months_per_row(data: &str) -> usize { Self::get_config("uda.taskwarrior-tui.calendar.months-per-row", data) .unwrap_or_default() From a4c96f69b10efb51d2f742c8d1fc94b9e24af4a2 Mon Sep 17 00:00:00 2001 From: tjex Date: Sat, 14 Dec 2024 19:18:38 +0100 Subject: [PATCH 2/8] add unselected_dim style reporter and attempt to implement --- src/app.rs | 6 ++++++ src/config.rs | 19 ++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/app.rs b/src/app.rs index 948a2d94..774aa59d 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1227,6 +1227,12 @@ impl TaskwarriorTui { if self.config.uda_selection_reverse { highlight_style = highlight_style.add_modifier(Modifier::REVERSED); } + } else { + // act on unselected items + highlight_style = style.patch(self.config.uda_style_report_unselected); + if self.config.uda_unselected_dim { + highlight_style = highlight_style.add_modifier(Modifier::DIM); + } } rows.push(Row::StyledData(task.iter(), style)); } diff --git a/src/config.rs b/src/config.rs index 709a10e9..0ba13c74 100644 --- a/src/config.rs +++ b/src/config.rs @@ -80,9 +80,11 @@ pub struct Config { pub uda_selection_dim: bool, pub uda_selection_blink: bool, pub uda_selection_reverse: bool, + pub uda_unselected_dim: bool, pub uda_calendar_months_per_row: usize, pub uda_style_context_active: Style, pub uda_style_report_selection: Style, + pub uda_style_report_unselected: Style, pub uda_style_calendar_title: Style, pub uda_style_calendar_today: Style, pub uda_style_navbar: Style, @@ -149,6 +151,7 @@ impl Config { let uda_unselected_dim = Self::get_uda_unselected_dim(data); let uda_calendar_months_per_row = Self::get_uda_months_per_row(data); let uda_style_report_selection = Self::get_uda_style("report.selection", data); + let uda_style_report_unselected = Self::get_uda_style("report.unselected", data); let uda_style_report_scrollbar = Self::get_uda_style("report.scrollbar", data); let uda_style_report_scrollbar_area = Self::get_uda_style("report.scrollbar.area", data); let uda_style_calendar_title = Self::get_uda_style("calendar.title", data); @@ -162,6 +165,7 @@ impl Config { let uda_background_process = Self::get_uda_background_process(data); let uda_background_process_period = Self::get_uda_background_process_period(data); let uda_style_report_selection = uda_style_report_selection.unwrap_or_default(); + let uda_style_report_unselected = uda_style_report_unselected.unwrap_or_default(); let uda_style_report_scrollbar = uda_style_report_scrollbar.unwrap_or_else(|| Style::default().fg(Color::Black)); let uda_style_report_scrollbar_area = uda_style_report_scrollbar_area.unwrap_or_default(); let uda_style_calendar_title = uda_style_calendar_title.unwrap_or_default(); @@ -217,6 +221,7 @@ impl Config { uda_unselected_dim, uda_calendar_months_per_row, uda_style_report_selection, + uda_style_report_unselected, uda_style_context_active, uda_style_calendar_title, uda_style_calendar_today, @@ -693,13 +698,6 @@ impl Config { .unwrap_or(false) } - fn get_uda_unselected_dim(data: &str) -> bool { - Self::get_config("uda.taskwarrior-tui.unselected.dim", data) - .unwrap_or_default() - .get_bool() - .unwrap_or(false) - } - fn get_uda_selection_blink(data: &str) -> bool { Self::get_config("uda.taskwarrior-tui.selection.blink", data) .unwrap_or_default() @@ -721,6 +719,13 @@ impl Config { .unwrap_or(false) } + fn get_uda_unselected_dim(data: &str) -> bool { + Self::get_config("uda.taskwarrior-tui.unselected.dim", data) + .unwrap_or_default() + .get_bool() + .unwrap_or(false) + } + fn get_uda_months_per_row(data: &str) -> usize { Self::get_config("uda.taskwarrior-tui.calendar.months-per-row", data) .unwrap_or_default() From de02ae4357439bf2bcb21e26446f28fd9ee7112d Mon Sep 17 00:00:00 2001 From: tjex Date: Sat, 14 Dec 2024 19:34:56 +0100 Subject: [PATCH 3/8] wip implement unselected dim --- src/app.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app.rs b/src/app.rs index 774aa59d..cd96a0c8 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1227,8 +1227,9 @@ impl TaskwarriorTui { if self.config.uda_selection_reverse { highlight_style = highlight_style.add_modifier(Modifier::REVERSED); } - } else { - // act on unselected items + } + // act on unselected items + if i != selected { highlight_style = style.patch(self.config.uda_style_report_unselected); if self.config.uda_unselected_dim { highlight_style = highlight_style.add_modifier(Modifier::DIM); From 9eb9f75d56bb2d29c3133c887142d74aa6e8d4f0 Mon Sep 17 00:00:00 2001 From: tjex Date: Sat, 14 Dec 2024 19:44:50 +0100 Subject: [PATCH 4/8] correct ordering of functions in config.rs from previous commit --- src/config.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/config.rs b/src/config.rs index 0ba13c74..d7c4b743 100644 --- a/src/config.rs +++ b/src/config.rs @@ -698,22 +698,22 @@ impl Config { .unwrap_or(false) } - fn get_uda_selection_blink(data: &str) -> bool { - Self::get_config("uda.taskwarrior-tui.selection.blink", data) + fn get_uda_selection_dim(data: &str) -> bool { + Self::get_config("uda.taskwarrior-tui.selection.dim", data) .unwrap_or_default() .get_bool() .unwrap_or(false) } - fn get_uda_selection_reverse(data: &str) -> bool { - Self::get_config("uda.taskwarrior-tui.selection.reverse", data) + fn get_uda_selection_blink(data: &str) -> bool { + Self::get_config("uda.taskwarrior-tui.selection.blink", data) .unwrap_or_default() .get_bool() .unwrap_or(false) } - fn get_uda_selection_dim(data: &str) -> bool { - Self::get_config("uda.taskwarrior-tui.selection.dim", data) + fn get_uda_selection_reverse(data: &str) -> bool { + Self::get_config("uda.taskwarrior-tui.selection.reverse", data) .unwrap_or_default() .get_bool() .unwrap_or(false) From 9b613946eb04c6afb8ea6b927fa806a43ff25997 Mon Sep 17 00:00:00 2001 From: tjex Date: Mon, 27 Jan 2025 18:39:28 +0100 Subject: [PATCH 5/8] revert unselected dim attempt by targeting tasks inverse to selector --- src/app.rs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/app.rs b/src/app.rs index cd96a0c8..948a2d94 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1228,13 +1228,6 @@ impl TaskwarriorTui { highlight_style = highlight_style.add_modifier(Modifier::REVERSED); } } - // act on unselected items - if i != selected { - highlight_style = style.patch(self.config.uda_style_report_unselected); - if self.config.uda_unselected_dim { - highlight_style = highlight_style.add_modifier(Modifier::DIM); - } - } rows.push(Row::StyledData(task.iter(), style)); } From cae07bae1680d2457d92df81aed21c402a59ea03 Mon Sep 17 00:00:00 2001 From: tjex Date: Mon, 27 Jan 2025 18:56:50 +0100 Subject: [PATCH 6/8] dim all tasks --- src/app.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/app.rs b/src/app.rs index 948a2d94..d0c33f4b 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1112,6 +1112,10 @@ impl TaskwarriorTui { let virtual_tag_names_in_precedence = &self.config.rule_precedence_color; let mut style = Style::default(); + if self.config.uda_unselected_dim { + style = style.patch(self.config.uda_style_report_unselected); + style = style.add_modifier(Modifier::DIM); + } for tag_name in virtual_tag_names_in_precedence.iter().rev() { if tag_name == "uda." || tag_name == "priority" { From 87955177906b0daf1bc0672840786e8be42aea45 Mon Sep 17 00:00:00 2001 From: tjex Date: Mon, 27 Jan 2025 19:11:38 +0100 Subject: [PATCH 7/8] explicitly color selector white when dim unselected is true. --- src/app.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/app.rs b/src/app.rs index d0c33f4b..c6f45891 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1231,6 +1231,9 @@ impl TaskwarriorTui { if self.config.uda_selection_reverse { highlight_style = highlight_style.add_modifier(Modifier::REVERSED); } + if self.config.uda_unselected_dim { + highlight_style = highlight_style.fg(Color::White); + } } rows.push(Row::StyledData(task.iter(), style)); } From c844c295a7ae34dabc8132e403b989ed40c47c10 Mon Sep 17 00:00:00 2001 From: tjex Date: Mon, 27 Jan 2025 19:19:45 +0100 Subject: [PATCH 8/8] docs: include new unselected.dim user variable --- docs/configuration/advanced.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/configuration/advanced.md b/docs/configuration/advanced.md index 39281939..6e494b1b 100644 --- a/docs/configuration/advanced.md +++ b/docs/configuration/advanced.md @@ -18,6 +18,7 @@ uda.taskwarrior-tui.selection.italic=no uda.taskwarrior-tui.selection.dim=no uda.taskwarrior-tui.selection.blink=no uda.taskwarrior-tui.selection.reverse=no +uda.taskwarrior-tui.unselected.dim=no uda.taskwarrior-tui.mark.indicator=✔ uda.taskwarrior-tui.unmark.indicator= uda.taskwarrior-tui.mark-selection.indicator=⦿