diff options
-rwxr-xr-x | mga-bg-res/mga-bg-res.sh | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/mga-bg-res/mga-bg-res.sh b/mga-bg-res/mga-bg-res.sh index 3dc8416..b6b0f24 100755 --- a/mga-bg-res/mga-bg-res.sh +++ b/mga-bg-res/mga-bg-res.sh @@ -2,7 +2,7 @@ bgpath="/usr/share/mga/backgrounds" theme="Mageia-Default" -curlink=$(readlink $bgpath/default.jpg) +curlink=$(readlink $bgpath/default.png) # Search for the optimal background resolution according to monitor-edid if [ -e /usr/sbin/monitor-edid ]; then @@ -16,12 +16,12 @@ if [ -z $res ]; then fi # Check if the symlink is already good -if [ "$curlink" = "$bgpath/$theme-$res.jpg" ]; then +if [ "$curlink" = "$bgpath/$theme-$res.png" ]; then exit 0 fi # Check if this is a supported resolution, if not, find the background with a similar aspect ratio -if [ ! -e "$bgpath/$theme-$res.jpg" ]; then +if [ ! -e "$bgpath/$theme-$res.png" ]; then width=$(echo $res | cut -f1 -d"x") height=$(echo $res | cut -f2 -d"x") # Bash only does integer arithmetic, we multiply everything by 1000 to workaround this @@ -38,15 +38,17 @@ fi # Check again if the symlink does not already point to this new resolution # If not, create a new symlink -if [ "$curlink" != "$bgpath/$theme-$res.jpg" ]; then - if [ -e "$bgpath/$theme-$res.jpg" ]; then - ln -sf $bgpath/$theme-$res.jpg $bgpath/default.jpg +if [ "$curlink" != "$bgpath/$theme-$res.png" ]; then + if [ -e "$bgpath/$theme-$res.png" ]; then + ln -sf $bgpath/$theme-$res.png $bgpath/default.png + ln -sf $bgpath/default.png $bgpath/default.jpg if [ -d /boot/grub2/themes ]; then cp -f $bgpath/$theme-$res.png /boot/grub2/themes/grub2-mageia-default.png fi else - echo -e "Could not find this file: $bgpath/$theme-$res.jpg." + echo -e "Could not find this file: $bgpath/$theme-$res.png" echo "Please check that the mageia-theme-Default package is properly installed, or disable" echo "the mga-bg-res systemd service if you do not want to force using the Mageia theme." fi fi + |