Repository: raphamorim/rio (language: rust)

Issue:
Feature Request: Allow Setting Window Class and/or Title
It would be nice to be able to declare the window class/title (i.e Alacritty's `--class`/`--title`) as it allows window managers to handle a specific window when multiple are open.


Discussion / hints:
Hey @Airradda thanks for the issue,

Is that feature available for linux only?
I believe so. I don't know if Windows has a similar or slightly different concept.

Fix patch:
diff --git a/docs/docs/command-line-interface.md b/docs/docs/command-line-interface.md
index a659d8afc5..86c3d2aa40 100644
--- a/docs/docs/command-line-interface.md
+++ b/docs/docs/command-line-interface.md
@@ -16,6 +16,7 @@ Options:
   -w, --working-dir <WORKING_DIR>  Start the shell in the specified working directory
       --write-config [<PATH>]      Writes the config to a given path or the default location
       --log-file                   Writes the logs to a file inside the config directory
+      --title <TITLE>              Start window with specified title
   -h, --help                       Print help
   -V, --version                    Print version
 ```
diff --git a/frontends/rioterm/src/cli.rs b/frontends/rioterm/src/cli.rs
index 35962a4faa..4ca44cd7b3 100644
--- a/frontends/rioterm/src/cli.rs
+++ b/frontends/rioterm/src/cli.rs
@@ -38,6 +38,10 @@ pub struct TerminalOptions {
     /// Writes the logs to a file inside the config directory.
     #[clap(long)]
     pub enable_log_file: bool,
+
+    /// Start window with specified title
+    #[clap(long)]
+    pub title: Option<String>,
 }
 
 impl TerminalOptions {
diff --git a/frontends/rioterm/src/main.rs b/frontends/rioterm/src/main.rs
index 3409347021..465401d697 100644
--- a/frontends/rioterm/src/main.rs
+++ b/frontends/rioterm/src/main.rs
@@ -181,6 +181,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
         if let Some(working_dir_cli) = args.window_options.terminal_options.working_dir {
             config.working_dir = Some(working_dir_cli);
         }
+
+        config.window.initial_title = args.window_options.terminal_options.title;
     }
 
     #[cfg(target_os = "linux")]
diff --git a/frontends/rioterm/src/router/window.rs b/frontends/rioterm/src/router/window.rs
index 6b5a1689cc..3e58fa7908 100644
--- a/frontends/rioterm/src/router/window.rs
+++ b/frontends/rioterm/src/router/window.rs
@@ -168,5 +168,9 @@ pub fn configure_window(winit_window: &Window, config: &Config) {
         winit_window.set_has_shadow(!is_transparent);
     }
 
+    if let Some(title) = &config.window.initial_title {
+        winit_window.set_title(title);
+    }
+
     winit_window.set_blur(config.window.blur);
 }
diff --git a/rio-backend/src/config/window.rs b/rio-backend/src/config/window.rs
index 9f12c33d38..e67844f038 100644
--- a/rio-backend/src/config/window.rs
+++ b/rio-backend/src/config/window.rs
@@ -57,6 +57,8 @@ pub struct Window {
     pub decorations: Decorations,
     #[serde(default = "bool::default", rename = "macos-use-unified-titlebar")]
     pub macos_use_unified_titlebar: bool,
+    #[serde(rename = "initial-title", skip_serializing)]
+    pub initial_title: Option<String>,
 }
 
 impl Default for Window {
@@ -70,6 +72,7 @@ impl Default for Window {
             decorations: Decorations::default(),
             blur: false,
             macos_use_unified_titlebar: false,
+            initial_title: None,
         }
     }
 }


Test patch: