hyprland-dotfiles/sddm/scripts/wallpaper.sh

39 lines
1.5 KiB
Bash
Raw Normal View History

2023-11-10 21:12:15 +00:00
#!/bin/bash
# _ _ _ _ _ _
# | | | |_ __ __| | __ _| |_ ___ ___ __| | __| |_ __ ___
# | | | | '_ \ / _` |/ _` | __/ _ \ / __|/ _` |/ _` | '_ ` _ \
# | |_| | |_) | (_| | (_| | || __/ \__ \ (_| | (_| | | | | | |
# \___/| .__/ \__,_|\__,_|\__\___| |___/\__,_|\__,_|_| |_| |_|
# |_|
#
2024-02-19 17:14:24 +00:00
# by Stephan Raabe (2024)
2023-11-10 21:12:15 +00:00
# -----------------------------------------------------
2023-12-21 10:05:20 +00:00
cache_file="$HOME/.cache/current_wallpaper"
2024-02-19 17:14:24 +00:00
sleep 1
2023-11-10 21:12:15 +00:00
clear
2024-02-19 20:32:23 +00:00
figlet "Set Wallpaper"
2024-02-19 17:14:24 +00:00
echo
echo "Set the current wallpaper as SDDM wallpaper."
echo
2023-11-10 21:12:15 +00:00
if [ ! -d /etc/sddm.conf.d/ ]; then
sudo mkdir /etc/sddm.conf.d
echo "Folder /etc/sddm.conf.d created."
fi
2024-02-19 20:32:23 +00:00
sudo cp $HOME/dotfiles/sddm/sddm.conf /etc/sddm.conf.d/
2023-11-10 21:12:15 +00:00
echo "File /etc/sddm.conf.d/sddm.conf updated."
2023-12-21 10:05:20 +00:00
current_wallpaper=$(cat "$cache_file")
extension="${current_wallpaper##*.}"
2023-11-10 21:12:15 +00:00
2023-12-21 10:05:20 +00:00
sudo cp $current_wallpaper /usr/share/sddm/themes/sugar-candy/Backgrounds/current_wallpaper.$extension
echo "Current wallpaper copied into /usr/share/sddm/themes/sugar-candy/Backgrounds/"
new_wall=$(echo $current_wallpaper | sed "s|$HOME/wallpaper/||g")
2024-02-19 17:14:24 +00:00
sudo cp $HOME/dotfiles/sddm/theme.conf /usr/share/sddm/themes/sugar-candy/
2023-12-21 10:05:20 +00:00
sudo sed -i 's/CURRENTWALLPAPER/'"current_wallpaper.$extension"'/' /usr/share/sddm/themes/sugar-candy/theme.conf
2023-11-10 21:12:15 +00:00
echo "File theme.conf updated in /usr/share/sddm/themes/sugar-candy/"
echo "DONE! Please logout to test sddm."
2024-02-19 17:14:24 +00:00
sleep 3