Skip to content

Commit

Permalink
Add OS-aware clipboard copying, add Linux clipboard support and updat…
Browse files Browse the repository at this point in the history
…e README with Linux instructions
  • Loading branch information
David Jimenez Sequero committed Mar 2, 2017
1 parent 0a954bf commit 642cce1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -11,7 +11,7 @@ This script supports both encrypted and plain-text token files, but my reccomend

* oathtool (http://www.nongnu.org/oath-toolkit/)
* OpenSSL

* xclip (Linux)

## Description

Expand Down Expand Up @@ -50,7 +50,7 @@ The number on the left is the seconds counter; a new TOTP token is generated eve

The number on the right is the 6-digit One-Time Password.

On MacOS, this will be copied directly into the paste buffer. Just press "Command-V" to paste into a login dialog.
This will be copied directly into the paste buffer. Just press "Command-V" (or "CTRL-V" on Linux) to paste into a login dialog.


## Contents
Expand Down
7 changes: 6 additions & 1 deletion otp.sh
Expand Up @@ -57,6 +57,11 @@ while true; do
else
echo -ne "$D: $X\r"
fi
echo -n $X | pbcopy
OS=$( uname )
if [[ $OS = "Darwin" ]]; then
echo -n $X | pbcopy
elif [[ $OS = "Linux" ]]; then
echo -n $X | xclip -sel clip
fi
sleep 1
done

0 comments on commit 642cce1

Please sign in to comment.