dotfiles/files/.config/i3/bin/mklockimg

33 lines
1.1 KiB
Text
Raw Normal View History

2016-09-04 13:58:13 +02:00
#!/bin/bash
WPDIR=~/Images/wallpapers
WALLPAPER=$WPDIR/wallpaper.jpg
WALLPAPER_OUT=$WPDIR/wallpaper_lock.png
LOCKIMG=$WPDIR/img/lock.png
LOCKTXT=$WPDIR/img/text.png
WPSIZE=$(identify "$WALLPAPER" | cut -d ' ' -f 3)
WP_WID=$(echo "$WPSIZE" | cut -d 'x' -f 1)
WP_HEI=$(echo "$WPSIZE" | cut -d 'x' -f 2)
LOCKSIZE=$(identify "$LOCKIMG" | cut -d ' ' -f 3)
LOCK_WID=$(echo "$LOCKSIZE" | cut -d 'x' -f 1)
LOCK_HEI=$(echo "$LOCKSIZE" | cut -d 'x' -f 2)
TEXTSIZE=$(identify "$LOCKTXT" | cut -d ' ' -f 3)
TEXT_WID=$(echo "$TEXTSIZE" | cut -d 'x' -f 1)
TEXT_HEI=$(echo "$TEXTSIZE" | cut -d 'x' -f 2)
LOCKPOS_X=$(($WP_WID/2 - $LOCK_WID/2))
LOCKPOS_Y=$(($WP_HEI/2 - $LOCK_HEI/2))
TEXTPOS_X=$(($WP_WID/2 - $TEXT_WID/2))
TEXTPOS_Y=$(($WP_HEI/2 - $TEXT_HEI/2 + 200))
SCREENSIZE=$(xrandr --current | grep '*' | uniq | awk '{print $1}')
SCREEN_WID=$(echo $SCREENSIZE | cut -d 'x' -f 1)
SCREEN_HEI=$(echo $SCREENSIZE | cut -d 'x' -f 2)
convert "$WALLPAPER" "$LOCKIMG" -geometry "+$LOCKPOS_X+$LOCKPOS_Y" -composite \
"$LOCKTXT" -geometry "+$TEXTPOS_X+$TEXTPOS_Y" -composite \
-geometry "${SCREEN_WID}x${SCREEN_HEI}" "$WALLPAPER_OUT"