feat(desktop): add per-instance desktop shortcut toggle
This commit is contained in:
1 parent
3047086fa2
commit
e18b18c0be
9 files changed
+172
-5
No files matched your search
@@ -419,6 +419,14 @@ impl App {
|
||||
self.pending_editor = Some(path);
|
||||
return Ok(());
|
||||
}
|
||||
widgets::details::SettingsAction::ToggleDesktop => {
|
||||
if let Some(inst) = self.profiles_state.selected_instance() {
|
||||
if let Err(e) = crate::instance::desktop::toggle(inst) {
|
||||
tracing::error!("Failed to toggle desktop shortcut: {}", e);
|
||||
}
|
||||
}
|
||||
return Ok(());
|
||||
}
|
||||
widgets::details::SettingsAction::None => {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,11 @@ pub fn render(
|
||||
|
||||
if focused == FocusedArea::Settings {
|
||||
let lines = super::popups::keybind_lines_wrapped(
|
||||
&[("e", " edit instance"), ("g", " edit global")],
|
||||
&[
|
||||
("e", " edit instance"),
|
||||
("g", " edit global"),
|
||||
("d", " desktop shortcut"),
|
||||
],
|
||||
area.width.saturating_sub(2),
|
||||
);
|
||||
for line in lines {
|
||||
@@ -98,6 +102,7 @@ pub enum SettingsAction {
|
||||
None,
|
||||
EditInstance(std::path::PathBuf),
|
||||
EditGlobal(std::path::PathBuf),
|
||||
ToggleDesktop,
|
||||
}
|
||||
|
||||
pub fn handle_key(
|
||||
@@ -118,6 +123,7 @@ pub fn handle_key(
|
||||
let path = crate::config::get_config_path().join("config.toml");
|
||||
SettingsAction::EditGlobal(path)
|
||||
}
|
||||
crossterm::event::KeyCode::Char('d') => SettingsAction::ToggleDesktop,
|
||||
_ => SettingsAction::None,
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user