bins/rage: add support for wayland clipboard

This commit is contained in:
Aaron Bieber 2023-01-03 10:41:29 -07:00
parent f58368fc52
commit 3394c58671
No known key found for this signature in database

View File

@ -2,7 +2,11 @@
let let
oathPkg = pkgs.oath-toolkit or pkgs.oathToolkit; oathPkg = pkgs.oath-toolkit or pkgs.oathToolkit;
clip = if pkgs.system == "aarch64-darwin" then wlclip = if pkgs.system == "aarch64-darwin" then
""
else
"${pkgs.wl-clipboard}/bin/wl-copy";
xclip = if pkgs.system == "aarch64-darwin" then
"pbcopy" "pbcopy"
else else
"${pkgs.xclip}/bin/xclip"; "${pkgs.xclip}/bin/xclip";
@ -63,11 +67,16 @@ in ''
fi fi
;; ;;
cp) cp)
CLIP=${xclip}
if [ ! -z $WAYLAND_DISPLAY ]; then
CLIP=${wlclip}
fi
if [ -f $2 ]; then if [ -f $2 ]; then
${pkgs.age}/bin/age -i $identity -d $2 | ${clip} ${pkgs.age}/bin/age -i $identity -d $2 | $CLIP
else else
F=$(list | grep $2) F=$(list | grep $2)
${pkgs.age}/bin/age -i $identity -d "$F" | ${clip} ${pkgs.age}/bin/age -i $identity -d "$F" | $CLIP
fi fi
;; ;;
otp) otp)