This commit is contained in:
vinceliuice
2024-10-24 13:41:05 +08:00
parent 0a1f5d0ebd
commit 3a24624d04
10 changed files with 63 additions and 61 deletions

View File

@@ -4,8 +4,14 @@ readonly ROOT_UID=0
readonly MAX_DELAY=20 # max delay for user to enter root password
REPO_DIR="$(cd "$(dirname "$0")" && pwd)"
BACKGROUND_DIR="/usr/share/backgrounds"
PROPERTIES_DIR="/usr/share/gnome-background-properties"
if [[ "$UID" -eq "$ROOT_UID" ]]; then
BACKGROUND_DIR="/usr/share/backgrounds"
PROPERTIES_DIR="/usr/share/gnome-background-properties"
else
BACKGROUND_DIR="$HOME/.local/share/backgrounds"
PROPERTIES_DIR="$HOME/.local/share/gnome-background-properties"
fi
THEME_VARIANTS=('WhiteSur' 'Monterey' 'Ventura' 'Sonoma')
SCREEN_VARIANTS=('1080p' '2k' '4k')
@@ -72,6 +78,9 @@ install() {
cp -a --no-preserve=ownership ${REPO_DIR}/xml-files/timed-xml-files/${theme}-timed.xml ${BACKGROUND_DIR}/${theme}
cp -a --no-preserve=ownership ${REPO_DIR}/xml-files/gnome-background-properties/${theme}.xml ${PROPERTIES_DIR}
sed -i "s/@BACKGROUNDDIR@/$(printf '%s\n' "${BACKGROUND_DIR}" | sed 's/[\/&]/\\&/g')/g" "${BACKGROUND_DIR}/${theme}/${theme}-timed.xml"
sed -i "s/@BACKGROUNDDIR@/$(printf '%s\n' "${BACKGROUND_DIR}" | sed 's/[\/&]/\\&/g')/g" "${PROPERTIES_DIR}/${theme}.xml"
}
uninstall() {
@@ -195,13 +204,6 @@ uninstall_wallpaper() {
echo
}
if [[ $UID -ne $ROOT_UID ]]; then
echo
prompt -e "ERROR: Need root access! please run this script with sudo."
echo
exit 1
fi
if [[ "${uninstall}" != 'true' ]]; then
install_wallpaper && install_nord_wallpaper
else

View File

@@ -3,8 +3,8 @@
<wallpapers>
<wallpaper deleted="false">
<name>Mojave Nord Background</name>
<filename>/usr/share/backgrounds/Wallpaper-nord/Mojave-nord-light.png</filename>
<filename-dark>/usr/share/backgrounds/Wallpaper-nord/Mojave-nord-dark.png</filename-dark>
<filename>@BACKGROUNDDIR@/Wallpaper-nord/Mojave-nord-light.png</filename>
<filename-dark>@BACKGROUNDDIR@/Wallpaper-nord/Mojave-nord-dark.png</filename-dark>
<options>zoom</options>
<shade_type>solid</shade_type>
<pcolor>#3071AE</pcolor>

View File

@@ -3,8 +3,8 @@
<wallpapers>
<wallpaper deleted="false">
<name>Monterey Background</name>
<filename>/usr/share/backgrounds/Monterey/Monterey-light.jpg</filename>
<filename-dark>/usr/share/backgrounds/Monterey/Monterey.jpg</filename-dark>
<filename>@BACKGROUNDDIR@/Monterey/Monterey-light.jpg</filename>
<filename-dark>@BACKGROUNDDIR@/Monterey/Monterey.jpg</filename-dark>
<options>zoom</options>
<shade_type>solid</shade_type>
<pcolor>#51a2da</pcolor>
@@ -13,7 +13,7 @@
<wallpaper deleted="false">
<name>Monterey Time of Day</name>
<filename>/usr/share/backgrounds/Monterey/Monterey-timed.xml</filename>
<filename>@BACKGROUNDDIR@/Monterey/Monterey-timed.xml</filename>
<options>zoom</options>
<shade_type>solid</shade_type>
<pcolor>#ffffff</pcolor>

View File

@@ -3,8 +3,8 @@
<wallpapers>
<wallpaper deleted="false">
<name>Sonoma Background</name>
<filename>/usr/share/backgrounds/Sonoma/Sonoma-light.jpg</filename>
<filename-dark>/usr/share/backgrounds/Sonoma/Sonoma-dark.jpg</filename-dark>
<filename>@BACKGROUNDDIR@/Sonoma/Sonoma-light.jpg</filename>
<filename-dark>@BACKGROUNDDIR@/Sonoma/Sonoma-dark.jpg</filename-dark>
<options>zoom</options>
<shade_type>solid</shade_type>
<pcolor>#51a2da</pcolor>
@@ -13,7 +13,7 @@
<wallpaper deleted="false">
<name>Sonoma Time of Day</name>
<filename>/usr/share/backgrounds/Sonoma/Sonoma-timed.xml</filename>
<filename>@BACKGROUNDDIR@/Sonoma/Sonoma-timed.xml</filename>
<options>zoom</options>
<shade_type>solid</shade_type>
<pcolor>#ffffff</pcolor>

View File

@@ -3,8 +3,8 @@
<wallpapers>
<wallpaper deleted="false">
<name>Ventura Background</name>
<filename>/usr/share/backgrounds/Ventura/Ventura-light.jpg</filename>
<filename-dark>/usr/share/backgrounds/Ventura/Ventura-dark.jpg</filename-dark>
<filename>@BACKGROUNDDIR@/Ventura/Ventura-light.jpg</filename>
<filename-dark>@BACKGROUNDDIR@/Ventura/Ventura-dark.jpg</filename-dark>
<options>zoom</options>
<shade_type>solid</shade_type>
<pcolor>#51a2da</pcolor>
@@ -13,7 +13,7 @@
<wallpaper deleted="false">
<name>Ventura Time of Day</name>
<filename>/usr/share/backgrounds/Ventura/Ventura-timed.xml</filename>
<filename>@BACKGROUNDDIR@/Ventura/Ventura-timed.xml</filename>
<options>zoom</options>
<shade_type>solid</shade_type>
<pcolor>#ffffff</pcolor>

View File

@@ -3,8 +3,8 @@
<wallpapers>
<wallpaper deleted="false">
<name>WhiteSur Background</name>
<filename>/usr/share/backgrounds/WhiteSur/WhiteSur-light.jpg</filename>
<filename-dark>/usr/share/backgrounds/WhiteSur/WhiteSur.jpg</filename-dark>
<filename>@BACKGROUNDDIR@/WhiteSur/WhiteSur-light.jpg</filename>
<filename-dark>@BACKGROUNDDIR@/WhiteSur/WhiteSur.jpg</filename-dark>
<options>zoom</options>
<shade_type>solid</shade_type>
<pcolor>#51a2da</pcolor>
@@ -13,8 +13,8 @@
<wallpaper deleted="false">
<name>WhiteSur Nord Background</name>
<filename>/usr/share/backgrounds/Wallpaper-nord/WhiteSur-nord-light.png</filename>
<filename-dark>/usr/share/backgrounds/Wallpaper-nord/WhiteSur-nord-dark.png</filename-dark>
<filename>@BACKGROUNDDIR@/Wallpaper-nord/WhiteSur-nord-light.png</filename>
<filename-dark>@BACKGROUNDDIR@/Wallpaper-nord/WhiteSur-nord-dark.png</filename-dark>
<options>zoom</options>
<shade_type>solid</shade_type>
<pcolor>#6882b3</pcolor>
@@ -23,7 +23,7 @@
<wallpaper deleted="false">
<name>WhiteSur Time of Day</name>
<filename>/usr/share/backgrounds/WhiteSur/WhiteSur-timed.xml</filename>
<filename>@BACKGROUNDDIR@/WhiteSur/WhiteSur-timed.xml</filename>
<options>zoom</options>
<shade_type>solid</shade_type>
<pcolor>#ffffff</pcolor>

View File

@@ -13,39 +13,39 @@
<!-- We start with sunrise at 7 AM. It will remain up for 1 hour. -->
<static>
<duration>3600.0</duration>
<file>/usr/share/backgrounds/Monterey/Monterey-morning.jpg</file>
<file>@BACKGROUNDDIR@/Monterey/Monterey-morning.jpg</file>
</static>
<!-- Sunrise starts to transition to day at 8 AM. The transition lasts for 5 hours, ending at 1 PM. -->
<transition type="overlay">
<duration>18000.0</duration>
<from>/usr/share/backgrounds/Monterey/Monterey-morning.jpg</from>
<to>/usr/share/backgrounds/Monterey/Monterey-light.jpg</to>
<from>@BACKGROUNDDIR@/Monterey/Monterey-morning.jpg</from>
<to>@BACKGROUNDDIR@/Monterey/Monterey-light.jpg</to>
</transition>
<!-- It's 1 PM, we're showing the day image in full force now, for 5 hours ending at 6 PM. -->
<static>
<duration>18000.0</duration>
<file>/usr/share/backgrounds/Monterey/Monterey-light.jpg</file>
<file>@BACKGROUNDDIR@/Monterey/Monterey-light.jpg</file>
</static>
<!-- It's 7 PM and it's going to start to get darker. This will transition for 6 hours up until midnight. -->
<transition type="overlay">
<duration>21600.0</duration>
<from>/usr/share/backgrounds/Monterey/Monterey-light.jpg</from>
<to>/usr/share/backgrounds/Monterey/Monterey.jpg</to>
<from>@BACKGROUNDDIR@/Monterey/Monterey-light.jpg</from>
<to>@BACKGROUNDDIR@/Monterey/Monterey.jpg</to>
</transition>
<!-- It's midnight. It'll stay dark for 5 hours up until 5 AM. -->
<static>
<duration>18000.0</duration>
<file>/usr/share/backgrounds/Monterey/Monterey.jpg</file>
<file>@BACKGROUNDDIR@/Monterey/Monterey.jpg</file>
</static>
<!-- It's 5 AM. We'll start transitioning to sunrise for 2 hours up until 7 AM. -->
<transition type="overlay">
<duration>7200.0</duration>
<from>/usr/share/backgrounds/Monterey/Monterey.jpg</from>
<to>/usr/share/backgrounds/Monterey/Monterey-morning.jpg</to>
<from>@BACKGROUNDDIR@/Monterey/Monterey.jpg</from>
<to>@BACKGROUNDDIR@/Monterey/Monterey-morning.jpg</to>
</transition>
</background>

View File

@@ -13,39 +13,39 @@
<!-- We start with sunrise at 7 AM. It will remain up for 1 hour. -->
<static>
<duration>3600.0</duration>
<file>/usr/share/backgrounds/Sonoma/Sonoma-light.jpg</file>
<file>@BACKGROUNDDIR@/Sonoma/Sonoma-light.jpg</file>
</static>
<!-- Sunrise starts to transition to day at 8 AM. The transition lasts for 5 hours, ending at 1 PM. -->
<transition type="overlay">
<duration>18000.0</duration>
<from>/usr/share/backgrounds/Sonoma/Sonoma-light.jpg</from>
<to>/usr/share/backgrounds/Sonoma/Sonoma-light.jpg</to>
<from>@BACKGROUNDDIR@/Sonoma/Sonoma-light.jpg</from>
<to>@BACKGROUNDDIR@/Sonoma/Sonoma-light.jpg</to>
</transition>
<!-- It's 1 PM, we're showing the day image in full force now, for 5 hours ending at 6 PM. -->
<static>
<duration>18000.0</duration>
<file>/usr/share/backgrounds/Sonoma/Sonoma-light.jpg</file>
<file>@BACKGROUNDDIR@/Sonoma/Sonoma-light.jpg</file>
</static>
<!-- It's 7 PM and it's going to start to get darker. This will transition for 6 hours up until midnight. -->
<transition type="overlay">
<duration>21600.0</duration>
<from>/usr/share/backgrounds/Sonoma/Sonoma-light.jpg</from>
<to>/usr/share/backgrounds/Sonoma/Sonoma-dark.jpg</to>
<from>@BACKGROUNDDIR@/Sonoma/Sonoma-light.jpg</from>
<to>@BACKGROUNDDIR@/Sonoma/Sonoma-dark.jpg</to>
</transition>
<!-- It's midnight. It'll stay dark for 5 hours up until 5 AM. -->
<static>
<duration>18000.0</duration>
<file>/usr/share/backgrounds/Sonoma/Sonoma-dark.jpg</file>
<file>@BACKGROUNDDIR@/Sonoma/Sonoma-dark.jpg</file>
</static>
<!-- It's 5 AM. We'll start transitioning to sunrise for 2 hours up until 7 AM. -->
<transition type="overlay">
<duration>7200.0</duration>
<from>/usr/share/backgrounds/Sonoma/Sonoma-dark.jpg</from>
<to>/usr/share/backgrounds/Sonoma/Sonoma-light.jpg</to>
<from>@BACKGROUNDDIR@/Sonoma/Sonoma-dark.jpg</from>
<to>@BACKGROUNDDIR@/Sonoma/Sonoma-light.jpg</to>
</transition>
</background>

View File

@@ -13,39 +13,39 @@
<!-- We start with sunrise at 7 AM. It will remain up for 1 hour. -->
<static>
<duration>3600.0</duration>
<file>/usr/share/backgrounds/Ventura/Ventura-light.jpg</file>
<file>@BACKGROUNDDIR@/Ventura/Ventura-light.jpg</file>
</static>
<!-- Sunrise starts to transition to day at 8 AM. The transition lasts for 5 hours, ending at 1 PM. -->
<transition type="overlay">
<duration>18000.0</duration>
<from>/usr/share/backgrounds/Ventura/Ventura-light.jpg</from>
<to>/usr/share/backgrounds/Ventura/Ventura-light.jpg</to>
<from>@BACKGROUNDDIR@/Ventura/Ventura-light.jpg</from>
<to>@BACKGROUNDDIR@/Ventura/Ventura-light.jpg</to>
</transition>
<!-- It's 1 PM, we're showing the day image in full force now, for 5 hours ending at 6 PM. -->
<static>
<duration>18000.0</duration>
<file>/usr/share/backgrounds/Ventura/Ventura-light.jpg</file>
<file>@BACKGROUNDDIR@/Ventura/Ventura-light.jpg</file>
</static>
<!-- It's 7 PM and it's going to start to get darker. This will transition for 6 hours up until midnight. -->
<transition type="overlay">
<duration>21600.0</duration>
<from>/usr/share/backgrounds/Ventura/Ventura-light.jpg</from>
<to>/usr/share/backgrounds/Ventura/Ventura-dark.jpg</to>
<from>@BACKGROUNDDIR@/Ventura/Ventura-light.jpg</from>
<to>@BACKGROUNDDIR@/Ventura/Ventura-dark.jpg</to>
</transition>
<!-- It's midnight. It'll stay dark for 5 hours up until 5 AM. -->
<static>
<duration>18000.0</duration>
<file>/usr/share/backgrounds/Ventura/Ventura-dark.jpg</file>
<file>@BACKGROUNDDIR@/Ventura/Ventura-dark.jpg</file>
</static>
<!-- It's 5 AM. We'll start transitioning to sunrise for 2 hours up until 7 AM. -->
<transition type="overlay">
<duration>7200.0</duration>
<from>/usr/share/backgrounds/Ventura/Ventura-dark.jpg</from>
<to>/usr/share/backgrounds/Ventura/Ventura-light.jpg</to>
<from>@BACKGROUNDDIR@/Ventura/Ventura-dark.jpg</from>
<to>@BACKGROUNDDIR@/Ventura/Ventura-light.jpg</to>
</transition>
</background>

View File

@@ -13,39 +13,39 @@
<!-- We start with sunrise at 7 AM. It will remain up for 1 hour. -->
<static>
<duration>3600.0</duration>
<file>/usr/share/backgrounds/WhiteSur/WhiteSur-morning.jpg</file>
<file>@BACKGROUNDDIR@/WhiteSur/WhiteSur-morning.jpg</file>
</static>
<!-- Sunrise starts to transition to day at 8 AM. The transition lasts for 5 hours, ending at 1 PM. -->
<transition type="overlay">
<duration>18000.0</duration>
<from>/usr/share/backgrounds/WhiteSur/WhiteSur-morning.jpg</from>
<to>/usr/share/backgrounds/WhiteSur/WhiteSur-light.jpg</to>
<from>@BACKGROUNDDIR@/WhiteSur/WhiteSur-morning.jpg</from>
<to>@BACKGROUNDDIR@/WhiteSur/WhiteSur-light.jpg</to>
</transition>
<!-- It's 1 PM, we're showing the day image in full force now, for 5 hours ending at 6 PM. -->
<static>
<duration>18000.0</duration>
<file>/usr/share/backgrounds/WhiteSur/WhiteSur-light.jpg</file>
<file>@BACKGROUNDDIR@/WhiteSur/WhiteSur-light.jpg</file>
</static>
<!-- It's 7 PM and it's going to start to get darker. This will transition for 6 hours up until midnight. -->
<transition type="overlay">
<duration>21600.0</duration>
<from>/usr/share/backgrounds/WhiteSur/WhiteSur-light.jpg</from>
<to>/usr/share/backgrounds/WhiteSur/WhiteSur.jpg</to>
<from>@BACKGROUNDDIR@/WhiteSur/WhiteSur-light.jpg</from>
<to>@BACKGROUNDDIR@/WhiteSur/WhiteSur.jpg</to>
</transition>
<!-- It's midnight. It'll stay dark for 5 hours up until 5 AM. -->
<static>
<duration>18000.0</duration>
<file>/usr/share/backgrounds/WhiteSur/WhiteSur.jpg</file>
<file>@BACKGROUNDDIR@/WhiteSur/WhiteSur.jpg</file>
</static>
<!-- It's 5 AM. We'll start transitioning to sunrise for 2 hours up until 7 AM. -->
<transition type="overlay">
<duration>7200.0</duration>
<from>/usr/share/backgrounds/WhiteSur/WhiteSur.jpg</from>
<to>/usr/share/backgrounds/WhiteSur/WhiteSur-morning.jpg</to>
<from>@BACKGROUNDDIR@/WhiteSur/WhiteSur.jpg</from>
<to>@BACKGROUNDDIR@/WhiteSur/WhiteSur-morning.jpg</to>
</transition>
</background>