dotfiles/.local/bin/dmenuprompt
Marty Oehme df45a08c6c Move scripts to .local/bin
Moved all personal scripts to ~/.local/bin to be systemd file hierarchy
compliant, as well as XDG compliant. Since they are not configuration
options they don't have anything to do in .config directories.
Also, it's just easier to find than the previous .config/scripts/bin.
2019-05-23 11:20:11 +02:00

16 lines
728 B
Bash
Executable file

#!/bin/sh
# A dmenu binary prompt script.
# Gives a dmenu prompt labeled with $1 to perform command $2.
# For example:
# `./prompt "Do you want to shutdown?" "shutdown -h now"`
if [[ -z $3 ]] || [[ $3 == "normal" ]]; then
[ "$(printf "No\\nYes" | dmenu -i -p "$1")" = "Yes" ] && $2
elif [[ $3 == "success" ]]; then
[ "$(printf "No\\nYes" | dmenu -i -p "$1" -nb webgreen -sb greenyellow -sf black -nf white )" = "Yes" ] && $2
elif [[ $3 == "warn" ]] || [[ $3 == "warning" ]]; then
[ "$(printf "No\\nYes" | dmenu -i -p "$1" -nb goldenrod -sb gold -sf black -nf white )" = "Yes" ] && $2
elif [[ $3 == "danger" ]]; then
[ "$(printf "No\\nYes" | dmenu -i -p "$1" -nb darkred -sb red -sf white -nf gray )" = "Yes" ] && $2
fi