diff --git a/totptui/totptui.sh b/totptui/totptui.sh index 4f1d517..824b028 100755 --- a/totptui/totptui.sh +++ b/totptui/totptui.sh @@ -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