mirror of
https://github.com/tw93/Mole.git
synced 2026-02-15 22:41:10 +00:00
Menu effect optimization
This commit is contained in:
@@ -288,6 +288,8 @@ read_key() {
|
||||
'q' | 'Q') echo "QUIT" ;;
|
||||
'h' | 'H') echo "HELP" ;;
|
||||
'v' | 'V') echo "VERSION" ;;
|
||||
't' | 'T') echo "TOUCHID" ;;
|
||||
'u' | 'U') echo "UPDATE" ;;
|
||||
'R') echo "RETRY" ;;
|
||||
'o' | 'O') echo "OPEN" ;;
|
||||
'/') echo "FILTER" ;;
|
||||
|
||||
26
mole
26
mole
@@ -25,6 +25,12 @@ source "$SCRIPT_DIR/lib/common.sh"
|
||||
VERSION="1.10.1"
|
||||
MOLE_TAGLINE="can dig deep to clean your Mac."
|
||||
|
||||
# Check if Touch ID is already configured
|
||||
is_touchid_configured() {
|
||||
local pam_sudo_file="/etc/pam.d/sudo"
|
||||
[[ -f "$pam_sudo_file" ]] && grep -q "pam_tid.so" "$pam_sudo_file" 2> /dev/null
|
||||
}
|
||||
|
||||
# Get latest version from remote repository
|
||||
get_latest_version() {
|
||||
curl -fsSL --connect-timeout 2 --max-time 3 -H "Cache-Control: no-cache" \
|
||||
@@ -508,7 +514,15 @@ show_main_menu() {
|
||||
|
||||
if [[ -t 0 ]]; then
|
||||
printf '\r\033[2K\n'
|
||||
printf '\r\033[2K%s\n' "${GRAY}↑↓ | Enter | H Help | V Version | Q Quit${NC}"
|
||||
# Show TouchID if not configured, otherwise show Update
|
||||
local controls="${GRAY}↑↓ | Enter | H Help | "
|
||||
if ! is_touchid_configured; then
|
||||
controls="${controls}T TouchID"
|
||||
else
|
||||
controls="${controls}U Update"
|
||||
fi
|
||||
controls="${controls} | Q Quit${NC}"
|
||||
printf '\r\033[2K%s\n' "$controls"
|
||||
printf '\r\033[2K\n'
|
||||
fi
|
||||
|
||||
@@ -611,6 +625,16 @@ interactive_main_menu() {
|
||||
show_version
|
||||
exit 0
|
||||
;;
|
||||
"TOUCHID")
|
||||
show_cursor
|
||||
exec "$SCRIPT_DIR/bin/touchid.sh"
|
||||
;;
|
||||
"UPDATE")
|
||||
show_cursor
|
||||
clear
|
||||
update_mole
|
||||
exit 0
|
||||
;;
|
||||
"QUIT") cleanup_and_exit ;;
|
||||
esac
|
||||
|
||||
|
||||
Reference in New Issue
Block a user