forked from Shinonome/dots-hyprland
Refactor: consistently use temporary files and mv (atomic operation)
This commit is contained in:
@@ -27,7 +27,7 @@ kill_existing_mpvpaper() {
|
|||||||
create_restore_script() {
|
create_restore_script() {
|
||||||
local video_path=$1
|
local video_path=$1
|
||||||
|
|
||||||
cat > "$RESTORE_SCRIPT" << EOF
|
cat > "$RESTORE_SCRIPT.tmp" << EOF
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Generated by switchwall.sh - Don't modify it by yourself.
|
# Generated by switchwall.sh - Don't modify it by yourself.
|
||||||
# Time: $(date)
|
# Time: $(date)
|
||||||
@@ -40,6 +40,7 @@ for monitor in \$(hyprctl monitors -j | jq -r '.[] | .name'); do
|
|||||||
done
|
done
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
mv "$RESTORE_SCRIPT.tmp" $RESTORE_SCRIPT
|
||||||
chmod +x "$RESTORE_SCRIPT"
|
chmod +x "$RESTORE_SCRIPT"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user