Commit 1045a318c2
Unregistered key
Layout: unified · split
config.example.toml +1
| @@ -10,6 +10,7 @@ default_room = "#iamb-users:0x.badd.cafe" | ||
| 10 | 10 | default_split = "vertical" |
| 11 | 11 | external_edit_file_suffix = ".md" |
| 12 | 12 | log_level = "warn" |
| 13 | members_split = "vertical" | |
| 13 | 14 | message_shortcode_display = false |
| 14 | 15 | open_command = ["my-open", "--file"] |
| 15 | 16 | reaction_display = true |
docs/iamb.5 +9
| @@ -205,6 +205,15 @@ for more details. | ||
| 205 | 205 | .It Sy message_shortcode_display |
| 206 | 206 | Defines whether or not Emoji characters in messages should be replaced by their |
| 207 | 207 | respective shortcodes. |
| 208 | .It Sy members_split | |
| 209 | When set, this forces the | |
| 210 | .Sy :members | |
| 211 | command to open in a new window split instead of in the same window. | |
| 212 | Possible values are | |
| 213 | .Dq Sy vertical | |
| 214 | or | |
| 215 | .Dq Sy horizontal , | |
| 216 | to control what kind of split is done. | |
| 208 | 217 | .It Sy message_user_color |
| 209 | 218 | Defines whether or not the message body is colored like the username. |
| 210 | 219 | .It Sy normal_after_send |
src/config.rs +17 −1
| @@ -22,7 +22,10 @@ use ratatui_image::picker::ProtocolType; | ||
| 22 | 22 | use serde::{Deserialize, Deserializer, Serialize, de::Error as SerdeError, de::Visitor}; |
| 23 | 23 | use url::Url; |
| 24 | 24 | |
| 25 | use modalkit::{env::vim::VimMode, key::TerminalKey, keybindings::InputKey}; | |
| 25 | use modalkit::env::vim::VimMode; | |
| 26 | use modalkit::key::TerminalKey; | |
| 27 | use modalkit::keybindings::InputKey; | |
| 28 | use modalkit::prelude::Axis; | |
| 26 | 29 | |
| 27 | 30 | use super::base::{ |
| 28 | 31 | IambError, |
| @@ -463,6 +466,15 @@ pub enum SplitDirection { | ||
| 463 | 466 | Vertical, |
| 464 | 467 | } |
| 465 | 468 | |
| 469 | impl SplitDirection { | |
| 470 | pub fn to_axis(self) -> Axis { | |
| 471 | match self { | |
| 472 | Self::Horizontal => Axis::Horizontal, | |
| 473 | Self::Vertical => Axis::Vertical, | |
| 474 | } | |
| 475 | } | |
| 476 | } | |
| 477 | ||
| 466 | 478 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
| 467 | 479 | pub struct NotifyVia { |
| 468 | 480 | /// Deliver notifications via terminal bell. |
| @@ -818,6 +830,7 @@ pub struct TunableValues { | ||
| 818 | 830 | pub user_gutter_width: usize, |
| 819 | 831 | pub external_edit_file_suffix: String, |
| 820 | 832 | pub tabstop: usize, |
| 833 | pub members_split: Option<SplitDirection>, | |
| 821 | 834 | pub default_split: SplitDirection, |
| 822 | 835 | pub ssl_verify: bool, |
| 823 | 836 | } |
| @@ -865,6 +878,7 @@ pub struct Tunables { | ||
| 865 | 878 | pub user_gutter_width: Option<usize>, |
| 866 | 879 | pub external_edit_file_suffix: Option<String>, |
| 867 | 880 | pub tabstop: Option<usize>, |
| 881 | pub members_split: Option<SplitDirection>, | |
| 868 | 882 | pub default_split: Option<SplitDirection>, |
| 869 | 883 | pub ssl_verify: Option<bool>, |
| 870 | 884 | } |
| @@ -911,6 +925,7 @@ impl Tunables { | ||
| 911 | 925 | .external_edit_file_suffix |
| 912 | 926 | .or(other.external_edit_file_suffix), |
| 913 | 927 | tabstop: self.tabstop.or(other.tabstop), |
| 928 | members_split: self.members_split.or(other.members_split), | |
| 914 | 929 | default_split: self.default_split.or(other.default_split), |
| 915 | 930 | ssl_verify: self.ssl_verify.or(other.ssl_verify), |
| 916 | 931 | } |
| @@ -949,6 +964,7 @@ impl Tunables { | ||
| 949 | 964 | .external_edit_file_suffix |
| 950 | 965 | .unwrap_or_else(|| ".md".to_string()), |
| 951 | 966 | tabstop: self.tabstop.unwrap_or(4), |
| 967 | members_split: self.members_split, | |
| 952 | 968 | default_split: self.default_split.unwrap_or_default(), |
| 953 | 969 | ssl_verify: self.ssl_verify.unwrap_or(true), |
| 954 | 970 | } |
src/tests.rs +1
| @@ -204,6 +204,7 @@ pub fn mock_tunables() -> TunableValues { | ||
| 204 | 204 | image_preview: None, |
| 205 | 205 | user_gutter_width: 30, |
| 206 | 206 | tabstop: 4, |
| 207 | members_split: Default::default(), | |
| 207 | 208 | default_split: Default::default(), |
| 208 | 209 | ssl_verify: true, |
| 209 | 210 | } |
src/windows/room/mod.rs +8 −5
| @@ -200,11 +200,14 @@ pub async fn room_command( | ||
| 200 | 200 | Ok(vec![]) |
| 201 | 201 | }, |
| 202 | 202 | RoomAction::Members(mut cmd) => { |
| 203 | let width = Count::Exact(30); | |
| 204 | let act = cmd | |
| 205 | .default_axis(Axis::Vertical) | |
| 206 | .default_relation(MoveDir1D::Next) | |
| 207 | .window(OpenTarget::Application(IambId::MemberList(id.to_owned())), width.into()); | |
| 203 | let id = IambId::MemberList(id.to_owned()); | |
| 204 | let target = OpenTarget::Application(id); | |
| 205 | let cmd = cmd.default_relation(MoveDir1D::Next); | |
| 206 | ||
| 207 | let act = match store.application.settings.tunables.members_split { | |
| 208 | Some(dir) => cmd.default_axis(dir.to_axis()).window(target, None), | |
| 209 | None => cmd.switch(target), | |
| 210 | }; | |
| 208 | 211 | |
| 209 | 212 | Ok(vec![(act, cmd.context.clone())]) |
| 210 | 213 | }, |