From a059e16f31f1053ff05de579e3220bab65d17860 Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Tue, 13 Jun 2023 13:49:15 +0200 Subject: Update ipass script for wayland However, it would appear that KDE doesn't support wtype. Neither does Gnome. Additionally, wl-copy doesn't seem to work on KDE if its called through a script launched through a shortcut. So effectively, the ipass script is known broken for wayland use, and there is no potential workaround. --- .local/bin/ipass | 48 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/.local/bin/ipass b/.local/bin/ipass index b19137a..4b0b2ee 100755 --- a/.local/bin/ipass +++ b/.local/bin/ipass @@ -1,19 +1,51 @@ #! /usr/bin/env sh -main() -{ +main() { cd -- "$HOME/.password-store" || exit 1 - file="$(find ./* -type f | sed 's-^\./--' | sed 's-\.gpg$--' | dmenu)" - dmenu_exit=$? + if [ -n "$WAYLAND_DISPLAY" ] + then + file="$(pass_list | fuzzel -d)" + wtype "$(pass_get "$file")" + + notify "Copied $file to clipboard!" + exit 0 + fi - if [ "$dmenu_exit" -ne 0 ] + if [ -n "$DISPLAY" ] then - exit 2 + file="$(pass_list | dmenu)" + pass_get "$file" | xdotool type --file - + dmenu_exit=$? + + if [ "$dmenu_exit" -ne 0 ] + then + notify "Error typing $file" + exit 2 + fi + + notify "Typing $file" + + exit 0 fi - pass show "$file" | head -n 1 | perl -pe 'chomp' | xdotool type --file - - notify-send -i "dialog-password" "ipass" "$file" + notify "No graphical environment detected" +} + +pass_list() { + find ./* -type f \ + | sed 's-^\./--' \ + | sed 's-\.gpg$--' +} + +pass_get() { + pass show "$1" \ + | head -n 1 \ + | perl -pe 'chomp' +} + +notify() { + notify-send -i "dialog-password" "ipass" "$*" } main "$@" -- cgit v1.1