Commit 02a7fa695b

02a7fa695b014dd8d0a12cb8df9d607f1205baf6

parent: 71c1efcd37

Unregistered key

vaw <git@nlih.de> · 2026-07-26 16:25 UTC
committer: <noreply@github.com>

Add config option `set_window_title` (#528)

Co-authored-by: Ulyssa <git@ulyssa.dev>

Layout: unified · split

config.example.toml +4
@@ -33,6 +33,10 @@ size = { "width" = 66, "height" = 10 }
33rooms = ["favorite", "lowpriority", "unread", "name"] 33rooms = ["favorite", "lowpriority", "unread", "name"]
34members = ["power", "id"] 34members = ["power", "id"]
35 35
36[settings.terminal]
37enable_extended_keys = false
38enable_title = true
39
36[settings.users] 40[settings.users]
37"@user:matrix.org" = { "name" = "John Doe", "color" = "magenta" } 41"@user:matrix.org" = { "name" = "John Doe", "color" = "magenta" }
38 42
docs/iamb.5 +6 −3
@@ -131,12 +131,12 @@ Configuration subsection for specific settings related to room encryption.
131See 131See
132.Sx ENCRYPTION 132.Sx ENCRYPTION
133for more details. 133for more details.
134.It Sy external_edit_file_suffix
135Suffix to append to temporary file names when using the :editor command. Defaults to .md.
136.It Sy default_room 134.It Sy default_room
137The room to show by default instead of the 135The room to show by default instead of the
138.Sy :welcome 136.Sy :welcome
139window. 137window.
138.It Sy external_edit_file_suffix
139Suffix to append to temporary file names when using the :editor command. Defaults to .md.
140.It Sy image_preview 140.It Sy image_preview
141Enable image previews and configure it. 141Enable image previews and configure it.
142An empty object will enable the feature with default settings, omitting it will disable the feature. 142An empty object will enable the feature with default settings, omitting it will disable the feature.
@@ -251,7 +251,6 @@ Defaults to 30.
251.It Sy tabstop 251.It Sy tabstop
252Number of spaces that a <Tab> counts for. 252Number of spaces that a <Tab> counts for.
253Defaults to 4. 253Defaults to 4.
254
255.It Sy ssl_verify 254.It Sy ssl_verify
256Enable SSL verification for the HTTP requests. 255Enable SSL verification for the HTTP requests.
257Defaults to true. 256Defaults to true.
@@ -444,6 +443,10 @@ Defines whether to explicitly enable or disable requesting extended keypresses f
444By default, when unset, 443By default, when unset,
445.Sy iamb 444.Sy iamb
446will attempt to auto-detect support in your terminal and request extended keypresses from the terminal if supported. 445will attempt to auto-detect support in your terminal and request extended keypresses from the terminal if supported.
446.It Sy enable_title
447Whether to set the title of the terminal window to
448.Dq Sy iamb (<user_id>) .
449Defaults to true.
447.El 450.El
448.It Sy indicator 451.It Sy indicator
449.Sh "USER OVERRIDES" 452.Sh "USER OVERRIDES"
src/config.rs +8 −1
@@ -54,6 +54,7 @@ const DEFAULT_ROOM_SORT: [SortColumn<SortFieldRoom>; 5] = [
54 SortColumn(SortFieldRoom::Name, SortOrder::Ascending), 54 SortColumn(SortFieldRoom::Name, SortOrder::Ascending),
55]; 55];
56 56
57const DEFAULT_ENABLE_TITLE: bool = true;
57const DEFAULT_ENC_INDICATOR_LOC: EncryptionIndicatorLocation = EncryptionIndicatorLocation::PROMPT; 58const DEFAULT_ENC_INDICATOR_LOC: EncryptionIndicatorLocation = EncryptionIndicatorLocation::PROMPT;
58const DEFAULT_REQ_TIMEOUT: u64 = 120; 59const DEFAULT_REQ_TIMEOUT: u64 = 120;
59 60
@@ -655,23 +656,29 @@ impl SortOverrides {
655#[derive(Clone, Debug, Default, Deserialize)] 656#[derive(Clone, Debug, Default, Deserialize)]
656pub struct Terminal { 657pub struct Terminal {
657 pub enable_extended_keys: Option<bool>, 658 pub enable_extended_keys: Option<bool>,
659 pub enable_title: Option<bool>,
658} 660}
659 661
660impl Terminal { 662impl Terminal {
661 fn merge(profile: Self, global: Self) -> Self { 663 fn merge(profile: Self, global: Self) -> Self {
662 Self { 664 Self {
663 enable_extended_keys: profile.enable_extended_keys.or(global.enable_extended_keys), 665 enable_extended_keys: profile.enable_extended_keys.or(global.enable_extended_keys),
666 enable_title: profile.enable_title.or(global.enable_title),
664 } 667 }
665 } 668 }
666 669
667 pub fn values(self) -> TerminalValues { 670 pub fn values(self) -> TerminalValues {
668 TerminalValues { enable_extended_keys: self.enable_extended_keys } 671 TerminalValues {
672 enable_extended_keys: self.enable_extended_keys,
673 enable_title: self.enable_title.unwrap_or(DEFAULT_ENABLE_TITLE),
674 }
669 } 675 }
670} 676}
671 677
672#[derive(Clone, Debug)] 678#[derive(Clone, Debug)]
673pub struct TerminalValues { 679pub struct TerminalValues {
674 pub enable_extended_keys: Option<bool>, 680 pub enable_extended_keys: Option<bool>,
681 pub enable_title: bool,
675} 682}
676 683
677#[derive(Clone)] 684#[derive(Clone)]
src/main.rs +6 −3
@@ -985,8 +985,6 @@ async fn login_normal(
985 985
986/// Set up the terminal for drawing the TUI, and getting additional info. 986/// Set up the terminal for drawing the TUI, and getting additional info.
987fn setup_tty(settings: &ApplicationSettings, enable_enhanced_keys: bool) -> std::io::Result<()> { 987fn setup_tty(settings: &ApplicationSettings, enable_enhanced_keys: bool) -> std::io::Result<()> {
988 let title = format!("iamb ({})", settings.profile.user_id.as_str());
989
990 // Enable raw mode and enter the alternate screen. 988 // Enable raw mode and enter the alternate screen.
991 crossterm::terminal::enable_raw_mode()?; 989 crossterm::terminal::enable_raw_mode()?;
992 crossterm::execute!(stdout(), EnterAlternateScreen)?; 990 crossterm::execute!(stdout(), EnterAlternateScreen)?;
@@ -1003,7 +1001,12 @@ fn setup_tty(settings: &ApplicationSettings, enable_enhanced_keys: bool) -> std:
1003 crossterm::execute!(stdout(), EnableMouseCapture)?; 1001 crossterm::execute!(stdout(), EnableMouseCapture)?;
1004 } 1002 }
1005 1003
1006 crossterm::execute!(stdout(), EnableBracketedPaste, EnableFocusChange, SetTitle(title)) 1004 if settings.tunables.terminal.enable_title {
1005 let title = format!("iamb ({})", settings.profile.user_id.as_str());
1006 crossterm::execute!(stdout(), SetTitle(title))?;
1007 }
1008
1009 crossterm::execute!(stdout(), EnableBracketedPaste, EnableFocusChange)
1007} 1010}
1008 1011
1009// Do our best to reverse what we did in setup_tty() when we exit or crash. 1012// Do our best to reverse what we did in setup_tty() when we exit or crash.