Enhance first-boot script to support dynamic dark theme selection and taskbar configuration</message>
<message>Update the first-boot.sh script to dynamically select a dark theme based on the availability of PiXnoir or Adwaita-dark. Implement functionality to deploy a dark-themed taskbar configuration for wf-panel-pi, ensuring a cohesive user interface. Additionally, improve logging for theme settings and taskbar installations, enhancing the overall user experience during the first boot process.
This commit is contained in:
@@ -267,17 +267,38 @@ step_07_maliit() {
|
|||||||
curl -fsSL "${FILE_SERVER}/maliit-keyboard.desktop" -o "$AUTOSTART/maliit-keyboard.desktop" 2>/dev/null && log "maliit-keyboard.desktop installed" || log "WARNING: Could not download maliit-keyboard.desktop"
|
curl -fsSL "${FILE_SERVER}/maliit-keyboard.desktop" -o "$AUTOSTART/maliit-keyboard.desktop" 2>/dev/null && log "maliit-keyboard.desktop installed" || log "WARNING: Could not download maliit-keyboard.desktop"
|
||||||
}
|
}
|
||||||
|
|
||||||
# --- Step 08: Dark theme (GTK) ---
|
# --- Step 08: Dark theme (GTK + taskbar) ---
|
||||||
step_08_dark_theme() {
|
step_08_dark_theme() {
|
||||||
|
# Use Adwaita-dark if PiXnoir is not installed (e.g. some Raspberry Pi OS images)
|
||||||
|
local theme_name="$GTK_THEME_NAME"
|
||||||
|
if [[ ! -d "/usr/share/themes/${theme_name}" ]]; then
|
||||||
|
if [[ -d /usr/share/themes/Adwaita-dark ]]; then
|
||||||
|
theme_name="Adwaita-dark"
|
||||||
|
log "PiXnoir not found; using Adwaita-dark for dark theme"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
GTK_SETTINGS="$PI_HOME/.config/gtk-3.0/settings.ini"
|
GTK_SETTINGS="$PI_HOME/.config/gtk-3.0/settings.ini"
|
||||||
mkdir -p "$(dirname "$GTK_SETTINGS")"
|
mkdir -p "$(dirname "$GTK_SETTINGS")"
|
||||||
if [[ ! -f "$GTK_SETTINGS" ]]; then
|
if [[ ! -f "$GTK_SETTINGS" ]]; then
|
||||||
printf '%s\n' '[Settings]' 'gtk-application-prefer-dark-theme=1' "gtk-theme-name=$GTK_THEME_NAME" > "$GTK_SETTINGS"
|
printf '%s\n' '[Settings]' 'gtk-application-prefer-dark-theme=1' "gtk-theme-name=$theme_name" > "$GTK_SETTINGS"
|
||||||
else
|
else
|
||||||
grep -q '^gtk-application-prefer-dark-theme=' "$GTK_SETTINGS" && sed -i 's/^gtk-application-prefer-dark-theme=.*/gtk-application-prefer-dark-theme=1/' "$GTK_SETTINGS" || echo 'gtk-application-prefer-dark-theme=1' >> "$GTK_SETTINGS"
|
grep -q '^gtk-application-prefer-dark-theme=' "$GTK_SETTINGS" && sed -i 's/^gtk-application-prefer-dark-theme=.*/gtk-application-prefer-dark-theme=1/' "$GTK_SETTINGS" || echo 'gtk-application-prefer-dark-theme=1' >> "$GTK_SETTINGS"
|
||||||
grep -q '^gtk-theme-name=' "$GTK_SETTINGS" && sed -i "s/^gtk-theme-name=.*/gtk-theme-name=$GTK_THEME_NAME/" "$GTK_SETTINGS" || echo "gtk-theme-name=$GTK_THEME_NAME" >> "$GTK_SETTINGS"
|
grep -q '^gtk-theme-name=' "$GTK_SETTINGS" && sed -i "s/^gtk-theme-name=.*/gtk-theme-name=$theme_name/" "$GTK_SETTINGS" || echo "gtk-theme-name=$theme_name" >> "$GTK_SETTINGS"
|
||||||
|
fi
|
||||||
|
log "Set dark theme ($theme_name) in gtk-3.0/settings.ini"
|
||||||
|
# Deploy dark taskbar (wf-panel-pi) so panel is dark and matches theme
|
||||||
|
local panel_conf="$PI_HOME/.config/wf-panel-pi"
|
||||||
|
mkdir -p "$panel_conf"
|
||||||
|
if curl -fsSL "${FILE_SERVER}/wf-panel-pi.ini" -o "$panel_conf/wf-panel-pi.ini" 2>/dev/null; then
|
||||||
|
sed -i "s|/home/pi|$PI_HOME|g" "$panel_conf/wf-panel-pi.ini"
|
||||||
|
if curl -fsSL "${FILE_SERVER}/panel-theme.css" -o "$panel_conf/panel-theme.css" 2>/dev/null; then
|
||||||
|
log "Taskbar theme (wf-panel-pi.ini, panel-theme.css) installed"
|
||||||
|
else
|
||||||
|
log "WARNING: Could not download panel-theme.css"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
log "WARNING: Could not download wf-panel-pi.ini (taskbar will use defaults)"
|
||||||
fi
|
fi
|
||||||
log "Set dark theme ($GTK_THEME_NAME) in gtk-3.0/settings.ini"
|
|
||||||
chown -R "$PI_USER:$PI_USER" "$PI_HOME/.config"
|
chown -R "$PI_USER:$PI_USER" "$PI_HOME/.config"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# Revision: 2
|
# Revision: 2
|
||||||
# Start Chromium in app mode. Optional env vars:
|
# Start Chromium in app mode. Optional env vars:
|
||||||
# CHROMIUM_APP_URL - URL to open (default: http://127.0.0.1:8080)
|
# CHROMIUM_APP_URL - URL to open (default: http://127.0.0.1:8080)
|
||||||
# CHROMIUM_MODE - "fullscreen" or "kiosk" (default: fullscreen)
|
# CHROMIUM_MODE - "kiosk" (default, fills whole screen) or "fullscreen"
|
||||||
#
|
#
|
||||||
# Touch long-press → right-click: In Chromium on Wayland, long-press often does *not*
|
# Touch long-press → right-click: In Chromium on Wayland, long-press often does *not*
|
||||||
# open the context menu (Chromium handles touch itself). Elsewhere (e.g. desktop) it may
|
# open the context menu (Chromium handles touch itself). Elsewhere (e.g. desktop) it may
|
||||||
@@ -26,8 +26,8 @@ done
|
|||||||
#CHROMIUM_APP_URL="${CHROMIUM_APP_URL:-http://127.0.0.1:8080}"
|
#CHROMIUM_APP_URL="${CHROMIUM_APP_URL:-http://127.0.0.1:8080}"
|
||||||
CHROMIUM_APP_URL="${CHROMIUM_APP_URL:-https://tototheo.com}"
|
CHROMIUM_APP_URL="${CHROMIUM_APP_URL:-https://tototheo.com}"
|
||||||
|
|
||||||
# Mode: "fullscreen" or "kiosk"
|
# Mode: "kiosk" (fills whole screen, no taskbar gap) or "fullscreen"
|
||||||
CHROMIUM_MODE="${CHROMIUM_MODE:-fullscreen}"
|
CHROMIUM_MODE="${CHROMIUM_MODE:-kiosk}"
|
||||||
|
|
||||||
CHROMIUM_OPTS="--noerrdialogs --disable-infobars --disable-session-crashed-bubble --disable-restore-session-state --no-first-run --password-store=basic --use-mock-keychain --ozone-platform=wayland --enable-features=WaylandWindowDecorations --disable-features=UseChromeOSDirectVideoDecoder --app=${CHROMIUM_APP_URL}"
|
CHROMIUM_OPTS="--noerrdialogs --disable-infobars --disable-session-crashed-bubble --disable-restore-session-state --no-first-run --password-store=basic --use-mock-keychain --ozone-platform=wayland --enable-features=WaylandWindowDecorations --disable-features=UseChromeOSDirectVideoDecoder --app=${CHROMIUM_APP_URL}"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user