terminal emulator
git clone https://git.lucas.co/cce-terminal.git
Desktop entry + foot-style positional command
cce-terminal.desktop (Categories=System;TerminalEmulator;) makes the
app visible to the launcher's Apps grid and the settings Default Apps
Terminal row, per the in-crate entry convention. Icon=cce-terminal per
convention — the cce-icons artwork does not exist yet.
Bare trailing args now run as the command (foot-style), alongside the
existing xterm-style -e: the launcher hosts Terminal=true entries
positionally (`term sh -c …`), so being pickable as the default
terminal requires accepting that convention.
Co-Authored-By: Claude Fable 5 <[email protected]>
cce-terminal.desktop | 10 ++++++++++
src/main.rs | 17 ++++++++++-------
2 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/cce-terminal.desktop b/cce-terminal.desktop
new file mode 100644
index 0000000..c8793de
--- /dev/null
+++ b/cce-terminal.desktop
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Type=Application
+Name=Terminal
+Comment=Terminal emulator
+Exec=cce-terminal
+Icon=cce-terminal
+Categories=System;TerminalEmulator;
+Terminal=false
+StartupNotify=false
+StartupWMClass=cce-terminal
diff --git a/src/main.rs b/src/main.rs
index 22a51c9..7ae1bad 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -461,13 +461,16 @@ impl Application for TerminalApp {
let config_stamp = cce_ui::config::config_files_modified();
let (cols, rows) = grid_dims(INIT_W as f32, INIT_H as f32, pad, &settings);
- // `cce-terminal -e <cmd> [args…]` runs a command instead of $SHELL.
- let args: Vec<String> = std::env::args().collect();
- let command: Option<Vec<String>> = args
- .iter()
- .position(|a| a == "-e")
- .map(|i| args[i + 1..].to_vec())
- .filter(|c| !c.is_empty());
+ // A command instead of $SHELL: `cce-terminal -e <cmd> [args…]`
+ // (xterm-style), or bare trailing args (foot-style) — the launcher
+ // hosts `Terminal=true` entries positionally (`term sh -c …`), so
+ // both conventions must work.
+ let argv: Vec<String> = std::env::args().skip(1).collect();
+ let command: Option<Vec<String>> = match argv.first().map(String::as_str) {
+ Some("-e") => Some(argv[1..].to_vec()).filter(|c| !c.is_empty()),
+ Some(_) => Some(argv.clone()),
+ None => None,
+ };
let pty = pty::spawn_shell(cols, rows, command.as_deref())
.expect("cce-terminal: failed to spawn shell on pty");