Dotfiles_Generator/templates/rofi/rofisudo

31 lines
550 B
Plaintext
Executable File

{# symlink{~/bin/rofisudo} #}
#!/usr/bin/env bash
if [ -p /dev/stdin ] || [ ! -t 0 ]
then
data=$(< /dev/stdin)
fi
sudo -n true > /dev/null 2>&1
if [ $? -gt 0 ]
then
password=$(echo -n "" | rofi -dmenu\
-password\
-i\
-no-fixed-num-lines\
-p "Password:"\
-theme ~/.config/rofi/themes/askpass.rasi)
echo -n "$password" | sudo --stdin -v
fi
sudo -n true > /dev/null 2>&1
if [ $? -eq 0 ]
then
if [ ! -z "$data" ]
then
echo -n "$data" | sudo "$@"
else
sudo "$@"
fi
fi