Skip to content
This repository has been archived by the owner on Oct 28, 2023. It is now read-only.

Commit

Permalink
fm: add search&find menu (#203)
Browse files Browse the repository at this point in the history
  • Loading branch information
a1ive committed May 12, 2020
1 parent e6cc2e6 commit e4ca250
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 0 deletions.
11 changes: 11 additions & 0 deletions boot/grubfm/global.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,14 @@ hiddenentry "[F5] PXE BOOT MENU" --hotkey f5 {
hiddenentry "[F6] POWER OFF" --hotkey f6 {
configfile ${prefix}/power.sh;
}

hiddenentry " " --hotkey f {
if [ -n "${grubfm_current_path}" ];
then
export srcdir=$grubfm_current_path;
configfile $prefix/search.sh;
else
export srcdir=(*);
configfile $prefix/search.sh;
fi;
}
64 changes: 64 additions & 0 deletions boot/grubfm/search.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Grub2-FileManager
# Copyright (C) 2017,2020 A1ive.
#
# Grub2-FileManager is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Grub2-FileManager is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Grub2-FileManager. If not, see <http://www.gnu.org/licenses/>.

function search_list {
set ext="${1}";
unset found;
echo "Searching *.${ext} ...";
for file in ${srcdir}*.${ext} ${srcdir}*/*.${ext} ${srcdir}*/*/*.${ext};
do
if [ -f "${file}" ];
then
echo "${file}";
else
continue;
fi
set found="1";
menuentry "${file}" --class ${2} {
grubfm_open "${1}";
}
done;
if [ -z "${found}" ];
then
menuentry $"File not found" --class search {
configfile ${prefix}/search.sh;
}
fi;
}

function search_menu {
menuentry $"Please select the type of file you want to search:" --class search {
grubfm;
}
submenu "wim" --class wim {
search_list "wim" "wim";
}
submenu "iso" --class iso {
search_list "iso" "iso";
}
submenu "img" --class img {
search_list "img" "img";
}
submenu "vhd" --class img {
search_list "vhd" "img";
}
submenu "efi" --class exe {
search_list "efi" "exe";
}
}

search_menu;
source $prefix/global.sh;
Binary file added boot/grubfm/themes/slack/dock/search.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions boot/grubfm/themes/slack/fm.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,10 @@ terminal-box: "term_bkg_*.png"
+ image {file = "dock/logout.png"}
}
}

+ hbox {
top = 100%-21
left = 0%
+ image {file = "dock/search.png"}
+ label {text = "[F]" color = "#ffffff"}
}

0 comments on commit e4ca250

Please sign in to comment.