From 483a005cc2c86b6ec7f16914f971f735d8520179 Mon Sep 17 00:00:00 2001 From: hius07 <62179190+hius07@users.noreply.github.com> Date: Wed, 5 Apr 2023 08:24:41 +0300 Subject: [PATCH] File browser: show Folder Menu on long-press on Home icon (#10298) --- frontend/apps/filemanager/filemanager.lua | 4 ++-- frontend/ui/widget/filechooser.lua | 2 +- plugins/gestures.koplugin/defaults.lua | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/apps/filemanager/filemanager.lua b/frontend/apps/filemanager/filemanager.lua index 80b53eb47..4f6c6ad9d 100644 --- a/frontend/apps/filemanager/filemanager.lua +++ b/frontend/apps/filemanager/filemanager.lua @@ -119,8 +119,8 @@ function FileManager:setupLayout() button_padding = Screen:scaleBySize(5), left_icon = "home", left_icon_size_ratio = 1, - left_icon_tap_callback = function() self:onShowFolderMenu() end, - left_icon_hold_callback = false, -- propagate long-press to dispatcher + left_icon_tap_callback = function() self:goHome() end, + left_icon_hold_callback = function() self:onShowFolderMenu() end, right_icon = "plus", right_icon_size_ratio = 1, right_icon_tap_callback = function() self:onShowPlusMenu() end, diff --git a/frontend/ui/widget/filechooser.lua b/frontend/ui/widget/filechooser.lua index 685252023..9ca9bbd70 100644 --- a/frontend/ui/widget/filechooser.lua +++ b/frontend/ui/widget/filechooser.lua @@ -405,7 +405,7 @@ function FileChooser:changeToPath(path, focused_path) end if not unreadable_dir_content[path][focused_path] then unreadable_dir_content[path][focused_path] = { - text = focused_path:sub(#path+2), + text = focused_path:sub(#path > 1 and #path+2 or 2), fullpath = focused_path, attr = lfs.attributes(focused_path), } diff --git a/plugins/gestures.koplugin/defaults.lua b/plugins/gestures.koplugin/defaults.lua index aca03b7bd..676c548bc 100644 --- a/plugins/gestures.koplugin/defaults.lua +++ b/plugins/gestures.koplugin/defaults.lua @@ -7,7 +7,7 @@ return { tap_top_right_corner = nil, tap_right_bottom_corner = nil, tap_left_bottom_corner = Device:hasFrontlight() and {toggle_frontlight = true,} or nil, - hold_top_left_corner = {filemanager = true,}, + hold_top_left_corner = nil, hold_top_right_corner = {refresh_content = true,}, hold_bottom_left_corner = nil, hold_bottom_right_corner = nil,