aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2022-05-29 11:15:45 -0300
committerSilvio Rhatto <rhatto@riseup.net>2022-05-29 11:15:45 -0300
commit59035730a7417616a45e27ced00af9a9979d1455 (patch)
tree9348508037c85cf2954c65739210351f88126540
parent337627d31ba82f132a9c583e88c0b1b0fd6506a7 (diff)
downloadkvmx-59035730a7417616a45e27ced00af9a9979d1455.tar.gz
kvmx-59035730a7417616a45e27ced00af9a9979d1455.tar.bz2
Fix: kvmx-spice-copy: check if source/destination is a splice-client window
-rwxr-xr-xkvmx-spice-copy21
1 files changed, 16 insertions, 5 deletions
diff --git a/kvmx-spice-copy b/kvmx-spice-copy
index 524553d..3d87e4f 100755
--- a/kvmx-spice-copy
+++ b/kvmx-spice-copy
@@ -22,12 +22,18 @@
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
@@ -43,6 +49,11 @@ else
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
@@ -55,9 +66,9 @@ else
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"