aboutsummaryrefslogtreecommitdiff
path: root/kvmx-spice-copy
diff options
context:
space:
mode:
Diffstat (limited to 'kvmx-spice-copy')
-rwxr-xr-xkvmx-spice-copy13
1 files changed, 8 insertions, 5 deletions
diff --git a/kvmx-spice-copy b/kvmx-spice-copy
index 3102a33..6d9d3bd 100755
--- a/kvmx-spice-copy
+++ b/kvmx-spice-copy
@@ -21,12 +21,16 @@
# Parameters
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`"
# Logic
if [ "$BASENAME" == "kvmx-spice-copy" ]; then
mkdir -p "$TMP"
echo "$DEST" > $SPOOL
+
+ # Optional logging to ~/.xsession-erros
+ #echo "[kvmx-copy] [`date '+%Y%m%d %H:%M:%S'`] set ORIG to $DEST"
else
if [ -f "$SPOOL" ]; then
ORIG="`cat $SPOOL`"
@@ -35,14 +39,10 @@ else
fi
if [ "$ORIG" != "host" ] && ! kvmx running $ORIG &> /dev/null; then
- exit
+ ORIG="host"
fi
if [ "$DEST" != "host" ] && ! kvmx running $DEST &> /dev/null; then
- exit
- fi
-
- if ! kvmx running $DEST &> /dev/null; then
DEST="host"
fi
@@ -54,6 +54,9 @@ else
exit
fi
+ # Optional logging to ~/.xsession-erros
+ #echo "[kvmx-paste] [`date '+%Y%m%d %H:%M:%S'`] from $ORIG to $DEST"
+
# Dispatch
kvmx-clipboard $ORIG $DEST
fi