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"
|
||||
}
|
||||
|
||||
# --- Step 08: Dark theme (GTK) ---
|
||||
# --- Step 08: Dark theme (GTK + taskbar) ---
|
||||
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"
|
||||
mkdir -p "$(dirname "$GTK_SETTINGS")"
|
||||
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
|
||||
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
|
||||
log "Set dark theme ($GTK_THEME_NAME) in gtk-3.0/settings.ini"
|
||||
chown -R "$PI_USER:$PI_USER" "$PI_HOME/.config"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user