aboutsummaryrefslogtreecommitdiff
path: root/kvmx-spice-copy
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2018-11-13 11:46:44 -0200
committerSilvio Rhatto <rhatto@riseup.net>2018-11-13 11:46:44 -0200
commit5d7ed814bc47dcf8aa81451a46b4356bdc337994 (patch)
tree95a03bfa95a813fcad08976efc71a7c65d5e8d98 /kvmx-spice-copy
parent3ac9833b481290433c15f44f3a53b52f603bdd20 (diff)
downloadkvmx-5d7ed814bc47dcf8aa81451a46b4356bdc337994.tar.gz
kvmx-5d7ed814bc47dcf8aa81451a46b4356bdc337994.tar.bz2
Working kvmx-copy and kvmx-paste
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