From d66b219ef401962f36f2242823e9686966c003e5 Mon Sep 17 00:00:00 2001 From: Saumit Dinesan Date: Wed, 30 Mar 2022 22:44:27 +0530 Subject: using qrscan as a binary rather than alias --- .config/shell/aliasrc | 1 - .local/bin/passmenu | 16 +++++++--------- .local/bin/qrscan | 9 +++++++++ 3 files changed, 16 insertions(+), 10 deletions(-) create mode 100755 .local/bin/qrscan diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc index 9cf11e2..84b2ca8 100644 --- a/.config/shell/aliasrc +++ b/.config/shell/aliasrc @@ -38,7 +38,6 @@ alias \ sha="shasum -a 256" \ untar="tar -zxvf" \ untar2="tar xvf" \ - qrscan="xargs -I {} zbarimg -q {} | cut -b 1-8 --complement | xclip -sel c" \ cp="cp -iv" \ mv="mv -iv" \ mkd="mkdir -pv" #make a parent and sub directory diff --git a/.local/bin/passmenu b/.local/bin/passmenu index b2f41cb..385cf42 100755 --- a/.local/bin/passmenu +++ b/.local/bin/passmenu @@ -1,13 +1,11 @@ -#!/bin/sh - #!/usr/bin/env bash shopt -s nullglob globstar typeit=0 if [[ $1 == "--type" ]]; then - typeit=1 - shift + typeit=1 + shift fi prefix=${PASSWORD_STORE_DIR-~/.password-store} @@ -21,12 +19,12 @@ password=$(printf '%s\n' "${password_files[@]}" | dmenu "$@") pass_cmd=show if pass show "$password" | grep -q '^otpauth://'; then - pass_cmd=otp + pass_cmd=otp fi if [[ $typeit -eq 0 ]]; then - pass $pass_cmd -c "$password" 2>/dev/null - else - pass $pass_cmd "$password" | { IFS= read -r pass; printf %s "$pass"; } | - xdotool type --clearmodifiers --file - + pass $pass_cmd -c "$password" 2>/dev/null +else + pass $pass_cmd "$password" | { IFS= read -r pass; printf %s "$pass"; } | + xdotool type --clearmodifiers --file - fi diff --git a/.local/bin/qrscan b/.local/bin/qrscan new file mode 100755 index 0000000..dcd3983 --- /dev/null +++ b/.local/bin/qrscan @@ -0,0 +1,9 @@ +#!/bin/sh + +if [ -z "$1" ]; then + echo "Enter a valid image with QR code" +else + Link=$(zbarimg -q $1 | cut -b 1-8 --complement) && + echo $Link | xclip -sel c + notify-send "QR Link copied to clipboard" "$Link" +fi -- cgit v1.2.3