From b65377decf99a4d53583ceb0f277f17af1671267 Mon Sep 17 00:00:00 2001 From: Don Williams Date: Sat, 15 Aug 2026 06:20:10 -0400 Subject: Copy.sh wasn't setting LUA as default on new install Signed-off-by: Don Williams On branch development Your branch is up to date with 'origin/development'. Changes to be committed: modified: copy.sh modified: scripts/lib_copy.sh --- copy.sh | 22 ++++++------- scripts/lib_copy.sh | 93 ++++++++++++++++++++++++++++------------------------- 2 files changed, 61 insertions(+), 54 deletions(-) diff --git a/copy.sh b/copy.sh index 2145e4b7..42ebd7f6 100755 --- a/copy.sh +++ b/copy.sh @@ -257,24 +257,24 @@ version_gte() { # Parse installed Hyprland version (e.g. 0.55.4) from hyprctl/Hyprland. get_hyprland_version() { local ver="" - local raw="" + local full_output="" if command -v hyprctl >/dev/null 2>&1; then - raw="$(hyprctl version 2>/dev/null | head -n1 || true)" + full_output="$(hyprctl version 2>/dev/null || true)" fi - if [ -z "$raw" ] && command -v Hyprland >/dev/null 2>&1; then - raw="$(Hyprland --version 2>/dev/null | head -n1 || true)" + if [ -z "$full_output" ] && command -v Hyprland >/dev/null 2>&1; then + full_output="$(Hyprland --version 2>/dev/null || true)" fi - if [ -z "$raw" ] && command -v hyprland >/dev/null 2>&1; then - raw="$(hyprland --version 2>/dev/null | head -n1 || true)" + if [ -z "$full_output" ] && command -v hyprland >/dev/null 2>&1; then + full_output="$(hyprland --version 2>/dev/null || true)" fi # Prefer Tag: vX.Y.Z when present in full output - if command -v hyprctl >/dev/null 2>&1; then - ver="$(hyprctl version 2>/dev/null | sed -n 's/^Tag: v\([0-9][0-9.]*\).*/\1/p' | head -n1 || true)" - fi - if [ -z "$ver" ] && [ -n "$raw" ]; then - ver="$(printf '%s\n' "$raw" | sed -n 's/.*[Hh]yprland[[:space:]]\+v\?\([0-9][0-9.]*\).*/\1/p' | head -n1)" + ver="$(printf '%s\n' "$full_output" | sed -n 's/^Tag: v\([0-9][0-9.]*\).*/\1/p' | head -n1 || true)" + + # Fallback to matching 'Hyprland v0.X.Y' or 'Hyprland 0.X.Y' anywhere in full output + if [ -z "$ver" ] && [ -n "$full_output" ]; then + ver="$(printf '%s\n' "$full_output" | sed -n 's/.*[Hh]yprland[[:space:]]\+v\?\([0-9][0-9.]*\).*/\1/p' | head -n1 || true)" fi printf '%s' "$ver" diff --git a/scripts/lib_copy.sh b/scripts/lib_copy.sh index 8d5b5887..184381a8 100644 --- a/scripts/lib_copy.sh +++ b/scripts/lib_copy.sh @@ -269,19 +269,24 @@ restore_hypr_assets() { fi # Preserve Lua entrypoint only when the backup was already using Lua mode. - # Do not auto-enable Lua on conf-based hosts. + # Do not auto-enable or disable Lua on fresh install (handled by enable_fresh_install_lua_config). local LUA_ENTRY_TEMPLATE="$base/config/hypr/hyprland.lua" - if [ "$backup_mode" = "lua" ]; then - if [ -f "$LUA_ENTRY_TEMPLATE" ]; then - cp -f "$LUA_ENTRY_TEMPLATE" "$HYPR_DIR/hyprland.lua" 2>&1 | tee -a "$log" - echo "${OK:-[OK]} - Restored file: ${MAGENTA:-}hyprland.lua${RESET:-} (lua mode preserved from repo template)" 2>&1 | tee -a "$log" - elif [ -f "$BACKUP_HYPR_PATH/hyprland.lua" ]; then - cp -f "$BACKUP_HYPR_PATH/hyprland.lua" "$HYPR_DIR/hyprland.lua" 2>&1 | tee -a "$log" - echo "${OK:-[OK]} - Restored file: ${MAGENTA:-}hyprland.lua${RESET:-} (lua mode preserved from backup)" 2>&1 | tee -a "$log" + if [ ! -f "$LUA_ENTRY_TEMPLATE" ] && [ -f "$base/config/hypr/hyprland.lua.disable" ]; then + LUA_ENTRY_TEMPLATE="$base/config/hypr/hyprland.lua.disable" + fi + if [ "${RUN_MODE:-}" != "install" ]; then + if [ "$backup_mode" = "lua" ]; then + if [ -f "$LUA_ENTRY_TEMPLATE" ]; then + cp -f "$LUA_ENTRY_TEMPLATE" "$HYPR_DIR/hyprland.lua" 2>&1 | tee -a "$log" + echo "${OK:-[OK]} - Restored file: ${MAGENTA:-}hyprland.lua${RESET:-} (lua mode preserved from repo template)" 2>&1 | tee -a "$log" + elif [ -f "$BACKUP_HYPR_PATH/hyprland.lua" ]; then + cp -f "$BACKUP_HYPR_PATH/hyprland.lua" "$HYPR_DIR/hyprland.lua" 2>&1 | tee -a "$log" + echo "${OK:-[OK]} - Restored file: ${MAGENTA:-}hyprland.lua${RESET:-} (lua mode preserved from backup)" 2>&1 | tee -a "$log" + fi + else + rm -f "$HYPR_DIR/hyprland.lua" 2>/dev/null || true + echo "${NOTE:-[NOTE]} - Conf mode detected; skipping Lua entrypoint restore." 2>&1 | tee -a "$log" fi - else - rm -f "$HYPR_DIR/hyprland.lua" 2>/dev/null || true - echo "${NOTE:-[NOTE]} - Conf mode detected; skipping Lua entrypoint restore." 2>&1 | tee -a "$log" fi if [ "$express_mode" -eq 1 ]; then @@ -318,40 +323,42 @@ restore_hypr_assets() { fi # Keep monitor/workspace state across upgrades, including express mode. - if [ "$backup_mode" = "lua" ]; then - local LUA_USER_DIR="$HYPR_DIR/UserConfigs" - mkdir -p "$LUA_USER_DIR" - - local BACKUP_LUA_MONITORS="" - local BACKUP_LUA_WORKSPACES="" - if [ -f "$BACKUP_HYPR_PATH/UserConfigs/monitors.lua" ]; then - BACKUP_LUA_MONITORS="$BACKUP_HYPR_PATH/UserConfigs/monitors.lua" - elif [ -f "$BACKUP_HYPR_PATH/lua/monitors.lua" ]; then - BACKUP_LUA_MONITORS="$BACKUP_HYPR_PATH/lua/monitors.lua" - fi - if [ -f "$BACKUP_HYPR_PATH/UserConfigs/workspaces.lua" ]; then - BACKUP_LUA_WORKSPACES="$BACKUP_HYPR_PATH/UserConfigs/workspaces.lua" - elif [ -f "$BACKUP_HYPR_PATH/lua/workspaces.lua" ]; then - BACKUP_LUA_WORKSPACES="$BACKUP_HYPR_PATH/lua/workspaces.lua" - fi + if [ "${RUN_MODE:-}" != "install" ]; then + if [ "$backup_mode" = "lua" ]; then + local LUA_USER_DIR="$HYPR_DIR/UserConfigs" + mkdir -p "$LUA_USER_DIR" + + local BACKUP_LUA_MONITORS="" + local BACKUP_LUA_WORKSPACES="" + if [ -f "$BACKUP_HYPR_PATH/UserConfigs/monitors.lua" ]; then + BACKUP_LUA_MONITORS="$BACKUP_HYPR_PATH/UserConfigs/monitors.lua" + elif [ -f "$BACKUP_HYPR_PATH/lua/monitors.lua" ]; then + BACKUP_LUA_MONITORS="$BACKUP_HYPR_PATH/lua/monitors.lua" + fi + if [ -f "$BACKUP_HYPR_PATH/UserConfigs/workspaces.lua" ]; then + BACKUP_LUA_WORKSPACES="$BACKUP_HYPR_PATH/UserConfigs/workspaces.lua" + elif [ -f "$BACKUP_HYPR_PATH/lua/workspaces.lua" ]; then + BACKUP_LUA_WORKSPACES="$BACKUP_HYPR_PATH/lua/workspaces.lua" + fi - if [ -n "$BACKUP_LUA_MONITORS" ]; then - cp -f "$BACKUP_LUA_MONITORS" "$LUA_USER_DIR/monitors.lua" 2>&1 | tee -a "$log" - echo "${OK:-[OK]} - Restored file: ${MAGENTA:-}UserConfigs/monitors.lua${RESET:-}" 2>&1 | tee -a "$log" - fi - if [ -n "$BACKUP_LUA_WORKSPACES" ]; then - cp -f "$BACKUP_LUA_WORKSPACES" "$LUA_USER_DIR/workspaces.lua" 2>&1 | tee -a "$log" - echo "${OK:-[OK]} - Restored file: ${MAGENTA:-}UserConfigs/workspaces.lua${RESET:-}" 2>&1 | tee -a "$log" - fi - else - local FILE_B=("monitors.conf" "workspaces.conf") - for FILE_RESTORE in "${FILE_B[@]}"; do - local BACKUP_FILE="$BACKUP_HYPR_PATH/$FILE_RESTORE" - if [ -f "$BACKUP_FILE" ]; then - cp "$BACKUP_FILE" "$HYPR_DIR/$FILE_RESTORE" 2>&1 | tee -a "$log" - echo "${OK:-[OK]} - Restored file: ${MAGENTA:-}$FILE_RESTORE${RESET:-}" 2>&1 | tee -a "$log" + if [ -n "$BACKUP_LUA_MONITORS" ]; then + cp -f "$BACKUP_LUA_MONITORS" "$LUA_USER_DIR/monitors.lua" 2>&1 | tee -a "$log" + echo "${OK:-[OK]} - Restored file: ${MAGENTA:-}UserConfigs/monitors.lua${RESET:-}" 2>&1 | tee -a "$log" fi - done + if [ -n "$BACKUP_LUA_WORKSPACES" ]; then + cp -f "$BACKUP_LUA_WORKSPACES" "$LUA_USER_DIR/workspaces.lua" 2>&1 | tee -a "$log" + echo "${OK:-[OK]} - Restored file: ${MAGENTA:-}UserConfigs/workspaces.lua${RESET:-}" 2>&1 | tee -a "$log" + fi + else + local FILE_B=("monitors.conf" "workspaces.conf") + for FILE_RESTORE in "${FILE_B[@]}"; do + local BACKUP_FILE="$BACKUP_HYPR_PATH/$FILE_RESTORE" + if [ -f "$BACKUP_FILE" ]; then + cp "$BACKUP_FILE" "$HYPR_DIR/$FILE_RESTORE" 2>&1 | tee -a "$log" + echo "${OK:-[OK]} - Restored file: ${MAGENTA:-}$FILE_RESTORE${RESET:-}" 2>&1 | tee -a "$log" + fi + done + fi fi fi } -- cgit v1.2.3