zathura-pywal

A better version of zathura-pywal that saves settings and features alpha transparency
git clone git://mattcarlson.org/repos/zathura-pywal.git
Log | Files | Refs | README

commit 451f8f181cda9366c2d3358bcd2b280db752c0e2
parent 98309ddbfb5967a5accc47cd0e6a67254b18d995
Author: Matthew Carlson <matt@mcarlson.xyz>
Date:   Wed, 28 Jul 2021 15:25:40 -0400

removed perl regex

Diffstat:
Mzathura-pywal | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/zathura-pywal b/zathura-pywal @@ -6,7 +6,7 @@ NEWLINE=' ' ZATHURA_DIR="${XDG_CONFIG_HOME:-${HOME}/.config/}/zathura/" ZATHURARC="${ZATHURA_DIR}/zathurarc" -GREPDIR="/usr/share/zathura-pywal/settings" +SETTINGS="/usr/share/zathura-pywal/settings" COLORS="${XDG_CACHE_HOME:-${HOME}/.cache/}/wal/colors.sh" usage() { @@ -20,7 +20,8 @@ zathura_pywal() { printf 'Checking for zathurarc...\n' if [ -f "${ZATHURARC}" ]; then printf 'Backing up zathurarc...\n' - settings="$(grep -v -f "${GREPDIR}" "${ZATHURARC}" | sed '/^$/d' )" + [ ! -f "${SETTINGS}" ] && printf 'Settings not found.\n' && return 1 + settings="$(grep -f "${SETTINGS}" -v "${ZATHURARC}" | sed '/^$/d' )" cp "${ZATHURARC}" "${ZATHURARC}.bak" else printf 'Creating zathurarc...\n' @@ -143,7 +144,7 @@ main() { case "${o}" in a) alpha="${OPTARG}" - if ! printf '%s' "${alpha}" | grep -q -P '^0*\.+[0-9]+$|^[0-1]$'; then + if ! printf '%s' "${alpha}" | grep -q '^0*\.[0-9][0-9]*$\|^[0-1]$'; then printf 'Alpha must be a decimal value between 0 and 1.\n' usage return 1