diff --git a/one-button-optimizer.sh b/one-button-optimizer.sh index 894aac2..7c9c4a3 100755 --- a/one-button-optimizer.sh +++ b/one-button-optimizer.sh @@ -551,22 +551,84 @@ analyze_and_prompt() { echo " swapon --show # Check zram status" echo "" - # Check if applications are already configured for tmpfs + # Check if applications are configured for tmpfs local current_user=$(logname 2>/dev/null || echo $SUDO_USER) local user_home=$(eval echo ~$current_user) - local apps_configured=false - # Quick check if browsers are configured - if [[ -f "$user_home/.mozilla/firefox"/*default*/prefs.js ]] && \ - grep -q "tmpfs-cache" "$user_home/.mozilla/firefox"/*default*/prefs.js 2>/dev/null; then - apps_configured=true + echo "📱 Application Configuration Status:" + local configured_browsers=0 + local total_browsers=0 + + # Check each browser + if [[ -d "$user_home/.mozilla/firefox" ]]; then + ((total_browsers++)) + if grep -q "tmpfs-cache" "$user_home/.mozilla/firefox"/*default*/prefs.js 2>/dev/null; then + echo " ✅ Firefox: Configured" + ((configured_browsers++)) + else + echo " ⚠️ Firefox: Not configured" + fi fi - if [[ ! $apps_configured ]]; then - echo "📱 Application Configuration:" - echo " ⚠️ Your applications are not yet configured to use tmpfs caches" - echo "" - read -p " Would you like to automatically configure your browsers and dev tools? (y/N): " -n 1 -r + if [[ -d "$user_home/.config/BraveSoftware" ]]; then + ((total_browsers++)) + if [[ -f "$user_home/.local/share/applications/brave-browser.desktop" ]] && \ + grep -q "tmpfs-cache" "$user_home/.local/share/applications/brave-browser.desktop" 2>/dev/null; then + echo " ✅ Brave: Configured" + ((configured_browsers++)) + else + echo " ⚠️ Brave: Not configured" + fi + fi + + if [[ -d "$user_home/.config/google-chrome" ]]; then + ((total_browsers++)) + if [[ -f "$user_home/.local/share/applications/google-chrome.desktop" ]] && \ + grep -q "tmpfs-cache" "$user_home/.local/share/applications/google-chrome.desktop" 2>/dev/null; then + echo " ✅ Chrome: Configured" + ((configured_browsers++)) + else + echo " ⚠️ Chrome: Not configured" + fi + fi + + if [[ -d "$user_home/.config/chromium" ]]; then + ((total_browsers++)) + if [[ -f "$user_home/.local/share/applications/chromium-browser.desktop" ]] && \ + grep -q "tmpfs-cache" "$user_home/.local/share/applications/chromium-browser.desktop" 2>/dev/null; then + echo " ✅ Chromium: Configured" + ((configured_browsers++)) + else + echo " ⚠️ Chromium: Not configured" + fi + fi + + # Check dev tools + local npm_configured=false + if command -v npm &>/dev/null; then + local npm_cache=$(sudo -u $current_user npm config get cache 2>/dev/null) + if [[ "$npm_cache" == *"tmpfs-cache"* ]]; then + echo " ✅ NPM: Configured" + npm_configured=true + else + echo " ⚠️ NPM: Not configured" + fi + fi + + local pip_configured=false + if command -v pip3 &>/dev/null || command -v pip &>/dev/null; then + if [[ -f "$user_home/.config/pip/pip.conf" ]] && \ + grep -q "tmpfs-cache" "$user_home/.config/pip/pip.conf" 2>/dev/null; then + echo " ✅ Pip: Configured" + pip_configured=true + else + echo " ⚠️ Pip: Not configured" + fi + fi + + echo "" + if [[ $configured_browsers -lt $total_browsers ]] || [[ $npm_configured == false ]] || [[ $pip_configured == false ]]; then + read -p " Would you like to configure/reconfigure your applications? (y/N): " -n 1 -r echo if [[ $REPLY =~ ^[Yy]$ ]]; then echo ""