You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
2.7 KiB
55 lines
2.7 KiB
#!/usr/bin/env bash
|
|
# to be sourced
|
|
ENABLED=no
|
|
[ "$ENABLED" != "yes" ] && exit 0
|
|
|
|
. /usr/lib/ublinux/os-config
|
|
|
|
SOURCE=${SYSCONF}/config; [ -f "${SOURCE}" ] && . ${SOURCE} 2>/dev/null
|
|
SOURCE=${SYSCONF}/theme; [ -f "${SOURCE}" ] && . ${SOURCE} 2>/dev/null
|
|
|
|
FEHOPTIONS="-B black -x -Z --scale-down"
|
|
WPDEFFILE=/usr/share/ublinux/wallpapers/default.jpg
|
|
FEHKILLSWITCH="while ! ps -A | egrep -q 'splash|panel|xbindkeys|lightdm-gtk-gr|polybar' ;do sleep 1 ;done ; sleep 7 ; killall feh"
|
|
[ "$BACKGROUNDMODE" = "2" ] && FEHOPTIONS="-F --zoom fill"
|
|
|
|
# get resolution of primary (or first) monitor
|
|
XORG_RES=$(LC_ALL=C /usr/bin/xrandr | awk -F" connected primary " '{print $2}' | sed s/+.*// | grep -m1 .)
|
|
[ -z "$XORG_RES" ] && XORG_RES=$(LC_ALL=C /usr/bin/xrandr | awk -F" connected " '{print $2}' | sed s/+.*// | grep -m1 .)
|
|
[ -z "$XORG_RES" ] && XORG_RES=1920x1080
|
|
|
|
# show wallpaper
|
|
[ -x /usr/bin/feh ] && /usr/bin/feh $FEHOPTIONS -g "$XORG_RES" $(dirname $WPDEFFILE)/default.orig.jpg &
|
|
# killswitch for feh
|
|
[ -x /usr/bin/feh ] && bash -c "$FEHKILLSWITCH" &
|
|
|
|
if [ -x /usr/bin/convert ] ;then
|
|
# resizing wallpaper for monitor resolution (default is proportional on black background)
|
|
RESIZEOPT="-resize $XORG_RES -background black -gravity center -extent $XORG_RES"
|
|
[ "$BACKGROUNDMODE" = "1" ] && RESIZEOPT="-resize $XORG_RES!"
|
|
[ "$BACKGROUNDMODE" = "2" ] && RESIZEOPT="-resize $XORG_RES^ -gravity center -extent $XORG_RES"
|
|
convert $RESIZEOPT $(dirname $WPDEFFILE)/default.orig.jpg /tmp/background.jpg
|
|
# Graffiti effects
|
|
if [ "$GRAFFITI" = "yes" ] ;then
|
|
[ "$(cmdline_value changes)$(cmdline_value ub.changes)" ] && LABEL=ublinux.png || LABEL=clean.png
|
|
convert -resize x$(expr $(echo $XORG_RES | awk -Fx '{ print $2 }') / 10) /usr/share/ublinux/graffiti/$LABEL /tmp/logo.png
|
|
composite -gravity SouthWest /tmp/logo.png /tmp/background.jpg /tmp/background2.jpg
|
|
mv -f /tmp/background2.jpg /tmp/background.jpg
|
|
rm -f /tmp/logo.png
|
|
fi
|
|
# placing warning about default passwords
|
|
if [ "$GRAFFITI" != "no" -a -x /usr/bin/composite ] ;then
|
|
. /usr/lib/ublinux/os-config
|
|
A=0
|
|
grep -q "^root:$DEFAULTROOTPASSWD:" /etc/shadow && A=1
|
|
grep -q "^user:$DEFAULTPASSWD:" /etc/shadow && A=1
|
|
[ "$A" = "1" ] && composite -gravity NorthWest /usr/share/ublinux/graffiti/warning.png /tmp/background.jpg /tmp/background2.jpg
|
|
[ -f /tmp/background2.jpg ] && mv -f /tmp/background2.jpg /tmp/background.jpg
|
|
fi
|
|
# replacing default wallpaper
|
|
[ -f /tmp/background.jpg ] && mv -f /tmp/background.jpg "$WPDEFFILE"
|
|
[ -d /usr/share/apps/ksplash ] && mkdir -p "/usr/share/apps/ksplash/Themes/Default/$XORG_RES"
|
|
[ -d /usr/share/apps/ksplash ] && convert "$WPDEFFILE" "/usr/share/apps/ksplash/Themes/Default/$XORG_RES/background.png"
|
|
fi
|
|
|
|
exit 0 |