apply last commit in all default scripts, update documentation to

reflect it
This commit is contained in:
speedie 2023-05-10 21:55:28 +02:00
parent c71743a326
commit 44ec1632bd
7 changed files with 33 additions and 13 deletions

View file

@ -533,7 +533,7 @@ spmenu window. It should be noted that the prompt is purely visual though.
## Images ## Images
spmenu supports drawing images. This image is placed on the left side of spmenu supports drawing images. This image is placed on the left side of
the menu window. To use an image, pipe `IMG:/path/to/image` to spmenu. the menu window. To use an image, pipe `img:///path/to/image` to spmenu.
If you want you can specify arguments like usual. Note that you should add If you want you can specify arguments like usual. Note that you should add
a Tab (`\t`) character after the path to the image file. Otherwise the text a Tab (`\t`) character after the path to the image file. Otherwise the text
after will be interpreted as part of the filename and the image will not be drawn. after will be interpreted as part of the filename and the image will not be drawn.
@ -541,13 +541,18 @@ after will be interpreted as part of the filename and the image will not be draw
Any text after the Tab character will be interpreted as a regular item. Any text after the Tab character will be interpreted as a regular item.
In practice, drawing an image might look like this: In practice, drawing an image might look like this:
`printf "IMG:/path/to/image\tLook at that image, isn't it awesome?\n" | spmenu` `printf "img:///path/to/image\tLook at that image, isn't it awesome?\n" | spmenu`
There are also a few image related arguments, such as: There are also a few image related arguments, such as:
`-is`, `-ig`, `-it`, `-ib`, `-ic`, `-itc` and `-gc`. `-is`, `-ig`, `-it`, `-ib`, `-ic`, `-itc` and `-gc`.
NOTE: Vector images (such as .svg) can be displayed too. Vector images (such as .svg) can be displayed too in the same way. This is all
done using `imlib2` so as long as imlib2 support it, it can be used.
NOTE: Also note that older spmenu scripts may use the `IMG:` prefix rather than
the newer `img://` prefix. It is recommended that you use the `img://` prefix,
but `IMG:` may be preferred if you need compatibility with older spmenu versions.
## Colored text ## Colored text

View file

@ -9,7 +9,7 @@ genlist() {
for i in $(seq "$argc"); do for i in $(seq "$argc"); do
arg="$(printf "%s\n" "$@" | sed -n "${i}","${i}"p)" arg="$(printf "%s\n" "$@" | sed -n "${i}","${i}"p)"
[ -z "$arg" ] || [ ! -f "$arg" ] && continue [ -z "$arg" ] || [ ! -f "$arg" ] && continue
printf "IMG:%s\t%s\n" "$arg" "$arg" printf "img://%s\t%s\n" "$arg" "$arg"
done done
} }

View file

