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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ value as shown below:
"history_limit": 100,
"clipboard_limit": 20,
"preserve_command": false,
"clear_query_after_run": false,
"follow_mouse": true,
"static_location_enabled": false,
"static_pos": [0, 0],
Expand Down Expand Up @@ -158,6 +159,7 @@ Example: typing `test` will only list entries containing `test`. If an alias mat
`history_limit` defines how many entries the history plugin keeps.
`clipboard_limit` sets how many clipboard entries are persisted for the clipboard plugin.
`preserve_command` keeps the typed command prefix (like `bm add` or `f add`) in the search field after running an action.
`clear_query_after_run` removes the search text after a successful action whenever you prefer starting with a blank box.
`enabled_capabilities` maps plugin names to capability identifiers so features can be toggled individually. The folders plugin, for example, exposes `show_full_path`.
`screenshot_dir` sets the directory used when saving screenshots. If omitted, screenshots are stored in a `MultiLauncher_Screenshots` folder in the current working directory.
`screenshot_save_file` determines whether screenshots copied to the clipboard are also written to disk. The default is `true`.
Expand Down
58 changes: 53 additions & 5 deletions settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
"enabled_capabilities": null,
"debug_logging": false,
"log_file": null,
"offscreen_pos": null,
"offscreen_pos": [
2000,
2000
],
"window_size": [
718,
777
Expand All @@ -34,19 +37,64 @@
"clipboard_limit": 20,
"follow_mouse": true,
"static_location_enabled": false,
"static_pos": null,
"static_size": null,
"hide_after_run": false,
"static_pos": [
0,
0
],
"static_size": [
400,
220
],
"hide_after_run": true,
"always_on_top": true,
"timer_refresh": 1.0,
"disable_timer_updates": false,
"preserve_command": false,
"clear_query_after_run": true,
"net_refresh": 1.0,
"net_unit": "auto",
"screenshot_dir": null,
"screenshot_save_file": false,
"screenshot_auto_save": true,
"screenshot_use_editor": true,
"plugin_settings": {},
"plugin_settings": {
"network": {
"refresh_rate": 1.0,
"unit": "auto"
},
"history": {
"max_entries": 100
},
"color_picker": {
"color": [
255,
0,
0,
255
]
},
"browser_tabs": {
"recalc_each_query": false
},
"stopwatch": {
"precision": 2,
"refresh_rate": 1.0
},
"screenshot": {
"screenshot_auto_save": true,
"screenshot_dir": "",
"screenshot_save_file": false,
"screenshot_use_editor": true
},
"shell": {
"open_in_wezterm": false
},
"calculator": {
"save_on_enter": false
},
"clipboard": {
"max_entries": 20
}
},
"pinned_panels": []
}
38 changes: 33 additions & 5 deletions src/gui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,7 @@ pub use fav_dialog::FavDialog;
pub use image_panel::ImagePanel;
pub use macro_dialog::MacroDialog;
pub use note_panel::{
build_nvim_command,
build_wezterm_command,
extract_links,
show_wiki_link,
spawn_external,
build_nvim_command, build_wezterm_command, extract_links, show_wiki_link, spawn_external,
NotePanel,
};
pub use notes_dialog::NotesDialog;
Expand Down Expand Up @@ -385,6 +381,7 @@ pub struct LauncherApp {
pub timer_refresh: f32,
pub disable_timer_updates: bool,
pub preserve_command: bool,
pub clear_query_after_run: bool,
pub query_autocomplete: bool,
pub net_refresh: f32,
pub net_unit: crate::settings::NetUnit,
Expand Down Expand Up @@ -501,6 +498,7 @@ impl LauncherApp {
static_pos: Option<(i32, i32)>,
static_size: Option<(i32, i32)>,
hide_after_run: Option<bool>,
clear_query_after_run: Option<bool>,
timer_refresh: Option<f32>,
disable_timer_updates: Option<bool>,
preserve_command: Option<bool>,
Expand Down Expand Up @@ -556,6 +554,9 @@ impl LauncherApp {
if let Some(v) = hide_after_run {
self.hide_after_run = v;
}
if let Some(v) = clear_query_after_run {
self.clear_query_after_run = v;
}
if let Some(v) = timer_refresh {
self.timer_refresh = v;
}
Expand Down Expand Up @@ -884,6 +885,7 @@ impl LauncherApp {
timer_refresh: settings.timer_refresh,
disable_timer_updates: settings.disable_timer_updates,
preserve_command: settings.preserve_command,
clear_query_after_run: settings.clear_query_after_run,
query_autocomplete: settings.query_autocomplete,
net_refresh: settings.net_refresh,
net_unit: settings.net_unit,
Expand Down Expand Up @@ -2207,6 +2209,7 @@ impl eframe::App for LauncherApp {
let current = self.query.clone();
let mut refresh = false;
let mut set_focus = false;
let mut command_changed_query = false;
if let Some(new_q) = a.action.strip_prefix("query:") {
tracing::debug!("query action via Enter: {new_q}");
self.query = new_q.to_string();
Expand Down Expand Up @@ -2397,6 +2400,7 @@ impl eframe::App for LauncherApp {
} else {
self.query.clear();
}
command_changed_query = true;
refresh = true;
set_focus = true;
} else if a.action.starts_with("bookmark:remove:") {
Expand All @@ -2408,6 +2412,7 @@ impl eframe::App for LauncherApp {
} else {
self.query.clear();
}
command_changed_query = true;
refresh = true;
set_focus = true;
} else if a.action.starts_with("folder:remove:") {
Expand All @@ -2425,6 +2430,7 @@ impl eframe::App for LauncherApp {
} else {
self.query.clear();
}
command_changed_query = true;
refresh = true;
set_focus = true;
if self.enable_toasts {
Expand All @@ -2445,6 +2451,7 @@ impl eframe::App for LauncherApp {
set_focus = true;
if current.starts_with("note list") {
self.pending_query = Some(current.clone());
command_changed_query = true;
}
if self.enable_toasts {
let label =
Expand All @@ -2461,6 +2468,7 @@ impl eframe::App for LauncherApp {
// Re-run the current query so the todo list reflects the
// updated completion state immediately.
self.pending_query = Some(current.clone());
command_changed_query = true;
if self.enable_toasts {
let label = a
.label
Expand Down Expand Up @@ -2526,6 +2534,7 @@ impl eframe::App for LauncherApp {
} else {
self.query.clear();
}
command_changed_query = true;
set_focus = true;
} else if a.action.starts_with("timer:cancel:")
&& current.starts_with("timer rm")
Expand All @@ -2550,6 +2559,12 @@ impl eframe::App for LauncherApp {
} else {
self.query.clear();
}
command_changed_query = true;
set_focus = true;
}
if self.clear_query_after_run && !command_changed_query {
self.query.clear();
refresh = true;
set_focus = true;
}
if self.hide_after_run
Expand Down Expand Up @@ -2973,9 +2988,11 @@ impl eframe::App for LauncherApp {
}
if resp.clicked() {
let current = self.query.clone();
let mut command_changed_query = false;
if let Some(new_q) = a.action.strip_prefix("query:") {
tracing::debug!("query action via click: {new_q}");
clicked_query = Some(new_q.to_string());
command_changed_query = true;
set_focus = true;
tracing::debug!("move_cursor_end set via mouse click");
self.move_cursor_end = true;
Expand Down Expand Up @@ -3119,6 +3136,7 @@ impl eframe::App for LauncherApp {
} else {
self.query.clear();
}
command_changed_query = true;
refresh = true;
set_focus = true;
} else if a.action.starts_with("bookmark:remove:") {
Expand All @@ -3130,6 +3148,7 @@ impl eframe::App for LauncherApp {
} else {
self.query.clear();
}
command_changed_query = true;
refresh = true;
set_focus = true;
} else if a.action.starts_with("folder:remove:") {
Expand All @@ -3147,6 +3166,7 @@ impl eframe::App for LauncherApp {
} else {
self.query.clear();
}
command_changed_query = true;
refresh = true;
set_focus = true;
if self.enable_toasts {
Expand All @@ -3167,6 +3187,7 @@ impl eframe::App for LauncherApp {
set_focus = true;
if current.starts_with("note list") {
clicked_query = Some(current.clone());
command_changed_query = true;
}
if self.enable_toasts {
let label = a
Expand All @@ -3186,6 +3207,7 @@ impl eframe::App for LauncherApp {
// Re-run the current query so the visible list refreshes
// with the toggled completion state.
clicked_query = Some(current.clone());
command_changed_query = true;
if self.enable_toasts {
let label = a
.label
Expand Down Expand Up @@ -3254,6 +3276,12 @@ impl eframe::App for LauncherApp {
} else {
self.query.clear();
}
command_changed_query = true;
set_focus = true;
}
if self.clear_query_after_run && !command_changed_query {
self.query.clear();
refresh = true;
set_focus = true;
}
if self.hide_after_run
Expand Down
1 change: 1 addition & 0 deletions src/plugin_editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ impl PluginEditor {
s.static_pos,
s.static_size,
Some(s.hide_after_run),
Some(s.clear_query_after_run),
Some(s.timer_refresh),
Some(s.disable_timer_updates),
Some(s.preserve_command),
Expand Down
4 changes: 4 additions & 0 deletions src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ pub struct Settings {
/// Keep the command prefix in the query after running an action.
#[serde(default)]
pub preserve_command: bool,
/// Clear the search query after successfully running an action.
#[serde(default)]
pub clear_query_after_run: bool,
#[serde(default = "default_net_refresh")]
pub net_refresh: f32,
#[serde(default)]
Expand Down Expand Up @@ -294,6 +297,7 @@ impl Default for Settings {
net_unit: NetUnit::Auto,
disable_timer_updates: false,
preserve_command: false,
clear_query_after_run: false,
show_examples: false,
screenshot_dir: Some(
std::env::current_dir()
Expand Down
16 changes: 14 additions & 2 deletions src/settings_editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ pub struct SettingsEditor {
timer_refresh: f32,
disable_timer_updates: bool,
preserve_command: bool,
clear_query_after_run: bool,
query_autocomplete: bool,
net_refresh: f32,
net_unit: crate::settings::NetUnit,
Expand Down Expand Up @@ -140,6 +141,7 @@ impl SettingsEditor {
timer_refresh: settings.timer_refresh,
disable_timer_updates: settings.disable_timer_updates,
preserve_command: settings.preserve_command,
clear_query_after_run: settings.clear_query_after_run,
query_autocomplete: settings.query_autocomplete,
net_refresh: settings.net_refresh,
net_unit: settings.net_unit,
Expand Down Expand Up @@ -252,6 +254,7 @@ impl SettingsEditor {
timer_refresh: self.timer_refresh,
disable_timer_updates: self.disable_timer_updates,
preserve_command: self.preserve_command,
clear_query_after_run: self.clear_query_after_run,
query_autocomplete: self.query_autocomplete,
net_refresh: self.net_refresh,
net_unit: self.net_unit,
Expand Down Expand Up @@ -357,9 +360,15 @@ impl SettingsEditor {
);
});
}
ui.checkbox(&mut self.hide_after_run, "Hide window after running action");
ui.horizontal_wrapped(|ui| {
ui.checkbox(
&mut self.hide_after_run,
"Hide window after running action",
);
ui.checkbox(&mut self.preserve_command, "Preserve command after run");
ui.checkbox(&mut self.clear_query_after_run, "Clear query after run");
});
ui.checkbox(&mut self.always_on_top, "Always on top");
ui.checkbox(&mut self.preserve_command, "Preserve command after run");
ui.checkbox(&mut self.query_autocomplete, "Enable query autocomplete");
ui.checkbox(
&mut self.disable_timer_updates,
Expand Down Expand Up @@ -642,6 +651,7 @@ impl SettingsEditor {
new_settings.static_pos,
new_settings.static_size,
Some(new_settings.hide_after_run),
Some(new_settings.clear_query_after_run),
Some(new_settings.timer_refresh),
Some(new_settings.disable_timer_updates),
Some(new_settings.preserve_command),
Expand Down Expand Up @@ -680,6 +690,8 @@ impl SettingsEditor {
app.clipboard_limit = new_settings.clipboard_limit;
app.page_jump = new_settings.page_jump;
app.preserve_command = new_settings.preserve_command;
app.clear_query_after_run =
new_settings.clear_query_after_run;
app.query_autocomplete =
new_settings.query_autocomplete;
app.net_refresh = new_settings.net_refresh;
Expand Down
1 change: 1 addition & 0 deletions tests/hide_after_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ fn run_action(action: &str) -> bool {
None,
None,
None,
None,
);
flag.store(true, Ordering::SeqCst);
let a = app.results[0].clone();
Expand Down
Loading