From: Dmitry Fedotov Date: Sun, 24 Jan 2021 09:51:40 +0000 (+0300) Subject: Add pass dmenu script. Some configuration changes for vi and java. X-Git-Url: https://git.dmfe.net/?a=commitdiff_plain;h=1a8a981d7e29a936c8294a31364105d729a808cd;p=dotfiles Add pass dmenu script. Some configuration changes for vi and java. --- diff --git a/config/sxhkd/sxhkdrc b/config/sxhkd/sxhkdrc index e86cac4..661903a 100644 --- a/config/sxhkd/sxhkdrc +++ b/config/sxhkd/sxhkdrc @@ -25,6 +25,8 @@ super + shift + m ${SCRIPTS}/dmenumount.sh super + shift + x ${SCRIPTS}/screen-locker.sh +super + shift + p + ${SCRIPTS}/dmenu-pass.sh super + alt + l pkill -SIGUSR1 sxhkd diff --git a/scripts/dmenu-pass.sh b/scripts/dmenu-pass.sh new file mode 100755 index 0000000..84dc5ee --- /dev/null +++ b/scripts/dmenu-pass.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +shopt -s nullglob globstar + +typeit=0 +if [[ $1 == "--type" ]]; then + typeit=1 + shift +fi + +prefix=${PASSWORD_STORE_DIR-~/.password-store} +password_files=( "${prefix}"/**/*.gpg ) +password_files=( "${password_files[@]#"$prefix"/}" ) +password_files=( "${password_files[@]%.gpg}" ) + +panel_background=$(xrdb -query | grep '*.panel_background' | awk '{print $NF}') +selected_background=$(xrdb -query | grep '*.ws_focused' | awk '{print $NF}') + +password=$(printf '%s\n' "${password_files[@]}" | dmenu -fn Monospace-18 -nb "${panel_background}" -sb "${selected_background}" "$@") + +[[ -n $password ]] || exit + +if [[ $typeit -eq 0 ]]; then + pass show -c "${password}" 2>/dev/null && \ + notify-send "${password} copied to clipboard" +else + pass show "${password}" | { IFS= read -r pass; printf %s "$pass"; } | + xdotool type --clearmodifiers --file - +fi + diff --git a/shell/init_scripts/configs.mrc b/shell/init_scripts/configs.mrc index 31b529e..bf9d1e9 100644 --- a/shell/init_scripts/configs.mrc +++ b/shell/init_scripts/configs.mrc @@ -8,6 +8,7 @@ export XDG_CONFIG_HOME=${HOME}/.config alias vi='vi -c "let g:tty='\''$(tty)'\''"' +alias v='vi' alias i3c="vi ${HOME}/.config/i3/config" alias bsc="vi ${HOME}/.bashrc" alias tmux="tmux -f ${XDG_CONFIG_HOME}/tmux/config" diff --git a/shell/init_scripts/java.mrc b/shell/init_scripts/java.mrc index dd35bcf..2e80e5a 100644 --- a/shell/init_scripts/java.mrc +++ b/shell/init_scripts/java.mrc @@ -1,3 +1,3 @@ # /etc/skel/.javarc -export JAVA_HOME="/usr/lib/jvm/icedtea-bin-8" +export JAVA_HOME="/usr/lib/jvm/jdk-11" export GRADLE_HOME="/opt/gradle/gradle-6.4.1"