Fix monitor patch

This commit is contained in:
alvinlollo
2026-06-20 23:19:12 +10:00
parent 8d0f64d305
commit fcd61b1ee9
+11 -9
View File
@@ -16,26 +16,28 @@ if [ ! -f "$MAIN_LUA" ]; then
exit 1 exit 1
fi fi
# Create a backup # Create a backup (only if none exists)
cp "$MAIN_LUA" "$MAIN_LUA.bak" if [ ! -f "$MAIN_LUA.bak" ]; then
echo "Backup saved: $MAIN_LUA.bak" cp "$MAIN_LUA" "$MAIN_LUA.bak"
echo "Backup saved: $MAIN_LUA.bak"
fi
patched=0 patched=0
# Fix monitors section # Fix monitors
if grep -q '^if is_file_exists(HOME .. "/.config/hypr/monitors.lua") then' "$MAIN_LUA" && \ if grep -q 'require("monitors")' "$MAIN_LUA" && \
! grep -q 'package.loaded\["monitors"\]' "$MAIN_LUA"; then ! grep -q 'package.loaded\["monitors"\]' "$MAIN_LUA"; then
sed -i '/^if is_file_exists(HOME .. "\/.config\/hypr\/monitors.lua") then$/a\ package.loaded["monitors"] = nil' "$MAIN_LUA" sed -i 's/^\s*--\s*require("monitors")/package.loaded["monitors"] = nil\nrequire("monitors")/' "$MAIN_LUA"
echo "Patched: monitors.lua require() cache cleared" echo "Patched: monitors.lua require() cache cleared"
patched=1 patched=1
else else
echo "Skipped monitors: already patched or not found" echo "Skipped monitors: already patched or not found"
fi fi
# Fix workspaces section # Fix workspaces
if grep -q '^if is_file_exists(HOME .. "/.config/hypr/workspaces.lua") then' "$MAIN_LUA" && \ if grep -q 'require("workspaces")' "$MAIN_LUA" && \
! grep -q 'package.loaded\["workspaces"\]' "$MAIN_LUA"; then ! grep -q 'package.loaded\["workspaces"\]' "$MAIN_LUA"; then
sed -i '/^if is_file_exists(HOME .. "\/.config\/hypr\/workspaces.lua") then$/a\ package.loaded["workspaces"] = nil' "$MAIN_LUA" sed -i 's/^\s*--\s*require("workspaces")/package.loaded["workspaces"] = nil\nrequire("workspaces")/' "$MAIN_LUA"
echo "Patched: workspaces.lua require() cache cleared" echo "Patched: workspaces.lua require() cache cleared"
patched=1 patched=1
else else