#!/bin/bash

# A dmenu binary prompt script.
# Gives a dmenu prompt labelled with $1 to perform command $2.
# To invert the options, simply provide a thrid parameter $3.
# For example:
# `./prompt "Do you want to shutdown?" "shutdown now"`

# Taken shamelessly from Luke Smith

if [ -n "$3" ]
then
    choice=$(echo -e "Yes\nNo" | dmenu -bw 0 -i -p "$1")
else
    choice=$(echo -e "No\nYes" | dmenu -bw 0 -i -p "$1")
fi

if [ $choice = "Yes" ]
then
    $2
fi
