summaryrefslogtreecommitdiffstats
path: root/src/verb
diff options
context:
space:
mode:
authorDenys Séguret <cano.petrole@gmail.com>2023-04-05 10:19:17 +0200
committerGitHub <noreply@github.com>2023-04-05 10:19:17 +0200
commitfb6085d5706c70bb4c80807ef109ec63f7a1392c (patch)
treef6b5a60b9d001f3f4f64a9dd9c10a280920f3d88 /src/verb
parent9564db60bb6a78e1393dac1003c963e4d2201cc9 (diff)
switch_terminal verb config parameter (#693)
Broot runs in an "alternate terminal". By default, broot switches back to the normal terminal during the execution of a program it launches, then back to its alternate terminal on end of the external process. In some cases, this adds an unnecessary flicker. The `switch_terminal` verb parameter, whose default value is `true`, lets you disable this behaviour.
Diffstat (limited to 'src/verb')
-rw-r--r--src/verb/external_execution.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/verb/external_execution.rs b/src/verb/external_execution.rs
index 626dc6c..57b78c9 100644
--- a/src/verb/external_execution.rs
+++ b/src/verb/external_execution.rs
@@ -36,6 +36,10 @@ pub struct ExternalExecution {
/// the working directory of the new process, or none if we don't
/// want to set it
pub working_dir: Option<String>,
+
+ /// whether we need to switch to the normal terminal for
+ /// the duration of the execution of the process
+ pub switch_terminal: bool,
}
impl ExternalExecution {
@@ -47,6 +51,7 @@ impl ExternalExecution {
exec_pattern,
exec_mode,
working_dir: None,
+ switch_terminal: true, // by default we switch
}
}
@@ -138,6 +143,7 @@ impl ExternalExecution {
let launchable = Launchable::program(
builder.exec_token(&self.exec_pattern),
self.working_dir_path(&builder),
+ self.switch_terminal,
con,
)?;
Ok(CmdResult::from(launchable))
@@ -158,6 +164,7 @@ impl ExternalExecution {
let launchable = Launchable::program(
builder.exec_token(&self.exec_pattern),
working_dir_path,
+ self.switch_terminal,
con,
)?;
info!("Executing not leaving, launchable {:?}", launchable);
@@ -179,6 +186,7 @@ impl ExternalExecution {
let launchable = Launchable::program(
builder.sel_exec_token(&self.exec_pattern, Some(sel)),
working_dir_path.clone(),
+ self.switch_terminal,
con,
)?;
if let Err(e) = launchable.execute(Some(w)) {