This script will generate a password using a pick list in Rofi, and it is written to run on the Wayland compositor.
#!/bin/bash
function d_program() {
{
printf '%s\n' "16 non complex"
printf '%s\n' "24 non complex"
printf '%s\n' "32 non complex"
printf '%s\n' "64 non complex"
printf '%s\n' "96 non complex"
printf '%s\n' "16 complex"
printf '%s\n' "24 complex"
printf '%s\n' "32 complex"
printf '%s\n' "64 complex"
printf '%s\n' "96 complex"
} | dmenu -l 20 -c -b -fn 'SauceCodePro Nerd Font-16' -sb "#cd1bcb" -h 30 -bw 3 -i -p '' ${dmenu_args[@]}
}
choice=$(d_program)
if [[ $choice =~ ^$ ]]; then
exit 0
fi
chars="a-zA-Z0-9"
length=$(echo $choice | sed 's/\([0-9][0-9]\)\(.\+\)/\1/')
type=$(echo $choice | sed 's/\([0-9][0-9]\)\(.\+\)/\2/')
if [[ type =~ ^complex$ ]]; then
chars=" a-zA-Z0-9!#$%&()*+-:?@^_{|}~"
fi
pass=$(tr -dc $chars < /dev/urandom | head -c $length)
copied=$(echo -n "$pass" | tr -d '\n' | wl-copy)
notify-send "Generated password [$length] : "$pass --expire-time=2500
exit 0