Add rofi sudo scripts
This commit is contained in:
parent
5b8fa6ef0e
commit
8bab72ac23
14
templates/rofi/askpass-rofi
Normal file
14
templates/rofi/askpass-rofi
Normal file
@ -0,0 +1,14 @@
|
||||
{# symlink{~/bin/askpass-rofi} #}
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -p /dev/stdin ]
|
||||
then
|
||||
data=$(< /dev/stdin)
|
||||
fi
|
||||
|
||||
rofi -dmenu\
|
||||
-password\
|
||||
-i\
|
||||
-no-fixed-num-lines\
|
||||
-p "Password:"\
|
||||
-theme ~/.config/rofi/themes/askpass.rasi
|
||||
30
templates/rofi/rofisudo
Normal file
30
templates/rofi/rofisudo
Normal file
@ -0,0 +1,30 @@
|
||||
{# 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
|
||||
Loading…
Reference in New Issue
Block a user