From b011bc7635c0e0f7871841c3b4a21c2454368a50 Mon Sep 17 00:00:00 2001 From: git-f0x <150025636+git-f0x@users.noreply.github.com> Date: Tue, 6 Aug 2024 18:57:47 +0200 Subject: [PATCH 1/3] fix: add padding to context menu divider --- src/menu.rs | 21 +++++++++++---------- src/tab.rs | 6 +++++- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/menu.rs b/src/menu.rs index 5621d84..d73ec1b 100644 --- a/src/menu.rs +++ b/src/menu.rs @@ -5,6 +5,7 @@ use cosmic::{ iced::{widget::horizontal_rule, Alignment, Background, Border, Length}, theme, widget, + widget::container, widget::menu::{self, key_bind::KeyBind, ItemHeight, ItemWidth, MenuBar}, Element, }; @@ -109,17 +110,17 @@ pub fn context_menu<'a>( children .push(menu_item(fl!("open-in-new-window"), Action::OpenInNewWindow).into()); } - children.push(horizontal_rule(1).into()); + children.push(container(horizontal_rule(1)).padding([0, 8]).into()); children.push(menu_item(fl!("rename"), Action::Rename).into()); children.push(menu_item(fl!("cut"), Action::Cut).into()); children.push(menu_item(fl!("copy"), Action::Copy).into()); //TODO: Print? - children.push(horizontal_rule(1).into()); + children.push(container(horizontal_rule(1)).padding([0, 8]).into()); //TODO: change to Show details children.push(menu_item(fl!("properties"), Action::Properties).into()); - children.push(horizontal_rule(1).into()); + children.push(container(horizontal_rule(1)).padding([0, 8]).into()); children.push(menu_item(fl!("add-to-sidebar"), Action::AddToSidebar).into()); - children.push(horizontal_rule(1).into()); + children.push(container(horizontal_rule(1)).padding([0, 8]).into()); children.push(menu_item(fl!("move-to-trash"), Action::MoveToTrash).into()); } else { //TODO: need better designs for menu with no selection @@ -127,10 +128,10 @@ pub fn context_menu<'a>( children.push(menu_item(fl!("new-file"), Action::NewFile).into()); children.push(menu_item(fl!("new-folder"), Action::NewFolder).into()); children.push(menu_item(fl!("open-in-terminal"), Action::OpenTerminal).into()); - children.push(horizontal_rule(1).into()); + children.push(container(horizontal_rule(1)).padding([0, 8]).into()); children.push(menu_item(fl!("select-all"), Action::SelectAll).into()); children.push(menu_item(fl!("paste"), Action::Paste).into()); - children.push(horizontal_rule(1).into()); + children.push(container(horizontal_rule(1)).padding([0, 8]).into()); // TODO: Nested menu children.push(sort_item(fl!("sort-by-name"), HeadingOptions::Name)); children.push(sort_item(fl!("sort-by-modified"), HeadingOptions::Modified)); @@ -140,13 +141,13 @@ pub fn context_menu<'a>( Location::Trash => { children.push(menu_item(fl!("select-all"), Action::SelectAll).into()); if selected > 0 { - children.push(horizontal_rule(1).into()); + children.push(container(horizontal_rule(1)).padding([0, 8]).into()); children.push(menu_item(fl!("properties"), Action::Properties).into()); - children.push(horizontal_rule(1).into()); + children.push(container(horizontal_rule(1)).padding([0, 8]).into()); children .push(menu_item(fl!("restore-from-trash"), Action::RestoreFromTrash).into()); } - children.push(horizontal_rule(1).into()); + children.push(container(horizontal_rule(1)).padding([0, 8]).into()); // TODO: Nested menu children.push(sort_item(fl!("sort-by-name"), HeadingOptions::Name)); children.push(sort_item(fl!("sort-by-modified"), HeadingOptions::Modified)); @@ -272,7 +273,7 @@ pub fn location_context_menu<'a>(ancestor_index: usize) -> Element<'a, tab::Mess LocationMenuAction::OpenInNewWindow(ancestor_index), )) .into(), - horizontal_rule(1).into(), + container(horizontal_rule(1)).padding([0, 8]).into(), menu_button!(widget::text(fl!("properties"))) .on_press(tab::Message::LocationMenuAction( LocationMenuAction::Properties(ancestor_index), diff --git a/src/tab.rs b/src/tab.rs index 5540509..f80056c 100644 --- a/src/tab.rs +++ b/src/tab.rs @@ -2651,7 +2651,11 @@ impl Tab { ))); if count > 0 { - children.push(container(horizontal_rule(1)).padding([0, space_xxxs]).into()); + children.push( + container(horizontal_rule(1)) + .padding([0, space_xxxs]) + .into(), + ); y += 1; } From f03fc1e3ab7f8122cad87b985ee6bdd48a17177c Mon Sep 17 00:00:00 2001 From: git-f0x <150025636+git-f0x@users.noreply.github.com> Date: Thu, 8 Aug 2024 15:50:16 +0200 Subject: [PATCH 2/3] feat: add missing file menu entries --- i18n/en/cosmic_files.ftl | 17 +++++++++-------- src/app.rs | 4 ++-- src/key_bind.rs | 1 + src/menu.rs | 13 ++++++++----- 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/i18n/en/cosmic_files.ftl b/i18n/en/cosmic_files.ftl index 26e308b..319c375 100644 --- a/i18n/en/cosmic_files.ftl +++ b/i18n/en/cosmic_files.ftl @@ -93,20 +93,20 @@ renamed = Renamed {$from} to {$to} restoring = Restoring {$items} {$items -> [one] item *[other] items - } from {trash} + } from {trash} restored = Restored {$items} {$items -> [one] item *[other] items - } from {trash} + } from {trash} undo = Undo unknown-folder = unknown folder ## Open with -open-with = Open with +open-with = Open with... default-app = {$name} (default) -## Properties -properties = Properties +## Show details +show-details = Show details ## Settings settings = Settings @@ -129,8 +129,8 @@ light = Light # Context menu add-to-sidebar = Add to sidebar -new-file = New file -new-folder = New folder +new-file = New file... +new-folder = New folder... open-in-terminal = Open in terminal move-to-trash = Move to trash restore-from-trash = Restore from trash @@ -145,7 +145,8 @@ sort-by-size = Sort by size file = File new-tab = New tab new-window = New window -rename = Rename +rename = Rename... +menu-show-details = Show details... close-tab = Close tab quit = Quit diff --git a/src/app.rs b/src/app.rs index e2d0709..4667f4b 100644 --- a/src/app.rs +++ b/src/app.rs @@ -280,7 +280,7 @@ impl ContextPage { Self::About => String::new(), Self::EditHistory => fl!("edit-history"), Self::OpenWith => fl!("open-with"), - Self::Properties(..) => fl!("properties"), + Self::Properties(..) => String::default(), Self::Settings => fl!("settings"), } } @@ -1051,7 +1051,7 @@ impl Application for App { ), cosmic::widget::menu::Item::Divider, cosmic::widget::menu::Item::Button( - fl!("properties"), + fl!("show-details"), NavMenuAction::Properties(id), ), cosmic::widget::menu::Item::Divider, diff --git a/src/key_bind.rs b/src/key_bind.rs index 2070e00..61adbe2 100644 --- a/src/key_bind.rs +++ b/src/key_bind.rs @@ -23,6 +23,7 @@ pub fn key_binds() -> HashMap { }}; } + bind!([Ctrl], Key::Character("d".into()), AddToSidebar); bind!([Ctrl], Key::Character("c".into()), Copy); bind!([Ctrl], Key::Character("x".into()), Cut); bind!([Ctrl], Key::Character("l".into()), EditLocation); diff --git a/src/menu.rs b/src/menu.rs index d73ec1b..b0aa3fc 100644 --- a/src/menu.rs +++ b/src/menu.rs @@ -116,8 +116,7 @@ pub fn context_menu<'a>( children.push(menu_item(fl!("copy"), Action::Copy).into()); //TODO: Print? children.push(container(horizontal_rule(1)).padding([0, 8]).into()); - //TODO: change to Show details - children.push(menu_item(fl!("properties"), Action::Properties).into()); + children.push(menu_item(fl!("show-details"), Action::Properties).into()); children.push(container(horizontal_rule(1)).padding([0, 8]).into()); children.push(menu_item(fl!("add-to-sidebar"), Action::AddToSidebar).into()); children.push(container(horizontal_rule(1)).padding([0, 8]).into()); @@ -142,7 +141,7 @@ pub fn context_menu<'a>( children.push(menu_item(fl!("select-all"), Action::SelectAll).into()); if selected > 0 { children.push(container(horizontal_rule(1)).padding([0, 8]).into()); - children.push(menu_item(fl!("properties"), Action::Properties).into()); + children.push(menu_item(fl!("show-details"), Action::Properties).into()); children.push(container(horizontal_rule(1)).padding([0, 8]).into()); children .push(menu_item(fl!("restore-from-trash"), Action::RestoreFromTrash).into()); @@ -192,9 +191,13 @@ pub fn menu_bar<'a>( menu::Item::Button(fl!("new-file"), Action::NewFile), menu::Item::Button(fl!("new-folder"), Action::NewFolder), menu::Item::Button(fl!("open"), Action::Open), + menu::Item::Button(fl!("open-with"), Action::OpenWith), menu::Item::Divider, menu::Item::Button(fl!("rename"), Action::Rename), - //TOOD: add to sidebar, then divider + menu::Item::Divider, + menu::Item::Button(fl!("menu-show-details"), Action::Properties), + menu::Item::Divider, + menu::Item::Button(fl!("add-to-sidebar"), Action::AddToSidebar), menu::Item::Divider, menu::Item::Button(fl!("move-to-trash"), Action::MoveToTrash), menu::Item::Divider, @@ -274,7 +277,7 @@ pub fn location_context_menu<'a>(ancestor_index: usize) -> Element<'a, tab::Mess )) .into(), container(horizontal_rule(1)).padding([0, 8]).into(), - menu_button!(widget::text(fl!("properties"))) + menu_button!(widget::text(fl!("show-details"))) .on_press(tab::Message::LocationMenuAction( LocationMenuAction::Properties(ancestor_index), )) From 5af7658a06a8d39025c27dbd05b24b524cd66c9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vuka=C5=A1in=20Vojinovi=C4=87?= Date: Fri, 9 Aug 2024 20:09:36 +0200 Subject: [PATCH 3/3] fix: add settings keybind --- src/key_bind.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/key_bind.rs b/src/key_bind.rs index 61adbe2..16b7076 100644 --- a/src/key_bind.rs +++ b/src/key_bind.rs @@ -50,6 +50,7 @@ pub fn key_binds() -> HashMap { bind!([], Key::Named(Named::F2), Rename); bind!([Ctrl], Key::Character("f".into()), SearchActivate); bind!([Ctrl], Key::Character("a".into()), SelectAll); + bind!([Ctrl], Key::Character(",".into()), Settings); bind!([Ctrl], Key::Character("w".into()), TabClose); bind!([Ctrl], Key::Character("t".into()), TabNew); bind!([Ctrl], Key::Named(Named::Tab), TabNext);