#!/bin/bash while getopts "c" flag 2>/dev/null; do case "${flag}" in c) from_clipboard=true ;; *) printf "[ERROR] Invalid flag: %s\n\n" "${flag}" help ;; esac done shift $((OPTIND - 1)) if [[ ! ${from_clipboard} ]]; then qr_content=$(kdialog --title "QR Code Generator" --inputbox "Enter QR Code contents:") else qr_content="$(wl-paste)" fi if [[ -z "${qr_content}" ]]; then printf 'No QR Code contents defined!\n' exit 1 fi qrencode -s 12 -o - "${qr_content}" | wl-copy wl-paste | feh -Z -