]> gitweb.fluxo.info Git - kvmx.git/commitdiff
Working kvmx-copy and kvmx-paste
authorSilvio Rhatto <rhatto@riseup.net>
Tue, 13 Nov 2018 13:46:44 +0000 (11:46 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Tue, 13 Nov 2018 13:46:44 +0000 (11:46 -0200)
kvmx-spice-copy

index 3102a33c1b4c8a6be38ebcacf11d7ea212efb67f..6d9d3bd103bf8495201732804b3ec1d0fd75e670 100755 (executable)
 # 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