Add desktop context menu items, part of #547
This commit is contained in:
parent
7f60a0c710
commit
afa7c30857
3 changed files with 39 additions and 0 deletions
|
|
@ -203,6 +203,11 @@ sort-by-modified = Sort by modified
|
|||
sort-by-size = Sort by size
|
||||
sort-by-trashed = Sort by delete time
|
||||
|
||||
## Desktop
|
||||
change-wallpaper = Change wallpaper...
|
||||
desktop-appearance = Desktop appearance...
|
||||
display-settings = Display settings...
|
||||
|
||||
# Menu
|
||||
|
||||
## File
|
||||
|
|
|
|||
18
src/app.rs
18
src/app.rs
|
|
@ -93,6 +93,9 @@ pub enum Action {
|
|||
Compress,
|
||||
Copy,
|
||||
Cut,
|
||||
CosmicSettingsAppearance,
|
||||
CosmicSettingsDisplays,
|
||||
CosmicSettingsWallpaper,
|
||||
EditHistory,
|
||||
EditLocation,
|
||||
ExtractHere,
|
||||
|
|
@ -146,6 +149,9 @@ impl Action {
|
|||
Action::Compress => Message::Compress(entity_opt),
|
||||
Action::Copy => Message::Copy(entity_opt),
|
||||
Action::Cut => Message::Cut(entity_opt),
|
||||
Action::CosmicSettingsAppearance => Message::CosmicSettings("appearance"),
|
||||
Action::CosmicSettingsDisplays => Message::CosmicSettings("displays"),
|
||||
Action::CosmicSettingsWallpaper => Message::CosmicSettings("wallpaper"),
|
||||
Action::EditHistory => Message::ToggleContextPage(ContextPage::EditHistory),
|
||||
Action::EditLocation => {
|
||||
Message::TabMessage(entity_opt, tab::Message::EditLocationToggle)
|
||||
|
|
@ -253,6 +259,7 @@ pub enum Message {
|
|||
Compress(Option<Entity>),
|
||||
Config(Config),
|
||||
Copy(Option<Entity>),
|
||||
CosmicSettings(&'static str),
|
||||
Cut(Option<Entity>),
|
||||
DialogCancel,
|
||||
DialogComplete,
|
||||
|
|
@ -1390,6 +1397,17 @@ impl Application for App {
|
|||
Message::CloseToast(id) => {
|
||||
self.toasts.remove(id);
|
||||
}
|
||||
Message::CosmicSettings(arg) => {
|
||||
//TODO: use special settings URL scheme instead?
|
||||
let mut command = process::Command::new("cosmic-settings");
|
||||
command.arg(arg);
|
||||
match spawn_detached(&mut command) {
|
||||
Ok(()) => {}
|
||||
Err(err) => {
|
||||
log::warn!("failed to run cosmic-settings {}: {}", arg, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
Message::DialogCancel => {
|
||||
self.dialog_pages.pop_front();
|
||||
}
|
||||
|
|
|
|||
16
src/menu.rs
16
src/menu.rs
|
|
@ -168,6 +168,22 @@ pub fn context_menu<'a>(
|
|||
children.push(menu_item(fl!("select-all"), Action::SelectAll).into());
|
||||
}
|
||||
children.push(menu_item(fl!("paste"), Action::Paste).into());
|
||||
|
||||
//TODO: only show if cosmic-settings is found?
|
||||
if matches!(tab.mode, tab::Mode::Desktop) {
|
||||
children.push(divider::horizontal::light().into());
|
||||
children.push(
|
||||
menu_item(fl!("change-wallpaper"), Action::CosmicSettingsWallpaper).into(),
|
||||
);
|
||||
children.push(
|
||||
menu_item(fl!("desktop-appearance"), Action::CosmicSettingsAppearance)
|
||||
.into(),
|
||||
);
|
||||
children.push(
|
||||
menu_item(fl!("display-settings"), Action::CosmicSettingsDisplays).into(),
|
||||
);
|
||||
}
|
||||
|
||||
children.push(divider::horizontal::light().into());
|
||||
// TODO: Nested menu
|
||||
children.push(sort_item(fl!("sort-by-name"), HeadingOptions::Name));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue