mb-canvas 2 monitor update

This commit is contained in:
2026-03-21 14:29:13 +01:00
parent e790dbcef4
commit d6d6742819

View File

@@ -52,7 +52,8 @@ esac
DIR="$(xdg-user-dir PICTURES)/imagick" DIR="$(xdg-user-dir PICTURES)/imagick"
size="$(xrandr --current | grep '*' | uniq | awk '{print $1}')" #size="$(xrandr --current | grep '*' | uniq | awk '{print $1}')"
size=$(xrandr | grep ' primary' | grep -o '[0-9]*x[0-9]*' | head -1)
name="imagick_$(date +%Y-%m-%d_%I-%M-%S).${extension}" 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"
@@ -98,30 +99,30 @@ color_picker() {
notify-send.sh "$_IMWG" "$_PICKCOLORS: 2" -i mbcc --expire-time=12000 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" magick -size 100x100 xc:"$color1" "$FNAME"
notify-send.sh "$_PICKEDCOLOR 1" "$color1\n $_PICKNEXT..." --icon="$FNAME" --expire-time=12000 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" magick -size 100x100 xc:"$color2" "$FNAME"
notify-send.sh "$_PICKEDCOLOR 2" "$color1\n $_PICKEDALL" --icon="$FNAME" --expire-time=12000 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=12000 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" magick -size 100x100 xc:"$color1" "$FNAME"
notify-send.sh "$_PICKEDCOLOR 1" "$color1\n $_PICKNEXT..." --icon="$FNAME" --expire-time=12000 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" magick -size 100x100 xc:"$color2" "$FNAME"
notify-send.sh "$_PICKEDCOLOR 2" "$color2\n $_PICKNEXT..." --icon="$FNAME" --expire-time=12000 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" magick -size 100x100 xc:"$color3" "$FNAME"
notify-send.sh "$_PICKEDCOLOR 3" "$color3\n $_PICKNEXT..." --icon="$FNAME" --expire-time=12000 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" magick -size 100x100 xc:"$color4" "$FNAME"
notify-send.sh "$_PICKEDCOLOR 4" "$color4\n $_PICKEDALL" --icon="$FNAME" --expire-time=12000 notify-send.sh "$_PICKEDCOLOR 4" "$color4\n $_PICKEDALL" --icon="$FNAME" --expire-time=12000
fi fi
} }
@@ -141,7 +142,7 @@ solid() {
else else
get_color get_color
fi fi
magick convert -size "$size" canvas:"$color" "$DIR/$name" magick -size "$size" canvas:"$color" "$DIR/$name"
set_bg set_bg
} }
@@ -158,7 +159,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"
magick convert -size "$size" -define gradient:angle="${angle:-0}" gradient:"$color" "$DIR/$name" magick -size "$size" -define gradient:angle="${angle:-0}" gradient:"$color" "$DIR/$name"
set_bg set_bg
} }
@@ -181,7 +182,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"
magick convert -size "$size" -define gradient:extent="${shape:-maximum}" -define gradient:angle="${angle:-0}" radial-gradient:"$color" "$DIR/$name" magick -size "$size" -define gradient:extent="${shape:-maximum}" -define gradient:angle="${angle:-0}" radial-gradient:"$color" "$DIR/$name"
set_bg set_bg
} }
@@ -200,7 +201,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"
magick convert -size "$size" gradient:"$color" -swirl "${twist:-150}" "$DIR/$name" magick -size "$size" gradient:"$color" -swirl "${twist:-150}" "$DIR/$name"
set_bg set_bg
} }
@@ -229,9 +230,9 @@ bilinear_gradient() {
name="bilinear_$name" name="bilinear_$name"
if [[ $answer == "Smooth" ]] || [[ $answer == "S" ]]; then if [[ $answer == "Smooth" ]] || [[ $answer == "S" ]]; then
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" magick \( 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
magick convert \( xc:"$color1" xc:"$color2" +append \) \( xc:"$color3" xc:"$color4" +append \) -append -filter triangle -resize "$size"\! "$DIR/$name" magick \( xc:"$color1" xc:"$color2" +append \) \( xc:"$color3" xc:"$color4" +append \) -append -filter triangle -resize "$size"\! "$DIR/$name"
fi fi
set_bg set_bg
} }
@@ -257,17 +258,17 @@ plasma() {
fi fi
name="plasma_$name" name="plasma_$name"
if [[ $answer == "r" ]] || [[ $answer == "Random" ]]; then if [[ $answer == "r" ]] || [[ $answer == "Random" ]]; then
convert -size "$size" plasma: "$DIR/$name" magick -size "$size" plasma: "$DIR/$name"
elif [[ $answer == "t" ]] || [[ $answer == "Twisted" ]]; then elif [[ $answer == "t" ]] || [[ $answer == "Twisted" ]]; then
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
magick convert -size "$size" plasma:fractal -swirl "${twist:-150}" "$DIR/$name" magick -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
magick convert -size "$size" plasma:"$color" "$DIR/$name" magick -size "$size" plasma:"$color" "$DIR/$name"
fi fi
set_bg set_bg
} }
@@ -280,8 +281,8 @@ 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
magick convert -size "100x56" xc: +noise Random "/tmp/noise.png" magick -size "100x56" xc: +noise Random "/tmp/noise.png"
magick convert "/tmp/noise.png" -virtual-pixel tile -blur 0x"${blur:-14}" -auto-level -resize "$size" "$DIR/$name" magick "/tmp/noise.png" -virtual-pixel tile -blur 0x"${blur:-14}" -auto-level -resize "$size" "$DIR/$name"
set_bg set_bg
} }