Allow startup options to supercede profile
This commit is contained in:
parent
353bbbee37
commit
fda0850b3b
1 changed files with 32 additions and 27 deletions
13
src/main.rs
13
src/main.rs
|
|
@ -1,6 +1,7 @@
|
||||||
// Copyright 2023 System76 <info@system76.com>
|
// Copyright 2023 System76 <info@system76.com>
|
||||||
// SPDX-License-Identifier: GPL-3.0-only
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
|
use alacritty_terminal::tty::Options;
|
||||||
use alacritty_terminal::{event::Event as TermEvent, term, term::color::Colors as TermColors, tty};
|
use alacritty_terminal::{event::Event as TermEvent, term, term::color::Colors as TermColors, tty};
|
||||||
use cosmic::iced::clipboard::dnd::DndAction;
|
use cosmic::iced::clipboard::dnd::DndAction;
|
||||||
use cosmic::widget::menu::action::MenuAction;
|
use cosmic::widget::menu::action::MenuAction;
|
||||||
|
|
@ -1250,8 +1251,10 @@ impl App {
|
||||||
Some(colors) => {
|
Some(colors) => {
|
||||||
let current_pane = self.pane_model.focus;
|
let current_pane = self.pane_model.focus;
|
||||||
if let Some(tab_model) = self.pane_model.active_mut() {
|
if let Some(tab_model) = self.pane_model.active_mut() {
|
||||||
// Use the profile options, startup options, or defaults
|
// Use the startup options, profile options, or defaults
|
||||||
let (options, tab_title_override) = match profile_id_opt
|
let (options, tab_title_override) = match self.startup_options.take() {
|
||||||
|
Some(options) => (options, None),
|
||||||
|
None => match profile_id_opt
|
||||||
.and_then(|profile_id| self.config.profiles.get(&profile_id))
|
.and_then(|profile_id| self.config.profiles.get(&profile_id))
|
||||||
{
|
{
|
||||||
Some(profile) => {
|
Some(profile) => {
|
||||||
|
|
@ -1262,7 +1265,8 @@ impl App {
|
||||||
shell = Some(tty::Shell::new(command, args));
|
shell = Some(tty::Shell::new(command, args));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let working_directory = (!profile.working_directory.is_empty())
|
let working_directory =
|
||||||
|
(!profile.working_directory.is_empty())
|
||||||
.then(|| profile.working_directory.clone().into());
|
.then(|| profile.working_directory.clone().into());
|
||||||
|
|
||||||
let options = tty::Options {
|
let options = tty::Options {
|
||||||
|
|
@ -1278,7 +1282,8 @@ impl App {
|
||||||
};
|
};
|
||||||
(options, tab_title_override)
|
(options, tab_title_override)
|
||||||
}
|
}
|
||||||
None => (self.startup_options.take().unwrap_or_default(), None),
|
None => (Options::default(), None),
|
||||||
|
},
|
||||||
};
|
};
|
||||||
let entity = tab_model
|
let entity = tab_model
|
||||||
.insert()
|
.insert()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue