summaryrefslogtreecommitdiff
path: root/Applications
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2020-07-15 11:35:15 -0400
committerAndreas Kling <kling@serenityos.org>2020-07-15 18:30:26 +0200
commit6e0af349a261cb7527c9c829b72bd5656d8ec027 (patch)
tree63e53d9e9fe8f2efad99299cccd8877f4906ae52 /Applications
parent02305d01ea8591e3026176a0a32845881900e31f (diff)
downloadserenity-6e0af349a261cb7527c9c829b72bd5656d8ec027.zip
FileManager: Make Ctrl-L focus location bar, and change shortcuts for changing view
Ctrl-L focuses the location bar in all file managers I know of, and does so in SerenityOS's browser too. It should work in SerenityOS's file manager as well. Unfortunately, Ctrl-L was already "View List", so change the shortcuts of all the view modes to Ctrl-1/2/3 which is what several other file managers use. (I tried Ctrl-Shift-1/2/3 which is what Windows Explorer uses after 8.1, but it didn't Just Work, and Ctrl-1/2/3 are currently free anyways. If we ever want to use them for tabs or whatever, we can change the view shortcuts then.)
Diffstat (limited to 'Applications')
-rw-r--r--Applications/FileManager/main.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/Applications/FileManager/main.cpp b/Applications/FileManager/main.cpp
index 6686395783..c39c6028b7 100644
--- a/Applications/FileManager/main.cpp
+++ b/Applications/FileManager/main.cpp
@@ -379,24 +379,24 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio
RefPtr<GUI::Action> view_as_icons_action;
RefPtr<GUI::Action> view_as_columns_action;
- view_as_table_action = GUI::Action::create_checkable(
- "Table view", { Mod_Ctrl, KeyCode::Key_L }, Gfx::Bitmap::load_from_file("/res/icons/16x16/table-view.png"), [&](const GUI::Action&) {
- directory_view.set_view_mode(DirectoryView::ViewMode::Table);
- config->write_entry("DirectoryView", "ViewMode", "Table");
+ view_as_icons_action = GUI::Action::create_checkable(
+ "Icon view", { Mod_Ctrl, KeyCode::Key_1 }, Gfx::Bitmap::load_from_file("/res/icons/16x16/icon-view.png"), [&](const GUI::Action&) {
+ directory_view.set_view_mode(DirectoryView::ViewMode::Icon);
+ config->write_entry("DirectoryView", "ViewMode", "Icon");
config->sync();
},
window);
- view_as_icons_action = GUI::Action::create_checkable(
- "Icon view", { Mod_Ctrl, KeyCode::Key_I }, Gfx::Bitmap::load_from_file("/res/icons/16x16/icon-view.png"), [&](const GUI::Action&) {
- directory_view.set_view_mode(DirectoryView::ViewMode::Icon);
- config->write_entry("DirectoryView", "ViewMode", "Icon");
+ view_as_table_action = GUI::Action::create_checkable(
+ "Table view", { Mod_Ctrl, KeyCode::Key_2 }, Gfx::Bitmap::load_from_file("/res/icons/16x16/table-view.png"), [&](const GUI::Action&) {
+ directory_view.set_view_mode(DirectoryView::ViewMode::Table);
+ config->write_entry("DirectoryView", "ViewMode", "Table");
config->sync();
},
window);
view_as_columns_action = GUI::Action::create_checkable(
- "Columns view", Gfx::Bitmap::load_from_file("/res/icons/16x16/columns-view.png"), [&](const GUI::Action&) {
+ "Columns view", { Mod_Ctrl, KeyCode::Key_3 }, Gfx::Bitmap::load_from_file("/res/icons/16x16/columns-view.png"), [&](const GUI::Action&) {
directory_view.set_view_mode(DirectoryView::ViewMode::Columns);
config->write_entry("DirectoryView", "ViewMode", "Columns");
config->sync();
@@ -405,8 +405,8 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio
auto view_type_action_group = make<GUI::ActionGroup>();
view_type_action_group->set_exclusive(true);
- view_type_action_group->add_action(*view_as_table_action);
view_type_action_group->add_action(*view_as_icons_action);
+ view_type_action_group->add_action(*view_as_table_action);
view_type_action_group->add_action(*view_as_columns_action);
auto selected_file_paths = [&] {
@@ -668,6 +668,11 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio
go_menu.add_action(go_forward_action);
go_menu.add_action(open_parent_directory_action);
go_menu.add_action(go_home_action);
+ go_menu.add_action(GUI::Action::create(
+ "Go to location...", { Mod_Ctrl, Key_L }, [&](auto&) {
+ location_textbox.select_all();
+ location_textbox.set_focus(true);
+ }));
auto& help_menu = menubar->add_menu("Help");
help_menu.add_action(GUI::Action::create("About", [&](auto&) {