This repository has been archived on 2025-12-28. You can view files and clone it, but cannot push or open issues or pull requests.
inks-scripts/scripts/dmenuprompt

22 lines
459 B
Bash
Executable File

#!/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