@ -19,7 +19,7 @@ create_list() {
file="$(find "$dir"/* -type f | sed -n "${i}","${i}"p)" || exit 1 file="$(find "$dir"/* -type f | sed -n "${i}","${i}"p)" || exit 1
[ -e "$(dirname "$file")/cover.jpg" ] && \ [ -e "$(dirname "$file")/cover.jpg" ] && \
cp "$(dirname "$file")"/cover.jpg "$prefix/cover-$i.jpg" || ffmpeg -i "$file" -map 0:1 "$prefix/cover-$i.jpg" -loglevel quiet cp "$(dirname "$file")"/cover.jpg "$prefix/cover-$i.jpg" || ffmpeg -i "$file" -map 0:1 "$prefix/cover-$i.jpg" -loglevel quiet
[ -e "$prefix/cover-$i.jpg" ] && imageprefix="IMG:" && image="$prefix/cover-$i.jpg" [ -e "$prefix/cover-$i.jpg" ] && imageprefix="img://" && image="$prefix/cover-$i.jpg"
[ "$(basename "$file")" = "cover.jpg" ] && i=$(expr $i + 1) && continue [ "$(basename "$file")" = "cover.jpg" ] && i=$(expr $i + 1) && continue
printf "%s%s\t%s\n" "$imageprefix" "$image" "$(basename "$file")" printf "%s%s\t%s\n" "$imageprefix" "$image" "$(basename "$file")"

View file

@ -550,7 +550,7 @@ print_desktop_list() {
# finally print all of it # finally print all of it
for i in "${!it_title[@]}"; do for i in "${!it_title[@]}"; do
if [ -f "${it_icon[i]}" ] && [ -n "${it_title[i]}" ] && [ -n "${it_exec[i]}" ] && [ "$IMAGE" != "false" ]; then if [ -f "${it_icon[i]}" ] && [ -n "${it_title[i]}" ] && [ -n "${it_exec[i]}" ] && [ "$IMAGE" != "false" ]; then
printf "%s\t%s" "IMG:${it_icon[i]}" "${it_title[i]}" printf "%s\t%s" "img://${it_icon[i]}" "${it_title[i]}"
elif [ -n "${it_title[i]}" ] && [ -n "${it_exec[i]}" ]; then elif [ -n "${it_title[i]}" ] && [ -n "${it_exec[i]}" ]; then
printf "%s" "${it_title[i]}" printf "%s" "${it_title[i]}"
else else

View file

@ -46,7 +46,7 @@ command -v maim > /dev/null && maim -uB > /tmp/image.png
IMAGE="/tmp/image.png" IMAGE="/tmp/image.png"
main() { main() {
[ -e "$IMAGE" ] && IMAGEARG="--image-size 500 --no-generate-cache" && IMAGEPREFIX="IMG:" || IMAGE="" [ -e "$IMAGE" ] && IMAGEARG="--image-size 500 --no-generate-cache" && IMAGEPREFIX="img://" || IMAGE=""
printf "$IMAGEPREFIX$IMAGE\t${v2}s${v3}p${v4}m${v5}e${v6}n${v7}u${v8} $([ -f "${DESTDIR}${PREFIX}/share/spmenu/version" ] && cat "${DESTDIR}${PREFIX}/share/spmenu/version")\n\ printf "$IMAGEPREFIX$IMAGE\t${v2}s${v3}p${v4}m${v5}e${v6}n${v7}u${v8} $([ -f "${DESTDIR}${PREFIX}/share/spmenu/version" ] && cat "${DESTDIR}${PREFIX}/share/spmenu/version")\n\
$IMAGEPREFIX$IMAGE\t${b1}\n\ $IMAGEPREFIX$IMAGE\t${b1}\n\

View file

@ -562,7 +562,7 @@ It should be noted that the prompt is purely visual though.
.PP .PP
spmenu supports drawing images. spmenu supports drawing images.
This image is placed on the left side of the menu window. This image is placed on the left side of the menu window.
To use an image, pipe \f[V]IMG:/path/to/image\f[R] to spmenu. To use an image, pipe \f[V]img:///path/to/image\f[R] to spmenu.
If you want you can specify arguments like usual. If you want you can specify arguments like usual.
Note that you should add a Tab (\f[V]\[rs]t\f[R]) character after the Note that you should add a Tab (\f[V]\[rs]t\f[R]) character after the
path to the image file. path to the image file.
@ -572,14 +572,22 @@ the image will not be drawn.
Any text after the Tab character will be interpreted as a regular item. Any text after the Tab character will be interpreted as a regular item.
In practice, drawing an image might look like this: In practice, drawing an image might look like this:
.PP .PP
\f[V]printf \[dq]IMG:/path/to/image\[rs]tLook at that image, isn\[aq]t it awesome?\[rs]n\[dq] | spmenu\f[R] \f[V]printf \[dq]img:///path/to/image\[rs]tLook at that image, isn\[aq]t it awesome?\[rs]n\[dq] | spmenu\f[R]
.PP .PP
There are also a few image related arguments, such as: There are also a few image related arguments, such as:
.PP .PP
\f[V]-is\f[R], \f[V]-ig\f[R], \f[V]-it\f[R], \f[V]-ib\f[R], \f[V]-is\f[R], \f[V]-ig\f[R], \f[V]-it\f[R], \f[V]-ib\f[R],
\f[V]-ic\f[R], \f[V]-itc\f[R] and \f[V]-gc\f[R]. \f[V]-ic\f[R], \f[V]-itc\f[R] and \f[V]-gc\f[R].
.PP .PP
NOTE: Vector images (such as .svg) can be displayed too. Vector images (such as .svg) can be displayed too in the same way.
This is all done using \f[V]imlib2\f[R] so as long as imlib2 support it,
it can be used.
.PP
NOTE: Also note that older spmenu scripts may use the \f[V]IMG:\f[R]
prefix rather than the newer \f[V]img://\f[R] prefix.
It is recommended that you use the \f[V]img://\f[R] prefix, but
\f[V]IMG:\f[R] may be preferred if you need compatibility with older
spmenu versions.
.SS Colored text .SS Colored text
.PP .PP
spmenu supports colored text through SGR sequences. spmenu supports colored text through SGR sequences.

View file

@ -847,19 +847,26 @@ purely visual though.</p>
<h2 id="images">Images</h2> <h2 id="images">Images</h2>
<p>spmenu supports drawing images. This image is placed on the left side <p>spmenu supports drawing images. This image is placed on the left side
of the menu window. To use an image, pipe of the menu window. To use an image, pipe
<code>IMG:/path/to/image</code> to spmenu. If you want you can specify <code>img:///path/to/image</code> to spmenu. If you want you can specify
arguments like usual. Note that you should add a Tab (<code>\t</code>) arguments like usual. Note that you should add a Tab (<code>\t</code>)
character after the path to the image file. Otherwise the text after character after the path to the image file. Otherwise the text after
will be interpreted as part of the filename and the image will not be will be interpreted as part of the filename and the image will not be
drawn.</p> drawn.</p>
<p>Any text after the Tab character will be interpreted as a regular <p>Any text after the Tab character will be interpreted as a regular
item. In practice, drawing an image might look like this:</p> item. In practice, drawing an image might look like this:</p>
<p><code>printf "IMG:/path/to/image\tLook at that image, isn't it awesome?\n" | spmenu</code></p> <p><code>printf "img:///path/to/image\tLook at that image, isn't it awesome?\n" | spmenu</code></p>
<p>There are also a few image related arguments, such as:</p> <p>There are also a few image related arguments, such as:</p>
<p><code>-is</code>, <code>-ig</code>, <code>-it</code>, <p><code>-is</code>, <code>-ig</code>, <code>-it</code>,
<code>-ib</code>, <code>-ic</code>, <code>-itc</code> and <code>-ib</code>, <code>-ic</code>, <code>-itc</code> and
<code>-gc</code>.</p> <code>-gc</code>.</p>
<p>NOTE: Vector images (such as .svg) can be displayed too.</p> <p>Vector images (such as .svg) can be displayed too in the same way.
This is all done using <code>imlib2</code> so as long as imlib2 support
it, it can be used.</p>
<p>NOTE: Also note that older spmenu scripts may use the
<code>IMG:</code> prefix rather than the newer <code>img://</code>
prefix. It is recommended that you use the <code>img://</code> prefix,
but <code>IMG:</code> may be preferred if you need compatibility with
older spmenu versions.</p>
<h2 id="colored-text">Colored text</h2> <h2 id="colored-text">Colored text</h2>
<p>spmenu supports colored text through SGR sequences. This is the same <p>spmenu supports colored text through SGR sequences. This is the same
colors that you might already be using in your shell scripts. This means colors that you might already be using in your shell scripts. This means