General: More regex fixes

This commit is contained in:
Dylan Araps 2017-01-26 22:46:39 +11:00
parent 9bbd64a790
commit c0e3a13f9d

View file

@ -583,7 +583,7 @@ get_de() {
# the desktop variables are sometimes also set to the # the desktop variables are sometimes also set to the
# window manager name. This checks to see if WM == DE # window manager name. This checks to see if WM == DE
# and dicards the DE value. # and dicards the DE value.
[[ "$wm" && "$de" =~ $wm ]] && { unset -v de; return; } [[ "$wm" && "$de" =~ ^$wm$ ]] && { unset -v de; return; }
;; ;;
esac esac
@ -1966,7 +1966,7 @@ get_cols() {
# IMAGES # IMAGES
image_backend() { image_backend() {
if [[ ! "$image_backend" =~ (off|ascii) ]]; then if [[ ! "$image_backend" =~ ^(off|ascii)$ ]]; then
if ! type -p convert >/dev/null 2>&1; then if ! type -p convert >/dev/null 2>&1; then
image_backend="ascii" image_backend="ascii"
err "Image: Imagemagick not found, falling back to ascii mode." err "Image: Imagemagick not found, falling back to ascii mode."
@ -2019,7 +2019,7 @@ get_ascii() {
"$image_source" =~ \.(png|jpg|jpe|jpeg|gif)$ ]]; then "$image_source" =~ \.(png|jpg|jpe|jpeg|gif)$ ]]; then
# Fallback to distro ascii mode if custom ascii isn't found. # Fallback to distro ascii mode if custom ascii isn't found.
[[ ! "$image_source" =~ (auto|ascii)$ ]] && \ [[ ! "$image_source" =~ ^(auto|ascii)$ ]] && \
err "Ascii: Ascii file not found, using distro ascii." err "Ascii: Ascii file not found, using distro ascii."
# Fallback to distro ascii mode if source is an image. # Fallback to distro ascii mode if source is an image.