Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ pub enum SetConfigFields {
ShowMenubarIcon(bool),
SetPage(MainPage),
SetEventDuration(String),
SetShowOnStartup(bool),
Modes(Editable<(String, String)>),
Aliases(Editable<(String, String)>),
SearchDirs(Editable<String>),
Expand Down
10 changes: 10 additions & 0 deletions src/app/pages/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,15 @@ fn general_tab(config: Box<Config>, theme: crate::config::Theme) -> Column<'stat
.into(),
]));

let show_on_startup = settings_row_without_reset(settings_item_row([
settings_hint_text(theme.clone(), "Show on startup", None::<String>),
Space::new().width(Length::Fill).into(),
toggler(config.clone().show_on_startup)
.style(move |_, status| settings_toggle_style(status))
.on_toggle(|a| Message::SetConfig(SetConfigFields::SetShowOnStartup(a)))
.into(),
]));

let auto_update = settings_row_without_reset(settings_item_row([
settings_hint_text(theme.clone(), "Auto update", None::<String>),
Space::new().width(Length::Fill).into(),
Expand Down Expand Up @@ -467,6 +476,7 @@ fn general_tab(config: Box<Config>, theme: crate::config::Theme) -> Column<'stat
start_at_login,
position_dropdown,
auto_update,
show_on_startup,
haptic,
tray_icon,
clipboard_history,
Expand Down
12 changes: 8 additions & 4 deletions src/app/tile/elm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,19 @@ pub fn new(hotkeys: Hotkeys, config: &Config) -> (Tile, Task<Message>) {

let pos = config.window_location;

let show_on_start = config.show_on_startup;

let open = open.discard().chain(window::run(id, move |handle| {
platform::window_config(
&handle.window_handle().expect("Unable to get window handle"),
pos,
);
transform_process_to_ui_element();
if show_on_start {
Message::OpenWindow
} else {
Message::HideWindow(id)
}
}));
info!("MacOS platform config applied");

Expand Down Expand Up @@ -112,10 +119,7 @@ pub fn new(hotkeys: Hotkeys, config: &Config) -> (Tile, Task<Message>) {
previous_input_source: None,
conn,
},
Task::batch([
open.map(|_| Message::OpenWindow),
Task::done(Message::LoadClipboardData(300)),
]),
Task::batch([open, Task::done(Message::LoadClipboardData(300))]),
)
}

Expand Down
1 change: 1 addition & 0 deletions src/app/tile/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,7 @@ pub fn handle_update(tile: &mut Tile, message: Message) -> Task<Message> {
SetConfigFields::Modes(Editable::Create((key, value))) => {
final_config.modes.insert(key, value);
}
SetConfigFields::SetShowOnStartup(show) => final_config.show_on_startup = show,
SetConfigFields::SetEventDuration(duration) => {
if duration.trim().is_empty() {
final_config.event_duration = 0;
Expand Down
2 changes: 2 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ pub struct Config {
pub start_at_login: bool,
pub theme: Theme,
pub window_location: Position,
pub show_on_startup: bool,
pub placeholder: String,
pub search_url: String,
pub haptic_feedback: bool,
Expand Down Expand Up @@ -132,6 +133,7 @@ impl Default for Config {
search_url: "https://duckduckgo.com/search?q=%s".to_string(),
cbhist: true,
cbhist_paste_on_select: false,
show_on_startup: true,
haptic_feedback: false,
auto_update: true,
show_trayicon: true,
Expand Down
Loading