mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-05-22 00:30:33 +08:00
✨ Feature(custom): update linux clipboard script for wayland
This commit is contained in:
@@ -17,18 +17,18 @@ if [ "$XDG_SESSION_TYPE" = "x11" ]; then
|
|||||||
echo $filePath
|
echo $filePath
|
||||||
fi
|
fi
|
||||||
elif [ "$XDG_SESSION_TYPE" = "wayland" ]; then
|
elif [ "$XDG_SESSION_TYPE" = "wayland" ]; then
|
||||||
command -v wl-copy >/dev/null 2>&1 || { echo >&1 "no wl-clipboard"; exit 1; }
|
command -v wl-paste >/dev/null 2>&1 || { echo >&1 "no wl-clipboard"; exit 1; }
|
||||||
filePath=`wl-copy -o 2>/dev/null | grep ^file:// | cut -c8-`
|
isImage=`wl-paste --list-types | grep image`
|
||||||
if [ ! -n "$filePath" ] ;then
|
if [ -n "$isImage" ]; then
|
||||||
if
|
wl-paste --type image/png > $1 2>/dev/null
|
||||||
wl-copy -t image/png -o >/dev/null 2>&1
|
echo $1
|
||||||
then
|
|
||||||
wl-copy -t image/png image/png -o >$1 2>/dev/null
|
|
||||||
echo $1
|
|
||||||
else
|
|
||||||
echo "no image"
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
echo $filePath
|
echo "no image"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
echo >&2 "Error: Unsupported session type '$XDG_SESSION_TYPE'."
|
||||||
|
echo >&2 "Solution: The variable of XDG_SESSION_TYPE must set as 'x11' or 'wayland'."
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user