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 }
3333rooms = ["favorite", "lowpriority", "unread", "name"]
3434members = ["power", "id"]
3535
36[settings.terminal]
37enable_extended_keys = false
38enable_title = true
39
3640[settings.users]
3741"@user:matrix.org" = { "name" = "John Doe", "color" = "magenta" }
3842
docs/iamb.5 +6 −3
@@ -131,12 +131,12 @@ Configuration subsection for specific settings related to room encryption.
131131See
132132.Sx ENCRYPTION
133133for more details.
134.It Sy external_edit_file_suffix
135Suffix to append to temporary file names when using the :editor command. Defaults to .md.
136134.It Sy default_room
137135The room to show by default instead of the
138136.Sy :welcome
139137window.
138.It Sy external_edit_file_suffix
139Suffix to append to temporary file names when using the :editor command. Defaults to .md.
140140.It Sy image_preview
141141Enable image previews and configure it.
142142An empty object will enable the feature with default settings, omitting it will disable the feature.
@@ -251,7 +251,6 @@ Defaults to 30.
251251.It Sy tabstop
252252Number of spaces that a <Tab> counts for.
253253Defaults to 4.
254
255254.It Sy ssl_verify
256255Enable SSL verification for the HTTP requests.
257256Defaults to true.
@@ -444,6 +443,10 @@ Defines whether to explicitly enable or disable requesting extended keypresses f
444443By default, when unset,
445444.Sy iamb
446445will 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.
447450.El
448451.It Sy indicator
449452.Sh "USER OVERRIDES"
src/config.rs +8 −1
@@ -54,6 +54,7 @@ const DEFAULT_ROOM_SORT: [SortColumn<SortFieldRoom>; 5] = [
5454 SortColumn(SortFieldRoom::Name, SortOrder::Ascending),
5555];
5656
57const DEFAULT_ENABLE_TITLE: bool = true;
5758const DEFAULT_ENC_INDICATOR_LOC: EncryptionIndicatorLocation = EncryptionIndicatorLocation::PROMPT;
5859const DEFAULT_REQ_TIMEOUT: u64 = 120;
5960
@@ -655,23 +656,29 @@ impl SortOverrides {
655656#[derive(Clone, Debug, Default, Deserialize)]
656657pub struct Terminal {
657658 pub enable_extended_keys: Option<bool>,
659 pub enable_title: Option<bool>,
658660}
659661
660662impl Terminal {
661663 fn merge(profile: Self, global: Self) -> Self {
662664 Self {
663665 enable_extended_keys: profile.enable_extended_keys.or(global.enable_extended_keys),
666 enable_title: profile.enable_title.or(global.enable_title),
664667 }
665668 }
666669
667670 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 }
669675 }
670676}
671677
672678#[derive(Clone, Debug)]
673679pub struct TerminalValues {
674680 pub enable_extended_keys: Option<bool>,
681 pub enable_title: bool,
675682}
676683
677684#[derive(Clone)]
src/main.rs +6 −3
@@ -985,8 +985,6 @@ async fn login_normal(
985985
986986/// Set up the terminal for drawing the TUI, and getting additional info.
987987fn setup_tty(settings: &ApplicationSettings, enable_enhanced_keys: bool) -> std::io::Result<()> {
988 let title = format!("iamb ({})", settings.profile.user_id.as_str());
989
990988 // Enable raw mode and enter the alternate screen.
991989 crossterm::terminal::enable_raw_mode()?;
992990 crossterm::execute!(stdout(), EnterAlternateScreen)?;
@@ -1003,7 +1001,12 @@ fn setup_tty(settings: &ApplicationSettings, enable_enhanced_keys: bool) -> std:
10031001 crossterm::execute!(stdout(), EnableMouseCapture)?;
10041002 }
10051003
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)
10071010}
10081011
10091012// Do our best to reverse what we did in setup_tty() when we exit or crash.