aboutsummaryrefslogtreecommitdiffstats
#!/bin/sh
# Borrowed from Arch Linux and adapted for Slackware.
# See https://aur.archlinux.org/packages/xdm-arch-theme/

# the root window should have this color
xsetroot -solid "#000000" -cursor_name left_ptr

SVG_FILE=/etc/X11/xdm/liveslak-xdm/slackware_traditional.svg

# identify resolution
declare -a RESOLUTION
RESOLUTION=( $(xrandr -q | head -n1 | sed -e 's/.*current \([1-9][0-9]\+\) x \([1-9][0-9]\+\).*/\1 \2/') )

CACHE_DIR=/var/cache/xdm-liveslak-theme
IMAGEFILE=${CACHE_DIR}/slackware_logo_${RESOLUTION[0]}x${RESOLUTION[1]}.png

# create cache dir if necessary
if [[ ! -d ${CACHE_DIR} ]]; then
  mkdir -p ${CACHE_DIR}
fi

# check whether image file already exists
if [[ ! -f ${IMAGEFILE} ]]; then
  rsvg-convert -a --background-color="#000000" -f png -w $((${RESOLUTION[0]}/3*2)) -o ${IMAGEFILE} ${SVG_FILE}
fi

# try different methods to set the background
if which display >> /dev/null 2>&1; then
        # imagemagick detected
	display -background "#000000" -backdrop -window root ${IMAGEFILE};
elif which feh >> /dev/null 2>&1; then
	# feh detected
        # feh gives error if $HOME isn't set, so...
	HOME=/root feh --bg-center ${IMAGEFILE};
elif which xv >> /dev/null 2>&1; then
        # xv detected
        # xv spits out an error when using -quit, but it still does the job, so...
        xv -root -quit -rmode 5 ${IMAGEFILE} >> /dev/null 2>&1
fi

/etc/X11/xdm/liveslak-xdm/buttons &

xclock &