Output the connection URL in machine readable (barcode) format?
martlin2cz opened this issue · comments
Hello,
I was just wondering whether the connection URL (or the whole command) could be (optionally) outputed in a way a smartphone camera can quickly scan that by the barcode/QR scanner instead of typing the long generated string of characters on the tiny smartphone keyboard.
I guess there exists some ASCII-art based QR or barcode generating library which could get utilised for that purpose.
Regards
Assuming you can fetch the part you want as a QR code yourself, you can use qrencode
to generate a QR code in a terminal:
$ echo "hello world" | qrencode -t UTF8 -o -
█████████████████████████████
█████████████████████████████
████ ▄▄▄▄▄ █▀▄█▀▄█ ▄▄▄▄▄ ████
████ █ █ █▀▄█▀██ █ █ ████
████ █▄▄▄█ █▀▀ ▄ █ █▄▄▄█ ████
████▄▄▄▄▄▄▄█▄█ ▀ █▄▄▄▄▄▄▄████
████▄ ▄▄▄▀▄▄ ▄██ ▀ ▀ ▀▄▀████
████ █▄▄██▄▀█ ▀▄█ ▄█▀ ▄█████
████▄▄███▄▄█▀▄ ▄▀▄▄█▀▀██ ████
████ ▄▄▄▄▄ █▄▄ █▄▀▄▀█▀ ▄█████
████ █ █ █ ▀█▀▀ ▀▀█▄▄████
████ █▄▄▄█ █ █▀█ ▀█▄▀▀ ██████
████▄▄▄▄▄▄▄█▄▄█▄▄█▄█▄██▄█████
█████████████████████████████
█████████████████████████████
Oh, amazing idea. Just to provide full solution, here may be the full command, (execute within your running session):
$ tmate display -p '#{tmate_ssh}' | tr -d 'ssh ' | qrencode -t UTF8 -o -
to display only the ssh command address or:
$ tmate display -p '#{tmate_web}' | qrencode -t UTF8 -o -
for the URL of the web view.