U:totptui.sh wayland !

This commit is contained in:
T0MuX 2025-04-03 16:56:36 +02:00
parent e2e4236f36
commit 495c4c85a2

View file

@ -84,8 +84,19 @@ TOTP_CODE=$(oathtool $OATHTOOL_ARGS "$key")
#clear; echo -e "\e[31m$(figlet $TOTP_CODE)\e[0m"
figlet_output=$(figlet -f slant "$TOTP_CODE")
if [ -f /usr/bin/xclip ]; then echo $TOTP_CODE | xclip; fi
if [ -f /data/data/com.termux/files/usr/bin/termux-clipboard-set ]; then echo $TOTP_CODE | termux-clipboard-set; fi
#if [ -f /usr/bin/xclip ]; then echo $TOTP_CODE | xclip; fi
#if [ -f /data/data/com.termux/files/usr/bin/termux-clipboard-set ]; then echo $TOTP_CODE | termux-clipboard-set; fi
if command -v termux-clipboard-set &>/dev/null; then
echo "$TOTP_CODE" | termux-clipboard-set
elif [ -n "$WAYLAND_DISPLAY" ] && command -v wl-copy &>/dev/null; then
echo "$TOTP_CODE" | wl-copy
elif [ -n "$DISPLAY" ] && command -v xclip &>/dev/null; then
echo "$TOTP_CODE" | xclip -selection clipboard
elif [ -n "$DISPLAY" ] && command -v xsel &>/dev/null; then
echo "$TOTP_CODE" | xsel --clipboard --input
else
echo "Aucun gestionnaire de presse-papier détecté."
fi
whiptail --title "TOTP-TUI" --msgbox "TOTP \"$account_name\" :\n\n$figlet_output" 14 45
exit
#done