diff --git a/roles/media/files/qcode.sh b/roles/media/files/qcode.sh new file mode 100755 index 0000000..44886c5 --- /dev/null +++ b/roles/media/files/qcode.sh @@ -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 - diff --git a/roles/media/tasks/main.yml b/roles/media/tasks/main.yml index 0766dbb..ed62623 100644 --- a/roles/media/tasks/main.yml +++ b/roles/media/tasks/main.yml @@ -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 diff --git a/roles/media/tasks/qcode.yml b/roles/media/tasks/qcode.yml new file mode 100644 index 0000000..2693208 --- /dev/null +++ b/roles/media/tasks/qcode.yml @@ -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