mirror of
https://github.com/wez/wezterm.git
synced 2024-11-27 02:25:28 +03:00
add default_gui_startup_args config
closes: https://github.com/wez/wezterm/issues/1030
This commit is contained in:
parent
e352c40905
commit
20e424f54b
@ -799,6 +799,9 @@ pub struct Config {
|
||||
/// as the positional arguments to that command.
|
||||
pub default_prog: Option<Vec<String>>,
|
||||
|
||||
#[serde(default = "default_gui_startup_args")]
|
||||
pub default_gui_startup_args: Vec<String>,
|
||||
|
||||
/// Specifies the default current working directory if none is specified
|
||||
/// through configuration or OSC 7 (see docs for `default_cwd` for more
|
||||
/// info!)
|
||||
@ -1966,3 +1969,7 @@ fn default_write_timeout() -> Duration {
|
||||
fn default_bypass_mouse_reporting_modifiers() -> Modifiers {
|
||||
Modifiers::SHIFT
|
||||
}
|
||||
|
||||
fn default_gui_startup_args() -> Vec<String> {
|
||||
vec!["start".to_string()]
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ As features stabilize some brief notes about them will accumulate here.
|
||||
* unix domains now support an optional `proxy_command` to use in place of a direct unix socket connection. [Read more about multiplexing unix domains](multiplexing.html#unix-domains)
|
||||
* [ScrollToTop](config/lua/keyassignment/ScrollToTop.md) and [ScrollToBottom](config/lua/keyassignment/ScrollToBottom.md) key assignments [#1360](https://github.com/wez/wezterm/issues/1360)
|
||||
* [SSH Domains](config/lua/SshDomain.md) now support specifying `ssh_config` overrides. [#1149](https://github.com/wez/wezterm/issues/1149)
|
||||
* [default_gui_startup_args](config/lua/config/default_gui_startup_args.md) allows defaulting to starting the ssh client (for example). [#1030](https://github.com/wez/wezterm/issues/1030)
|
||||
|
||||
#### Changed
|
||||
|
||||
|
29
docs/config/lua/config/default_gui_startup_args.md
Normal file
29
docs/config/lua/config/default_gui_startup_args.md
Normal file
@ -0,0 +1,29 @@
|
||||
# `default_gui_startup_args = {"start"}`
|
||||
|
||||
*Since: nightly builds only*
|
||||
|
||||
When launching the GUI using either `wezterm` or `wezterm-gui` (with no
|
||||
subcommand explicitly specified), wezterm will use the value of
|
||||
`default_gui_startup_args` to pick a default mode for running the GUI.
|
||||
|
||||
The default for this config is `{"start"}` which makes `wezterm` with no
|
||||
additional subcommand arguments equivalent to `wezterm start`.
|
||||
|
||||
If you know that you always want to use wezterm's ssh client to login to a
|
||||
particular host, then you might consider using this configuration:
|
||||
|
||||
```lua
|
||||
return {
|
||||
default_gui_startup_args = {"ssh", "some-host"},
|
||||
}
|
||||
```
|
||||
|
||||
which will cause `wezterm` with no additional subcommand arguments to be
|
||||
equivalent to running `wezterm ssh some-host`.
|
||||
|
||||
Specifying subcommand arguments on the command line is NOT additive with
|
||||
this config; the command line arguments always take precedence.
|
||||
|
||||
Depending on your desktop environment, you may find it simpler to use
|
||||
your operating system shortcut or alias function to set up a shortcut
|
||||
that runs the subcommand you desire.
|
@ -3,7 +3,7 @@
|
||||
|
||||
use crate::frontend::front_end;
|
||||
use ::window::*;
|
||||
use anyhow::anyhow;
|
||||
use anyhow::{anyhow, Context};
|
||||
use config::{ConfigHandle, SshBackend};
|
||||
use mux::activity::Activity;
|
||||
use mux::domain::{Domain, LocalDomain};
|
||||
@ -649,12 +649,24 @@ fn run() -> anyhow::Result<()> {
|
||||
);
|
||||
let config = config::configuration();
|
||||
|
||||
match opts
|
||||
.cmd
|
||||
.as_ref()
|
||||
.cloned()
|
||||
.unwrap_or_else(|| SubCommand::Start(StartCommand::default()))
|
||||
{
|
||||
let sub = match opts.cmd.as_ref().cloned() {
|
||||
Some(sub) => sub,
|
||||
None => {
|
||||
// Need to fake an argv0
|
||||
let mut argv = vec!["wezterm-gui".to_string()];
|
||||
for a in &config.default_gui_startup_args {
|
||||
argv.push(a.clone());
|
||||
}
|
||||
SubCommand::from_iter_safe(&argv).with_context(|| {
|
||||
format!(
|
||||
"parsing the default_gui_startup_args config: {:?}",
|
||||
config.default_gui_startup_args
|
||||
)
|
||||
})?
|
||||
}
|
||||
};
|
||||
|
||||
match sub {
|
||||
SubCommand::Start(start) => {
|
||||
log::trace!("Using configuration: {:#?}\nopts: {:#?}", config, opts);
|
||||
run_terminal_gui(start)
|
||||
|
Loading…
Reference in New Issue
Block a user