From f01a65aa30c098da14e91dd981b736ae6ee09e69 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 7 Nov 2016 01:40:27 +0100 Subject: [PATCH] os/arch/bin: -rofi-bspwm -rofi-pass +dpass --- os/arch/bin/dpass | 26 ++++++++++++++++++++++++++ os/arch/bin/rofi-bspwm | 10 ---------- os/arch/bin/rofi-pass | 32 -------------------------------- 3 files changed, 26 insertions(+), 42 deletions(-) create mode 100755 os/arch/bin/dpass delete mode 100755 os/arch/bin/rofi-bspwm delete mode 100755 os/arch/bin/rofi-pass diff --git a/os/arch/bin/dpass b/os/arch/bin/dpass new file mode 100755 index 00000000..8257e690 --- /dev/null +++ b/os/arch/bin/dpass @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +shopt -s nullglob globstar + +prefix=${PASSWORD_STORE_DIR-~/.password-store} +password_files=( "$prefix"/**/*.gpg ) +password_files=( "${password_files[@]#"$prefix"/}" ) +password_files=( "${password_files[@]%.gpg}" ) + +entry=$(printf "%s\n" "${password_files[@]}" | rofi -dmenu -p pass: "$@") + +[[ -n $entry ]] || exit +out=$(pass show "$entry") + +[[ $out ]] || exit +fields=$(echo "$out" | cut -d: -f1 | tail -n +2) +field=$(printf "password\n%s\n" "${fields[@]}" | rofi -dmenu -p pass:field:) + +case "$field" in + password) + pass -c "$entry" + ;; + *) + echo "$out" | grep "^${field}:" | awk '{print $2}' | xclip -selection clipboard -in + ;; +esac diff --git a/os/arch/bin/rofi-bspwm b/os/arch/bin/rofi-bspwm deleted file mode 100755 index c8e23ed2..00000000 --- a/os/arch/bin/rofi-bspwm +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -shopt -s nullglob globstar - -desktops=($(cat /tmp/bspwm-monitor-*)) -desktop=$(printf '%s\n' "${desktops[@]}" | rofi -dmenu -p bspwm: "$@") - -[[ -n $desktop ]] || exit - -bspc desktop -f $desktop diff --git a/os/arch/bin/rofi-pass b/os/arch/bin/rofi-pass deleted file mode 100755 index 586cd1f2..00000000 --- a/os/arch/bin/rofi-pass +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash - -shopt -s nullglob globstar - -prefix=${PASSWORD_STORE_DIR-~/.password-store} -password_files=( "$prefix"/**/*.gpg ) -password_files=( "${password_files[@]#"$prefix"/}" ) -password_files=( "${password_files[@]%.gpg}" ) - -password=$(printf "%s\n" "${password_files[@]}" | rofi -dmenu -p pass: "$@") - -[[ -n $password ]] || exit - -for browser in firefox chromium -do - wid=$(xdotool search --onlyvisible --name "$browser") - [[ $wid ]] && break -done - -# If browser is in focus, type it in -if [[ $wid = $(xdotool getwindowfocus) ]] -then - data="$(pass show "$password")" - pass="$(echo "$data" | head -1)" - login="$(echo "$data" | grep "^login:" | awk '{print $2}')" - - xdotool type --clearmodifiers "$login" - xdotool key Tab - xdotool type --clearmodifiers "$pass" -else - pass show -c "$password" 2>/dev/null -fi