From 8e5b6e803619c2665c18d69d06bc45968f5ab3a5 Mon Sep 17 00:00:00 2001 From: mindesbunister Date: Mon, 6 Oct 2025 09:37:14 +0200 Subject: [PATCH] Show detailed per-application configuration status MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Replace simple yes/no check with detailed per-app status display - Show configuration status for each detected browser individually - Display Firefox, Brave, Chrome, Chromium status separately - Show NPM and Pip configuration status - Always show status even when apps are configured - Allow reconfiguration even if some apps are already set up - Count configured vs total browsers for smart prompting Output example: 📱 Application Configuration Status: ✅ Firefox: Configured ⚠️ Brave: Not configured ✅ Chromium: Configured ⚠️ NPM: Not configured Benefits: - Users can see exactly which apps are configured - Easy to identify missing configurations - Can reconfigure specific apps without full reset - More transparent and informative --- one-button-optimizer.sh | 84 +++++++++++++++++++++++++++++++++++------ 1 file changed, 73 insertions(+), 11 deletions(-) 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 ""