diff options
author | Raymaekers Luca <luca@spacehb.net> | 2024-12-29 20:02:59 +0100 |
---|---|---|
committer | Raymaekers Luca <luca@spacehb.net> | 2024-12-29 20:02:59 +0100 |
commit | 112449dd19eaae6769ef95a70b3e52234256400c (patch) | |
tree | e2c1f0654bdea3c042b5b96068b4f463da6e4a7d /bin | |
parent | 70ac73bc332facb6b55044a8a6145ea805592d18 (diff) |
checkpoint
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/extra/notify-send | 81 | ||||
-rwxr-xr-x | bin/menuscripts/mpass | 2 |
2 files changed, 82 insertions, 1 deletions
diff --git a/bin/extra/notify-send b/bin/extra/notify-send new file mode 100755 index 0000000..3a3872b --- /dev/null +++ b/bin/extra/notify-send @@ -0,0 +1,81 @@ +#!/bin/sh +# Shell script to redirect notify-send calls to herbe. The purpose is to ignore +# options passed to notify-send. +# +# Option parser generated by getoptions +# URL: https://github.com/ko1nksm/getoptions +# LICENSE: Creative Commons Zero v1.0 Universal + +usage() { + printf '%s\n' "${0##*/}: notify-send replacement for herbe" "accepts but ignores all notify-send options." +} + +REST='' +parse() { + OPTIND=$(($#+1)) + while [ $# -gt 0 ] && OPTARG=; do + case $1 in + --?*=*) OPTARG=$1; shift + eval 'set -- "${OPTARG%%\=*}" "${OPTARG#*\=}"' ${1+'"$@"'} + ;; + -[utich]?*) OPTARG=$1; shift + eval 'set -- "${OPTARG%"${OPTARG#??}"}" "${OPTARG#??}"' ${1+'"$@"'} + ;; + -[!-]?*) OPTARG=$1; shift + eval 'set -- "${OPTARG%"${OPTARG#??}"}" "-${OPTARG#??}"' ${1+'"$@"'} + OPTARG= ;; + esac + case $1 in + -u | --urgency) + [ $# -le 1 ] && set -- "$1" required && break + OPTARG=$2 + _=$OPTARG + shift ;; + -t | --expire-time) + [ $# -le 1 ] && set -- "$1" required && break + OPTARG=$2 + _=$OPTARG + shift ;; + -i | --icon) + [ $# -le 1 ] && set -- "$1" required && break + OPTARG=$2 + _=$OPTARG + shift ;; + -c | --category) + [ $# -le 1 ] && set -- "$1" required && break + OPTARG=$2 + _=$OPTARG + shift ;; + -h | --hint) + [ $# -le 1 ] && set -- "$1" required && break + OPTARG=$2 + _=$OPTARG + shift ;; + -? | --help) + usage + exit 0 ;; + --) shift + while [ $# -gt 0 ]; do + REST="${REST} \"\${$(($OPTIND-$#))}\"" + shift + done + break ;; + [-]?*) set -- "$1" unknown && break ;; + *) REST="${REST} \"\${$(($OPTIND-$#))}\"" + esac + shift + done + [ $# -eq 0 ] && return 0 + case $2 in + unknown) echo "unrecognized option '$1'" ;; + noarg) echo "option '$1' doesn't allow an argument" ;; + required) echo "option '$1' requires an argument" ;; + pattern) echo "option '$1' does not match the pattern ($3)" ;; + *) echo "option '$1' validation error: $2" + esac >&2 + exit 1 +} + +parse "$@" +eval set -- "$REST" +herbe "$@" & diff --git a/bin/menuscripts/mpass b/bin/menuscripts/mpass index fb11091..5a09623 100755 --- a/bin/menuscripts/mpass +++ b/bin/menuscripts/mpass @@ -22,7 +22,7 @@ done [ "$file" ] || exit 1 pass show -c "$file" || exit 1 -herbe "*mpass" "$file" +herbe "_mpass" "*$file" [ "$WAYLAND_DISPLAY" ] && cliphist list >/dev/null && # on wayland and cliphist is running cliphist list | head -n 1 | cliphist delete |