install-scripts/UwUify.sh
2024-05-15 10:40:30 +02:00

71 lines
1.6 KiB
Bash

#!/bin/bash
TMPDIR=/tmp/uwu/
TMPFILE="$TMPDIR/save.tmp"
WPNAME="wallpaper.jpg"
TMPWP="/tmp/uwu/$WPNAME"
WPURL="https://git.ninjdai.ynh.fr/ninjdai/install-scripts/src/branch/main/assets/$WPNAME"
function main ()
{
if [ "$EUID" -eq 0 ]
then echo -e "${C_RED}Script cannot be run as root !${NO_FORMAT}"
exit
fi
mkdir -p "$TMPDIR"
check_wget
if [ -f "$TMPFILE" ]; then
echo "$TMPFILE already exists, skipping config save..."
else
touch $TMPFILE
save_color_scheme
save_wallpaper
fi
set_color_scheme
download_wallpaper
set_wallpaper
}
check_wget ()
{
if ! command -v "wget" > /dev/null;
then
echo "wget is required to use the script"
exit
fi
}
download_wallpaper()
{
wget -q --show-progress "$WPURL" -P /tmp/uwu/
}
save_color_scheme ()
{
echo "primary-color=$(gsettings get org.gnome.desktop.background primary-color)" >> $TMPFILE
echo "secondary-color=$(gsettings get org.gnome.desktop.background secondary-color)" >> $TMPFILE
}
set_color_scheme ()
{
gsettings set org.gnome.desktop.background primary-color "#d910c5"
gsettings set org.gnome.desktop.background secondary-color "#de52d0"
}
save_wallpaper ()
{
echo "picture-uri=$(gsettings get org.gnome.desktop.background picture-uri)" >> $TMPFILE
echo "picture-uri-dark=$(gsettings get org.gnome.desktop.background picture-uri-dark)" >> $TMPFILE
}
set_wallpaper ()
{
gsettings set org.gnome.desktop.background picture-uri "file://${TMPWP}"
gsettings set org.gnome.desktop.background picture-uri-dark "file://${TMPWP}"
}
main