SPOOL="$TMP/.kvmx-spice-copy"
BASENAME="`basename $0`"
WINDOWID="`xdotool getwindowfocus`"
-DEST="`xprop -id $WINDOWID | grep "^WM_NAME" | cut -d '=' -f 2 | cut -d '"' -f 2`"
+DEST="`xprop -id $WINDOWID | grep "^WM_NAME" | cut -d '=' -f 2 | cut -d '"' -f 2`"
+CLASS="`xprop -id $WINDOWID | grep "^WM_CLASS"`"
# Logic
if [ "$BASENAME" == "kvmx-spice-copy" ]; then
+ # Check if DEST is a spice-client or other window
+ if ! echo $CLASS | grep -q 'spicy'; then
+ DEST="host"
+ fi
+
mkdir -p "$TMP"
- echo "$DEST" > $SPOOL
+ echo "$DEST" > $SPOOL
# UX
if which awesome-client &> /dev/null; then
ORIG="host"
fi
+ # Check if DEST is a spice-client or other window
+ if ! echo $CLASS | grep -q 'spicy'; then
+ DEST="host"
+ fi
+
if [ "$ORIG" != "host" ] && ! kvmx running $ORIG &> /dev/null; then
ORIG="host"
fi
exit
fi
- if [ "$ORIG" == "host" ] && [ "$DEST" == "host" ]; then
- exit
- fi
+ #if [ "$ORIG" == "host" ] && [ "$DEST" == "host" ]; then
+ # exit
+ #fi
# Optional logging to ~/.xsession-erros
#echo "[kvmx-paste] [`date '+%Y%m%d %H:%M:%S'`] from $ORIG to $DEST"