wallpaper tools review
parent
96cf3eb18d
commit
bca43bd80b
106
bin/mb-canvas
106
bin/mb-canvas
|
@ -2,55 +2,61 @@
|
||||||
## An Imagemagick Script To Generate Wallpapers.
|
## An Imagemagick Script To Generate Wallpapers.
|
||||||
## Based on https://github.com/adi1090x/canvas by Aditya Shakya (adi1090x)
|
## Based on https://github.com/adi1090x/canvas by Aditya Shakya (adi1090x)
|
||||||
## Modified by Daniel Napora for Mabox Linux to run from menu
|
## Modified by Daniel Napora for Mabox Linux to run from menu
|
||||||
# TODO: add missing options to some effects
|
|
||||||
# TODO: add ability to pick and use 4 predefined colors
|
|
||||||
# TODO: choose picker: xcolor or gpick
|
|
||||||
|
|
||||||
CONFIG_DIR="$HOME/.config/mbxutils/imgw"
|
|
||||||
CONFIG_FILE="$CONFIG_DIR/imgw.cfg"
|
CONFIG_DIR="$HOME/.config/mabox/tools/"
|
||||||
|
CONFIG_FILE="$CONFIG_DIR/mb-canvas.cfg"
|
||||||
mkdir -p $CONFIG_DIR
|
mkdir -p $CONFIG_DIR
|
||||||
if [ ! -f $CONFIG_FILE ]; then
|
if [ ! -f $CONFIG_FILE ]; then
|
||||||
cat <<EOF > ${CONFIG_FILE}
|
cat <<EOF > ${CONFIG_FILE}
|
||||||
|
# Imagetype extension avif or png
|
||||||
|
# avif (recommended) faster and much smaller size
|
||||||
|
extenstion=avif
|
||||||
|
# Show preview window, and then decide to set as wallpaper or not
|
||||||
|
# if no denerated wallpaper will be applied immadietely
|
||||||
|
# yes (recommended) or no
|
||||||
show_preview=yes
|
show_preview=yes
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
source <(grep = $CONFIG_FILE)
|
source <(grep = $CONFIG_FILE)
|
||||||
|
|
||||||
|
extension=${extension:-avif}
|
||||||
|
show_preview=${show_preview:-yes}
|
||||||
|
|
||||||
|
|
||||||
case $LANG in
|
case $LANG in
|
||||||
pl*)
|
pl*)
|
||||||
IMWG="Generator Tapet"
|
_IMWG="Generator Tapet"
|
||||||
PICKCOLOR="Pobierz kolor z ekranu"
|
_PICKCOLOR="Pobierz kolor z ekranu"
|
||||||
PICKCOLORS="Pobierz kolory z ekranu"
|
_PICKCOLORS="Pobierz kolory z ekranu"
|
||||||
PICKEDCOLOR="Pobrany kolor"
|
_PICKEDCOLOR="Pobrany kolor"
|
||||||
PICKNEXT="Pobierz nastepny"
|
_PICKNEXT="Pobierz nastepny"
|
||||||
PICKEDALL="Generuję tapetę..."
|
_PICKEDALL="Generuję tapetę..."
|
||||||
SETASWP="Ustawić jako tapetę?"
|
_SETASWP="Ustawić jako tapetę?"
|
||||||
YES="Tak"
|
_YES="Tak"
|
||||||
NO="Nie"
|
_NO="Nie"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
IMWG="ImageMagick Wallpaper Generator"
|
_IMWG="ImageMagick Wallpaper Generator"
|
||||||
PICKCOLOR="Pick color from screen"
|
_PICKCOLOR="Pick color from screen"
|
||||||
PICKCOLORS="Pick colors from screen"
|
_PICKCOLORS="Pick colors from screen"
|
||||||
PICKEDCOLOR="Picked color"
|
_PICKEDCOLOR="Picked color"
|
||||||
PICKNEXT="Please pick next..."
|
_PICKNEXT="Please pick next..."
|
||||||
PICKEDALL="Generating Wallpaper..."
|
_PICKEDALL="Generating Wallpaper..."
|
||||||
SETASWP="Set as Wallpaper?"
|
_SETASWP="Set as Wallpaper?"
|
||||||
YES="Yes"
|
_YES="Yes"
|
||||||
NO="No"
|
_NO="No"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
DIR="$(xdg-user-dir PICTURES)/mb-canvas"
|
DIR="$(xdg-user-dir PICTURES)/imagick"
|
||||||
|
|
||||||
size="$(xrandr --current | grep '*' | uniq | awk '{print $1}')"
|
size="$(xrandr --current | grep '*' | uniq | awk '{print $1}')"
|
||||||
name="mb-canvas_$(date +%Y-%m-%d_%I-%M-%S).png"
|
name="imagick_$(date +%Y-%m-%d_%I-%M-%S).${extension}"
|
||||||
#SETTER="feh --bg-scale";
|
#SETTER="feh --bg-scale";
|
||||||
SETTER="nitrogen --set-scaled --save"
|
SETTER="nitrogen --set-scaled --save"
|
||||||
#picker_app="gpick -s -o --no-newline"
|
#picker_app="gpick -s -o --no-newline"
|
||||||
#picker_app="xcolor"
|
|
||||||
picker_app="gpick -pso 2>/dev/null"
|
picker_app="gpick -pso 2>/dev/null"
|
||||||
|
|
||||||
if [[ ! -d "$DIR" ]]; then
|
if [[ ! -d "$DIR" ]]; then
|
||||||
|
@ -64,13 +70,15 @@ set_bg() {
|
||||||
P_X=$((X/4))
|
P_X=$((X/4))
|
||||||
P_Y=$((Y/4+30))
|
P_Y=$((Y/4+30))
|
||||||
|
|
||||||
yad --title="$SETASWP" --window-icon=mbcc --borders=0 --geometry="${P_X}x${P_Y}+200+30" \
|
yad --title="$_SETASWP" --window-icon=mbcc --borders=0 --geometry="${P_X}x${P_Y}+200+30" \
|
||||||
--picture --size=fit --filename="$DIR/$name" \
|
--picture --size=fit --filename="$DIR/$name" \
|
||||||
--button="$NO":1 --button="$YES":2 \
|
--button="$_NO":1 --button="$_YES":2 \
|
||||||
|
|
||||||
ODP="$?"
|
ODP="$?"
|
||||||
|
|
||||||
[[ "$ODP" -eq "1" ]] && exit 0
|
if [[ "$ODP" -eq "1" ]]; then
|
||||||
|
rm "$DIR/$name" && exit 0
|
||||||
|
fi
|
||||||
if [[ "$ODP" -eq "2" ]]; then
|
if [[ "$ODP" -eq "2" ]]; then
|
||||||
$SETTER "$DIR/$name" && exit 0
|
$SETTER "$DIR/$name" && exit 0
|
||||||
fi
|
fi
|
||||||
|
@ -84,37 +92,37 @@ set_bg() {
|
||||||
color_picker() {
|
color_picker() {
|
||||||
|
|
||||||
if [[ "$SOLID" == "true" ]]; then
|
if [[ "$SOLID" == "true" ]]; then
|
||||||
notify-send.sh "$IMWG" "$PICKCOLOR" -i mbcc --expire-time=120000
|
notify-send.sh "$_IMWG" "$_PICKCOLOR" -i mbcc --expire-time=12000
|
||||||
color=$($picker_app)
|
color=$($picker_app)
|
||||||
elif [[ "$GRADIENT" == "true" ]] || [[ "$RGRADIENT" == "true" ]] || [[ "$TGRADIENT" == "true" ]] || "$PLASMA" == "true" ]]; then
|
elif [[ "$GRADIENT" == "true" ]] || [[ "$RGRADIENT" == "true" ]] || [[ "$TGRADIENT" == "true" ]] || "$PLASMA" == "true" ]]; then
|
||||||
notify-send.sh "$IMWG" "$PICKCOLORS: 2" -i mbcc --expire-time=120000
|
notify-send.sh "$_IMWG" "$_PICKCOLORS: 2" -i mbcc --expire-time=12000
|
||||||
color1=$($picker_app)
|
color1=$($picker_app)
|
||||||
FNAME="/tmp/${color1:1:6}.png"
|
FNAME="/tmp/${color1:1:6}.png"
|
||||||
convert -size 100x100 xc:"$color1" "$FNAME"
|
convert -size 100x100 xc:"$color1" "$FNAME"
|
||||||
notify-send.sh "$PICKEDCOLOR 1" "$color1\n $PICKNEXT..." --icon="$FNAME" --expire-time=120000
|
notify-send.sh "$_PICKEDCOLOR 1" "$color1\n $_PICKNEXT..." --icon="$FNAME" --expire-time=12000
|
||||||
color2=$($picker_app)
|
color2=$($picker_app)
|
||||||
FNAME="/tmp/${color2:1:6}.png"
|
FNAME="/tmp/${color2:1:6}.png"
|
||||||
convert -size 100x100 xc:"$color2" "$FNAME"
|
convert -size 100x100 xc:"$color2" "$FNAME"
|
||||||
notify-send.sh "$PICKEDCOLOR 2" "$color1\n $PICKEDALL" --icon="$FNAME" --expire-time=120000
|
notify-send.sh "$_PICKEDCOLOR 2" "$color1\n $_PICKEDALL" --icon="$FNAME" --expire-time=12000
|
||||||
color="$color1-$color2"
|
color="$color1-$color2"
|
||||||
elif [[ "$BGRADIENT" == "true" ]]; then
|
elif [[ "$BGRADIENT" == "true" ]]; then
|
||||||
notify-send.sh "$IMWG" "$PICKCOLORS: 4" -i mbcc --expire-time=120000
|
notify-send.sh "$_IMWG" "$_PICKCOLORS: 4" -i mbcc --expire-time=12000
|
||||||
color1=$($picker_app)
|
color1=$($picker_app)
|
||||||
FNAME="/tmp/${color1:1:6}.png"
|
FNAME="/tmp/${color1:1:6}.png"
|
||||||
convert -size 100x100 xc:"$color1" "$FNAME"
|
convert -size 100x100 xc:"$color1" "$FNAME"
|
||||||
notify-send.sh "$PICKEDCOLOR 1" "$color1\n $PICKNEXT..." --icon="$FNAME" --expire-time=120000
|
notify-send.sh "$_PICKEDCOLOR 1" "$color1\n $_PICKNEXT..." --icon="$FNAME" --expire-time=12000
|
||||||
color2=$($picker_app)
|
color2=$($picker_app)
|
||||||
FNAME="/tmp/${color2:1:6}.png"
|
FNAME="/tmp/${color2:1:6}.png"
|
||||||
convert -size 100x100 xc:"$color2" "$FNAME"
|
convert -size 100x100 xc:"$color2" "$FNAME"
|
||||||
notify-send.sh "$PICKEDCOLOR 2" "$color2\n $PICKNEXT..." --icon="$FNAME" --expire-time=120000
|
notify-send.sh "$_PICKEDCOLOR 2" "$color2\n $_PICKNEXT..." --icon="$FNAME" --expire-time=12000
|
||||||
color3=$($picker_app)
|
color3=$($picker_app)
|
||||||
FNAME="/tmp/${color3:1:6}.png"
|
FNAME="/tmp/${color3:1:6}.png"
|
||||||
convert -size 100x100 xc:"$color3" "$FNAME"
|
convert -size 100x100 xc:"$color3" "$FNAME"
|
||||||
notify-send.sh "$PICKEDCOLOR 3" "$color3\n $PICKNEXT..." --icon="$FNAME" --expire-time=120000
|
notify-send.sh "$_PICKEDCOLOR 3" "$color3\n $_PICKNEXT..." --icon="$FNAME" --expire-time=12000
|
||||||
color4=$($picker_app)
|
color4=$($picker_app)
|
||||||
FNAME="/tmp/${color4:1:6}.png"
|
FNAME="/tmp/${color4:1:6}.png"
|
||||||
convert -size 100x100 xc:"$color4" "$FNAME"
|
convert -size 100x100 xc:"$color4" "$FNAME"
|
||||||
notify-send.sh "$PICKEDCOLOR 4" "$color4\n $PICKEDALL" --icon="$FNAME" --expire-time=120000
|
notify-send.sh "$_PICKEDCOLOR 4" "$color4\n $_PICKEDALL" --icon="$FNAME" --expire-time=12000
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +141,7 @@ solid() {
|
||||||
else
|
else
|
||||||
get_color
|
get_color
|
||||||
fi
|
fi
|
||||||
convert -size "$size" canvas:"$color" "$DIR/$name"
|
magick convert -size "$size" canvas:"$color" "$DIR/$name"
|
||||||
set_bg
|
set_bg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +158,7 @@ linear_gradient() {
|
||||||
angle=$(yad --center --window-icon=mbcc --title="Linear gradient" --text="\tRotation angle (default is 0):" --width=400 --scale --min-value=0 --max-value=360 --step=45 --enforce-step --inc-buttons)
|
angle=$(yad --center --window-icon=mbcc --title="Linear gradient" --text="\tRotation angle (default is 0):" --width=400 --scale --min-value=0 --max-value=360 --step=45 --enforce-step --inc-buttons)
|
||||||
fi
|
fi
|
||||||
name="linear_$name"
|
name="linear_$name"
|
||||||
convert -size "$size" -define gradient:angle="${angle:-0}" gradient:"$color" "$DIR/$name"
|
magick convert -size "$size" -define gradient:angle="${angle:-0}" gradient:"$color" "$DIR/$name"
|
||||||
set_bg
|
set_bg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,7 +181,7 @@ radial_gradient() {
|
||||||
angle=$(yad --center --window-icon=mbcc --title="Radial gradient" --text="\tRotation angle:" --width=400 --scale --min-value=0 --max-value=360 --step=45 --enforce-step --inc-buttons)
|
angle=$(yad --center --window-icon=mbcc --title="Radial gradient" --text="\tRotation angle:" --width=400 --scale --min-value=0 --max-value=360 --step=45 --enforce-step --inc-buttons)
|
||||||
fi
|
fi
|
||||||
name="radial_$name"
|
name="radial_$name"
|
||||||
convert -size "$size" -define gradient:extent="${shape:-maximum}" -define gradient:angle="${angle:-0}" radial-gradient:"$color" "$DIR/$name"
|
magick convert -size "$size" -define gradient:extent="${shape:-maximum}" -define gradient:angle="${angle:-0}" radial-gradient:"$color" "$DIR/$name"
|
||||||
set_bg
|
set_bg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,7 +200,7 @@ twisted_gradient() {
|
||||||
twist=$(yad --center --window-icon=mbcc --title="Radial gradient" --text="\tTwisting amount (default is 150):" --width=400 --scale --value=150 --min-value=0 --max-value=500 --step=20 --inc-buttons)
|
twist=$(yad --center --window-icon=mbcc --title="Radial gradient" --text="\tTwisting amount (default is 150):" --width=400 --scale --value=150 --min-value=0 --max-value=500 --step=20 --inc-buttons)
|
||||||
fi
|
fi
|
||||||
name="twisted_$name"
|
name="twisted_$name"
|
||||||
convert -size "$size" gradient:"$color" -swirl "${twist:-150}" "$DIR/$name"
|
magick convert -size "$size" gradient:"$color" -swirl "${twist:-150}" "$DIR/$name"
|
||||||
set_bg
|
set_bg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,9 +229,9 @@ bilinear_gradient() {
|
||||||
name="bilinear_$name"
|
name="bilinear_$name"
|
||||||
if [[ $answer == "Smooth" ]] || [[ $answer == "S" ]]; then
|
if [[ $answer == "Smooth" ]] || [[ $answer == "S" ]]; then
|
||||||
|
|
||||||
convert \( xc:"$color1" xc:"$color2" +append \) \( xc:"$color3" xc:"$color4" +append \) -append -size "$size" xc: +swap -fx 'v.p{i/(w-1),j/(h-1)}' "$DIR/$name"
|
magick convert \( xc:"$color1" xc:"$color2" +append \) \( xc:"$color3" xc:"$color4" +append \) -append -size "$size" xc: +swap -fx 'v.p{i/(w-1),j/(h-1)}' "$DIR/$name"
|
||||||
else
|
else
|
||||||
convert \( xc:"$color1" xc:"$color2" +append \) \( xc:"$color3" xc:"$color4" +append \) -append -filter triangle -resize "$size"\! "$DIR/$name"
|
magick convert \( xc:"$color1" xc:"$color2" +append \) \( xc:"$color3" xc:"$color4" +append \) -append -filter triangle -resize "$size"\! "$DIR/$name"
|
||||||
fi
|
fi
|
||||||
set_bg
|
set_bg
|
||||||
}
|
}
|
||||||
|
@ -254,12 +262,12 @@ plasma() {
|
||||||
if [[ "$RANDOMIZE" != "true" ]]; then
|
if [[ "$RANDOMIZE" != "true" ]]; then
|
||||||
twist=$(yad --center --window-icon=mbcc --title="Plasma" --text="\tTwisting amount (default is 150):" --width=400 --scale --value=150 --min-value=0 --max-value=500 --step=20 --inc-buttons)
|
twist=$(yad --center --window-icon=mbcc --title="Plasma" --text="\tTwisting amount (default is 150):" --width=400 --scale --value=150 --min-value=0 --max-value=500 --step=20 --inc-buttons)
|
||||||
fi
|
fi
|
||||||
convert -size "$size" plasma:fractal -swirl "${twist:-150}" "$DIR/$name"
|
magick convert -size "$size" plasma:fractal -swirl "${twist:-150}" "$DIR/$name"
|
||||||
else
|
else
|
||||||
if [[ "$RANDOMIZE" != "true" ]]; then
|
if [[ "$RANDOMIZE" != "true" ]]; then
|
||||||
get_color
|
get_color
|
||||||
fi
|
fi
|
||||||
convert -size "$size" plasma:"$color" "$DIR/$name"
|
magick convert -size "$size" plasma:"$color" "$DIR/$name"
|
||||||
fi
|
fi
|
||||||
set_bg
|
set_bg
|
||||||
}
|
}
|
||||||
|
@ -272,12 +280,12 @@ blurred_noise() {
|
||||||
else
|
else
|
||||||
{ echo; read -p ${ORANGE}"Enter the blur strength (maximum 30): "${BLUE} blur; }
|
{ echo; read -p ${ORANGE}"Enter the blur strength (maximum 30): "${BLUE} blur; }
|
||||||
fi
|
fi
|
||||||
convert -size "100x56" xc: +noise Random "/tmp/noise.png"
|
magick convert -size "100x56" xc: +noise Random "/tmp/noise.png"
|
||||||
convert "/tmp/noise.png" -virtual-pixel tile -blur 0x"${blur:-14}" -auto-level -resize "$size" "$DIR/$name"
|
magick convert "/tmp/noise.png" -virtual-pixel tile -blur 0x"${blur:-14}" -auto-level -resize "$size" "$DIR/$name"
|
||||||
set_bg
|
set_bg
|
||||||
}
|
}
|
||||||
|
|
||||||
## Generate random number lower than giver parameter
|
## Generate random number lower than given parameter
|
||||||
get_random_number() {
|
get_random_number() {
|
||||||
RNUM=$(( ($RANDOM % $1) + 1 ))
|
RNUM=$(( ($RANDOM % $1) + 1 ))
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,9 +71,9 @@ esac
|
||||||
SCREENSIZE=$(wmctrl -d |grep "*" | awk -F' ' '{print $4}')
|
SCREENSIZE=$(wmctrl -d |grep "*" | awk -F' ' '{print $4}')
|
||||||
W="${SCREENSIZE%x*}"
|
W="${SCREENSIZE%x*}"
|
||||||
H="${SCREENSIZE#*x}"
|
H="${SCREENSIZE#*x}"
|
||||||
FW=$((W/2))
|
FW=$((W/4))
|
||||||
FH=$((H/2))
|
FH=$((H/4))
|
||||||
X="40"
|
X=$((FW*3/2))
|
||||||
Y=$((H-FH-40))
|
Y=$((H-FH-40))
|
||||||
notify-send.sh -t 12000 -i ~/.config/mabox/wpicon.png "$TITLE" "$TEXT"
|
notify-send.sh -t 12000 -i ~/.config/mabox/wpicon.png "$TITLE" "$TEXT"
|
||||||
feh -B "#4D4D4D" -N -x --scale-down -E ${FH} -y ${FW} -^ "Enter=select, Arrows=next/prev Esc=quit" -g ${FW}x${FH}+${X}+${Y} ${wallpaper_dir} -A "${command} '%f'"
|
feh -B "#4D4D4D" -N -x --scale-down -E ${FH} -y ${FW} -^ "Enter=select, Arrows=next/prev Esc=quit" -g ${FW}x${FH}+${X}+${Y} ${wallpaper_dir} -A "${command} '%f'"
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 102 KiB |
Loading…
Reference in New Issue