From dca5e752977207527f664355920bfadb59e5ac72 Mon Sep 17 00:00:00 2001 From: T0MuX Date: Fri, 27 Dec 2024 07:18:25 +0100 Subject: [PATCH] +lps.sh --- {lps => bashrc.d}/lps.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) rename {lps => bashrc.d}/lps.sh (85%) diff --git a/lps/lps.sh b/bashrc.d/lps.sh similarity index 85% rename from lps/lps.sh rename to bashrc.d/lps.sh index 0c2ed4b..6f27944 100644 --- a/lps/lps.sh +++ b/bashrc.d/lps.sh @@ -1,3 +1,5 @@ +#!/bin/bash + # LASTPASS lp_login= color1='\e[31m' @@ -21,6 +23,13 @@ case "$color" in esac } +lp_clip(){ +case "$XDG_SESSION_TYPE" in + wayland) wl-copy $1;; + x11) xclip $1;; +esac +} + lps() { lp_check_login lpass ls > .lp_extract @@ -41,9 +50,9 @@ lp_item_id=$(echo ${SEARCH[$lp_item]} | awk -F' |]' '{printf $(NF-1)}') lp_item_id=${lp_item_id#* } lpass show $lp_item_id read -p "Press enter to clip user/pass..." -lpass show $lp_item_id --username | xclip +lpass show $lp_item_id --username | lp_clip echo "Username clipped for 4 seconds..."; sleep 4 -lpass show $lp_item_id --password | xclip +lpass show $lp_item_id --password | lp_clip echo "Password clipped" notify-send "Lastpass CLI" "Password clipped" rm .lp_extract