add qcode script

To make this script particularly useful, configure a keyboard shortcut
for it and tell i3 to float the feh window.

Example:
4f7c1c9ea6

Original script source:
https://raw.githubusercontent.com/lathan/dotfiles/master/scripts/clipqr.sh
This commit is contained in:
Pig Monkey 2016-02-05 18:08:09 -08:00
parent 009998dbb6
commit 9e9f078483
3 changed files with 33 additions and 0 deletions

22
roles/media/files/qcode.sh Executable file
View file

@ -0,0 +1,22 @@
#!/bin/sh
#
# Generate a QR Code and display the resulting image.
#
# Data to encode may be provided either through standard input or as an
# argument. If no data is provided, the clipboard content will be used.
#
###############################################################################
IMG_VIEWER="feh -x --title qcode -"
read -t 0 stdin
if [ -n "$stdin" ]; then
source="$stdin"
elif [ -n "$1" ]; then
source="$1"
else
source=$(xclip -o -selection clipboard)
fi
echo "$source" | qrencode --size=10 -o - | $IMG_VIEWER -

View file

@ -14,6 +14,7 @@
- include: teiler.yml
- include: flac2all.yml
- include: darktable.yml
- include: qcode.yml
- name: Install misc media codecs and helpers
pacman: name={{ item }} state=present

View file

@ -0,0 +1,10 @@
---
- name: Install qrencode
pacman: name=qrencode state=present
tags:
- qcode
- name: Push qcode script
copy: src=qcode.sh dest=/usr/local/bin/qcode mode=0755
tags:
- qcode