Skip to content

Instantly share code, notes, and snippets.

@medvedev
Last active October 12, 2023 15:48
Show Gist options
  • Save medvedev/b27b256a07666d1d14355a25c2f84d8b to your computer and use it in GitHub Desktop.
Save medvedev/b27b256a07666d1d14355a25c2f84d8b to your computer and use it in GitHub Desktop.
Linux quick OTP generator
#!/bin/bash
# Displays a list of environments in a middle of a screen, allowing to select one.
# After an item is selected, a corresponding OTP code is copied to the clipboard.
# Requires zenity and copiq installed (Flatpak does not count)
choice=$(zenity --list --column="Env" "Env1" "Env2" --title="Pick OTP")
# Perform actions based on user choice
case $choice in
"Env1")
copyq copy $(oathtool --totp '[Env1 key]')
;;
"Env2")
# Replace this with the action you want for Item 2
copyq copy $(oathtool --totp '[Env2 key]')
;;
*)
echo "No item selected"
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment