From 3dab7ae1ba80e7825b64dd240dad5610580c41db Mon Sep 17 00:00:00 2001 From: Casper Rogild Storm Date: Tue, 1 Oct 2024 15:20:25 +0200 Subject: [PATCH] Toggle topic --- CHANGELOG.md | 12 +++++------- book/src/configuration/keyboard.md | 2 +- data/src/config/keys.rs | 4 ++++ data/src/shortcut.rs | 2 ++ src/screen/dashboard.rs | 7 +++++++ 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4409a4173..3512b08db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,20 +1,18 @@ # Unreleased -- New configuration options - - Ability to define a shell command for loading a NICKSERV password. See [configuration](https://halloy.squidowl.org/configuration/servers/index.html#nick_password_command) - - Ability to define a shell command for loading a SASL password. See [configuration](https://halloy.squidowl.org/configuration/servers/sasl/plain.html) - -Fixed: - -- Errors from password commands are now caught and displayed to the user. Added: - Dynamically select dark or light theme based on OS appearance. See [configuartion](https://halloy.squidowl.org/configuration/themes/index.html). +- Toggle channel topic with hotkey (Ctrl + Alt + t (macOS: + + t)) +- New configuration options + - Ability to define a shell command for loading a NICKSERV password. See [configuration](https://halloy.squidowl.org/configuration/servers/index.html#nick_password_command) + - Ability to define a shell command for loading a SASL password. See [configuration](https://halloy.squidowl.org/configuration/servers/sasl/plain.html) Fixed: - Inverted scrolling direction. - Only highlight if user nick isn't part of another word. +- Errors from password commands are now caught and displayed to the user. # 2024.12 (2024-09-17) diff --git a/book/src/configuration/keyboard.md b/book/src/configuration/keyboard.md index 1bab4521e..1c3d3094b 100644 --- a/book/src/configuration/keyboard.md +++ b/book/src/configuration/keyboard.md @@ -12,7 +12,6 @@ move_left = "alt+h" move_right = "alt+l" ``` - | Key | Description | Default MacOS | Default Other | | ----------------------- | ---------------------------- | --------------------------------------------------- | --------------------------------------------------- | | `move_up` | Moves focus up | + | alt + | @@ -26,6 +25,7 @@ move_right = "alt+l" | `cycle_previous_buffer` | Cycle to previous buffer | ctrl + shift + tab | ctrl + shift + tab | | `leave_buffer` | Leave channel or close query | + shift + w | ctrl + shift + w | | `toggle_nick_list` | Toggle nick list | + + m | ctrl + alt + m | +| `toggle_topic` | Toggle topic | + + t | ctrl + alt + t | | `toggle_sidebar` | Toggle sidebar | + + b | ctrl + alt + b | | `command_bar` | Toggle command bar | + k | ctrl + k | | `reload_configuration` | Refresh configuration file | + r | ctrl + r | diff --git a/data/src/config/keys.rs b/data/src/config/keys.rs index 5c549ccb5..c2da16011 100644 --- a/data/src/config/keys.rs +++ b/data/src/config/keys.rs @@ -26,6 +26,8 @@ pub struct Keyboard { pub leave_buffer: KeyBind, #[serde(default = "KeyBind::toggle_nick_list")] pub toggle_nick_list: KeyBind, + #[serde(default = "KeyBind::toggle_topic")] + pub toggle_topic: KeyBind, #[serde(default = "KeyBind::toggle_sidebar")] pub toggle_sidebar: KeyBind, #[serde(default = "KeyBind::command_bar")] @@ -49,6 +51,7 @@ impl Default for Keyboard { leave_buffer: KeyBind::leave_buffer(), toggle_nick_list: KeyBind::toggle_nick_list(), toggle_sidebar: KeyBind::toggle_sidebar(), + toggle_topic: KeyBind::toggle_topic(), command_bar: KeyBind::command_bar(), reload_configuration: KeyBind::reload_configuration(), } @@ -71,6 +74,7 @@ impl Keyboard { shortcut(self.cycle_previous_buffer.clone(), CyclePreviousBuffer), shortcut(self.leave_buffer.clone(), LeaveBuffer), shortcut(self.toggle_nick_list.clone(), ToggleNicklist), + shortcut(self.toggle_topic.clone(), ToggleTopic), shortcut(self.toggle_sidebar.clone(), ToggleSidebar), shortcut(self.command_bar.clone(), CommandBar), shortcut(self.reload_configuration.clone(), ReloadConfiguration), diff --git a/data/src/shortcut.rs b/data/src/shortcut.rs index b7ed96b26..fe4df4830 100644 --- a/data/src/shortcut.rs +++ b/data/src/shortcut.rs @@ -34,6 +34,7 @@ pub enum Command { CyclePreviousBuffer, LeaveBuffer, ToggleNicklist, + ToggleTopic, ToggleSidebar, CommandBar, ReloadConfiguration, @@ -114,6 +115,7 @@ impl KeyBind { default!(leave_buffer, "w", COMMAND | SHIFT); default!(toggle_nick_list, "m", COMMAND | ALT); default!(toggle_sidebar, "b", COMMAND | ALT); + default!(toggle_topic, "t", COMMAND | ALT); default!(command_bar, "k", COMMAND); default!(reload_configuration, "r", COMMAND); diff --git a/src/screen/dashboard.rs b/src/screen/dashboard.rs index c80c4fb21..d2cb0a352 100644 --- a/src/screen/dashboard.rs +++ b/src/screen/dashboard.rs @@ -752,6 +752,13 @@ impl Dashboard { }); } } + ToggleTopic => { + if let Some((_, _, pane)) = self.get_focused_mut(main_window) { + pane.update_settings(|settings| { + settings.channel.topic.enabled = !settings.channel.topic.enabled + }); + } + } ToggleSidebar => { self.side_menu.toggle_visibility(); }