summaryrefslogtreecommitdiffstats
path: root/zellij-utils/src
diff options
context:
space:
mode:
authorKerfuffle <44031344+KerfuffleV2@users.noreply.github.com>2022-02-28 09:54:41 -0700
committerGitHub <noreply@github.com>2022-02-28 17:54:41 +0100
commite2081f26494df7921208060199ab4122ee8695d2 (patch)
treed4b0978b6cf72358365fdfe4fd740628bbc7b393 /zellij-utils/src
parentc2e06a1a70d8f1a383ada70c74165d4579fcf88e (diff)
fix: Allow terminal title passthrough even when not drawing pane frames. (#1113)
* fix: Allow terminal title passthrough even when not drawing pane frames. * Minor formatting fix. * Handle case where the session name is not set.
Diffstat (limited to 'zellij-utils/src')
-rw-r--r--zellij-utils/src/shared.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/zellij-utils/src/shared.rs b/zellij-utils/src/shared.rs
index 79695435f..ffb164f60 100644
--- a/zellij-utils/src/shared.rs
+++ b/zellij-utils/src/shared.rs
@@ -2,6 +2,7 @@
use std::{iter, str::from_utf8};
+use crate::envs::get_session_name;
use colorsys::Rgb;
use std::os::unix::fs::PermissionsExt;
use std::path::Path;
@@ -40,6 +41,16 @@ pub fn adjust_to_size(s: &str, rows: usize, columns: usize) -> String {
.join("\n\r")
}
+pub fn make_terminal_title(pane_title: &str) -> String {
+ format!(
+ "\u{1b}]0;Zellij {}- {}\u{07}",
+ get_session_name()
+ .map(|n| format!("({}) ", n))
+ .unwrap_or_default(),
+ pane_title,
+ )
+}
+
// Colors
pub mod colors {
pub const WHITE: u8 = 255;