mirror of
https://github.com/alvinlollo/Single-install-script.git
synced 2026-07-14 10:42:01 +10:00
Fix monitor patch
This commit is contained in:
+11
-9
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user