diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e879bdba..1843e8d2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,9 @@ Added: - Ability to open `irc://` and `ircs://` URL schemes - Ability to overwrite nickname colors by providing a hex string (see [buffer configuration](https://halloy.squidowl.org/configuration/buffer.html#buffernicknamecolor-section)). - Ability to overwrite server & internal message colors by providing a hex string (see [buffer configuration](https://halloy.squidowl.org/configuration/buffer.html#bufferserver_messages-section)). -- Configurable shortcuts for "Leave Buffer" and "Toggle Sidebar" actions (see [keyboard shortcuts configuration](https://github.com/squidowl/halloy/wiki/Keyboard-shortcuts)). +- Configurable shortcuts for "Leave Buffer" and "Toggle Sidebar" actions (see [keyboard shortcuts configuration](https://halloy.squidowl.org/configuration/keyboard.html)). - Ability to remember window position and size when reopened. +- Ability to hide unread indicators in sidebar (see [sidemenu configuration](https://halloy.squidowl.org/configuration/sidebar.html)) Fixed: diff --git a/book/src/configuration/sidebar.md b/book/src/configuration/sidebar.md index 56633761f..75e748bfa 100644 --- a/book/src/configuration/sidebar.md +++ b/book/src/configuration/sidebar.md @@ -6,12 +6,14 @@ [sidebar] default_action = "new-pane" | "replace-pane" width = +show_unread_indicators = true | false ``` -| Key | Description | Default | -| ---------------- | -------------------------------------------------------------------------------------- | ------------ | -| `default_action` | Action when selecting buffers in the sidebar. Can be `"new-pane"` or `"replace-pane"`. | `"new-pane"` | -| `width` | Specify sidebar width in pixels. | `120` | +| Key | Description | Default | +| ------------------------ | -------------------------------------------------------------------------------------- | ------------ | +| `default_action` | Action when selecting buffers in the sidebar. Can be `"new-pane"` or `"replace-pane"`. | `"new-pane"` | +| `width` | Specify sidebar width in pixels. | `120` | +| `show_unread_indicators` | Unread buffer indicators | `true` | ## `[sidebar.buttons]` Section diff --git a/data/src/config/sidebar.rs b/data/src/config/sidebar.rs index 0e698a518..b52873359 100644 --- a/data/src/config/sidebar.rs +++ b/data/src/config/sidebar.rs @@ -10,6 +10,8 @@ pub struct Sidebar { pub width: u16, #[serde(default)] pub buttons: Buttons, + #[serde(default = "default_bool_true")] + pub show_unread_indicators: bool, } impl Default for Sidebar { @@ -18,23 +20,24 @@ impl Default for Sidebar { default_action: Default::default(), width: default_sidebar_width(), buttons: Default::default(), + show_unread_indicators: default_bool_true(), } } } #[derive(Debug, Copy, Clone, Deserialize)] pub struct Buttons { - #[serde(default = "default_file_transfer")] + #[serde(default = "default_bool_true")] pub file_transfer: bool, - #[serde(default = "default_command_bar")] + #[serde(default = "default_bool_true")] pub command_bar: bool, } impl Default for Buttons { fn default() -> Self { Buttons { - file_transfer: default_file_transfer(), - command_bar: default_command_bar(), + file_transfer: default_bool_true(), + command_bar: default_bool_true(), } } } @@ -43,10 +46,6 @@ fn default_sidebar_width() -> u16 { 120 } -fn default_file_transfer() -> bool { - true -} - -fn default_command_bar() -> bool { +fn default_bool_true() -> bool { true } diff --git a/src/screen/dashboard/sidebar.rs b/src/screen/dashboard/sidebar.rs index 35451a991..10cc4bcdf 100644 --- a/src/screen/dashboard/sidebar.rs +++ b/src/screen/dashboard/sidebar.rs @@ -102,7 +102,15 @@ impl Sidebar { focus, Buffer::Channel(server.clone(), channel.clone()), true, - history.has_unread(server, &history::Kind::Channel(channel.clone())), + config + .show_unread_indicators + .then(|| { + history.has_unread( + server, + &history::Kind::Channel(channel.clone()), + ) + }) + .unwrap_or(false), config.default_action, )); } @@ -114,7 +122,12 @@ impl Sidebar { focus, Buffer::Query(server.clone(), user.clone()), true, - history.has_unread(server, &history::Kind::Query(user.clone())), + config + .show_unread_indicators + .then(|| { + history.has_unread(server, &history::Kind::Query(user.clone())) + }) + .unwrap_or(false), config.default_action, )); }