From 5d7ed814bc47dcf8aa81451a46b4356bdc337994 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Tue, 13 Nov 2018 11:46:44 -0200 Subject: Working kvmx-copy and kvmx-paste --- kvmx-spice-copy | 13 ++++++++----- 1 file 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 -- cgit v1.2.3