Skip to content

Commit

Permalink
Merge pull request #602 from squidowl/feat/toggle-topic
Browse files Browse the repository at this point in the history
Toggle topic
  • Loading branch information
casperstorm authored Oct 1, 2024
2 parents 020f316 + 3dab7ae commit 5629a05
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 8 deletions.
12 changes: 5 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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 (<kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <kbd>t</kbd> (macOS: <kbd>⌘</kbd> + <kbd>⌥</kbd> + <kbd>t</kbd>))
- 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)

Expand Down
2 changes: 1 addition & 1 deletion book/src/configuration/keyboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ move_left = "alt+h"
move_right = "alt+l"
```


| Key | Description | Default MacOS | Default Other |
| ----------------------- | ---------------------------- | --------------------------------------------------- | --------------------------------------------------- |
| `move_up` | Moves focus up | <kbd>⌥</kbd> + <kbd>↑</kbd> | <kbd>alt</kbd> + <kbd>↑</kbd> |
Expand All @@ -26,6 +25,7 @@ move_right = "alt+l"
| `cycle_previous_buffer` | Cycle to previous buffer | <kbd>ctrl</kbd> + <kbd>shift</kbd> + <kbd>tab</kbd> | <kbd>ctrl</kbd> + <kbd>shift</kbd> + <kbd>tab</kbd> |
| `leave_buffer` | Leave channel or close query | <kbd>⌘</kbd> + <kbd>shift</kbd> + <kbd>w</kbd> | <kbd>ctrl</kbd> + <kbd>shift</kbd> + <kbd>w</kbd> |
| `toggle_nick_list` | Toggle nick list | <kbd>⌘</kbd> + <kbd>⌥</kbd> + <kbd>m</kbd> | <kbd>ctrl</kbd> + <kbd>alt</kbd> + <kbd>m</kbd> |
| `toggle_topic` | Toggle topic | <kbd>⌘</kbd> + <kbd>⌥</kbd> + <kbd>t</kbd> | <kbd>ctrl</kbd> + <kbd>alt</kbd> + <kbd>t</kbd> |
| `toggle_sidebar` | Toggle sidebar | <kbd>⌘</kbd> + <kbd>⌥</kbd> + <kbd>b</kbd> | <kbd>ctrl</kbd> + <kbd>alt</kbd> + <kbd>b</kbd> |
| `command_bar` | Toggle command bar | <kbd>⌘</kbd> + <kbd>k</kbd> | <kbd>ctrl</kbd> + <kbd>k</kbd> |
| `reload_configuration` | Refresh configuration file | <kbd>⌘</kbd> + <kbd>r</kbd> | <kbd>ctrl</kbd> + <kbd>r</kbd> |
4 changes: 4 additions & 0 deletions data/src/config/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand All @@ -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(),
}
Expand All @@ -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),
Expand Down
2 changes: 2 additions & 0 deletions data/src/shortcut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pub enum Command {
CyclePreviousBuffer,
LeaveBuffer,
ToggleNicklist,
ToggleTopic,
ToggleSidebar,
CommandBar,
ReloadConfiguration,
Expand Down Expand Up @@ -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);

Expand Down
7 changes: 7 additions & 0 deletions src/screen/dashboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 5629a05

Please sign in to comment.