RemoteDesktop: sync clipboard between local and remote

This commit is contained in:
DanyLE 2022-08-17 18:43:52 +02:00
parent a4943e83d1
commit f3a8f17ef1
9 changed files with 34 additions and 6 deletions

View File

@ -7,6 +7,7 @@ Further information on **wvnc**: [https://blog.lxsang.me/post/id/23](https://blo
## Change logs
* v0.1.10 - Allow to sync clipboard between local and remote machine, CTRL+SHIF+V to paste text from local to remote machine
* v0.1.9 - improve stability
* v0.1.7-8 - remove package dependencies, use web assembly for jpeg decoding, improve rendering performance and connection stability
* v0.1.6 - Change category

View File

@ -7,6 +7,7 @@ Further information on **wvnc**: [https://blog.lxsang.me/post/id/23](https://blo
## Change logs
* v0.1.10 - Allow to sync clipboard between local and remote machine, CTRL+SHIF+V to paste text from local to remote machine
* v0.1.9 - improve stability
* v0.1.7-8 - remove package dependencies, use web assembly for jpeg decoding, improve rendering performance and connection stability
* v0.1.6 - Change category

File diff suppressed because one or more lines are too long

View File

@ -7,7 +7,7 @@
"author": "Dany LE",
"email": "contact@iohub.dev"
},
"version":"0.1.9-b",
"version":"0.1.10-b",
"dependencies": [],
"category":"Internet",
"icon": "icon.png",

View File

@ -262,8 +262,13 @@ class WVNC
sendTextAsClipboard: (text) ->
return unless @socket
console.log "send ", text
@socket.send (@buildCommand 0x07, text)
# send ctrl-v to paste
charcode = 'v'.charCodeAt 0
@sendKeyEvent 0xFFE3, 1 # CTRL down
@sendKeyEvent charcode, 1 # v down
@sendKeyEvent charcode, 0 # v up
@sendKeyEvent 0xFFE3, 0 # CTRL up
oncredential: () ->
return new Promise (resolve, reject) ->

View File

@ -88,6 +88,8 @@ class RemoteDesktop extends this.OS.application.BaseApplication
@client = new WVNC {
element: @canvas
}
@bindKey "CTRL-SHIFT-V", (e) =>
@pasteText()
@client.onerror = (m) =>
@error m
@showConnectionDialog()
@ -103,6 +105,8 @@ class RemoteDesktop extends this.OS.application.BaseApplication
}
.then (d) ->
r(d)
@client.oncopy = (text) =>
@_api.setClipboard text
@client.oncredential = () =>
return new Promise (r,e) =>
@ -114,6 +118,23 @@ class RemoteDesktop extends this.OS.application.BaseApplication
@client.init().then () =>
@showConnectionDialog()
pasteText: () ->
return unless @client
cb = (text) =>
return unless text and text isnt ""
@client.sendTextAsClipboard text
@_api.getClipboard()
.then (text) =>
cb(text)
.catch (e) =>
@error __("Unable to paste"), e
#ask for user to enter the text manually
@openDialog("TextDialog", { title: "Paste text"})
.then (text) =>
cb(text)
.catch (err) => @error err.toString(), err
setScale: () ->
return unless @client and @client.resolution
w = $(@container).width()

View File

@ -7,7 +7,7 @@
"author": "Dany LE",
"email": "contact@iohub.dev"
},
"version":"0.1.9-b",
"version":"0.1.10-b",
"dependencies": [],
"category":"Internet",
"icon": "icon.png",

View File

@ -365,7 +365,7 @@
"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/RemoteDesktop/README.md",
"category": "Internet",
"author": "Dany LE",
"version": "0.1.9-b",
"version": "0.1.10-b",
"dependencies": [],"category":"Internet","icon":"icon.png","mimes":["none"],
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/RemoteDesktop/build/release/RemoteDesktop.zip"
},