mirror of
				https://github.com/antos-rde/antosdk-apps.git
				synced 2025-10-31 10:25:39 +01:00 
			
		
		
		
	RemoteDesktop: sync clipboard between local and remote
This commit is contained in:
		| @@ -7,6 +7,7 @@ Further information on **wvnc**: [https://blog.lxsang.me/post/id/23](https://blo | |||||||
|  |  | ||||||
|  |  | ||||||
| ## Change logs | ## 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.9 - improve stability | ||||||
| * v0.1.7-8 - remove package dependencies, use web assembly for jpeg decoding, improve rendering performance and connection 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 | * v0.1.6 - Change category | ||||||
|   | |||||||
| @@ -7,6 +7,7 @@ Further information on **wvnc**: [https://blog.lxsang.me/post/id/23](https://blo | |||||||
|  |  | ||||||
|  |  | ||||||
| ## Change logs | ## 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.9 - improve stability | ||||||
| * v0.1.7-8 - remove package dependencies, use web assembly for jpeg decoding, improve rendering performance and connection 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 | * v0.1.6 - Change category | ||||||
|   | |||||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @@ -7,7 +7,7 @@ | |||||||
|         "author": "Dany LE", |         "author": "Dany LE", | ||||||
|         "email": "contact@iohub.dev" |         "email": "contact@iohub.dev" | ||||||
|     }, |     }, | ||||||
|     "version":"0.1.9-b", |     "version":"0.1.10-b", | ||||||
|     "dependencies": [], |     "dependencies": [], | ||||||
|     "category":"Internet", |     "category":"Internet", | ||||||
|     "icon": "icon.png", |     "icon": "icon.png", | ||||||
|   | |||||||
										
											Binary file not shown.
										
									
								
							| @@ -262,8 +262,13 @@ class WVNC | |||||||
|  |  | ||||||
|     sendTextAsClipboard: (text) -> |     sendTextAsClipboard: (text) -> | ||||||
|         return unless @socket |         return unless @socket | ||||||
|         console.log "send ", text |  | ||||||
|         @socket.send (@buildCommand 0x07, 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: () -> |     oncredential: () -> | ||||||
|         return new Promise (resolve, reject) -> |         return new Promise (resolve, reject) -> | ||||||
|   | |||||||
| @@ -88,6 +88,8 @@ class RemoteDesktop extends this.OS.application.BaseApplication | |||||||
|         @client = new WVNC {  |         @client = new WVNC {  | ||||||
|             element: @canvas |             element: @canvas | ||||||
|         } |         } | ||||||
|  |         @bindKey "CTRL-SHIFT-V", (e) => | ||||||
|  |             @pasteText() | ||||||
|         @client.onerror = (m) => |         @client.onerror = (m) => | ||||||
|             @error m |             @error m | ||||||
|             @showConnectionDialog() |             @showConnectionDialog() | ||||||
| @@ -103,6 +105,8 @@ class RemoteDesktop extends this.OS.application.BaseApplication | |||||||
|                 } |                 } | ||||||
|                 .then (d) -> |                 .then (d) -> | ||||||
|                     r(d)  |                     r(d)  | ||||||
|  |         @client.oncopy = (text) => | ||||||
|  |             @_api.setClipboard text | ||||||
|  |  | ||||||
|         @client.oncredential = () => |         @client.oncredential = () => | ||||||
|             return new Promise (r,e) => |             return new Promise (r,e) => | ||||||
| @@ -114,6 +118,23 @@ class RemoteDesktop extends this.OS.application.BaseApplication | |||||||
|         @client.init().then () =>  |         @client.init().then () =>  | ||||||
|             @showConnectionDialog() |             @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: () -> |     setScale: () -> | ||||||
|         return unless @client and @client.resolution |         return unless @client and @client.resolution | ||||||
|         w = $(@container).width() |         w = $(@container).width() | ||||||
|   | |||||||
| @@ -7,7 +7,7 @@ | |||||||
|         "author": "Dany LE", |         "author": "Dany LE", | ||||||
|         "email": "contact@iohub.dev" |         "email": "contact@iohub.dev" | ||||||
|     }, |     }, | ||||||
|     "version":"0.1.9-b", |     "version":"0.1.10-b", | ||||||
|     "dependencies": [], |     "dependencies": [], | ||||||
|     "category":"Internet", |     "category":"Internet", | ||||||
|     "icon": "icon.png", |     "icon": "icon.png", | ||||||
|   | |||||||
| @@ -365,7 +365,7 @@ | |||||||
| 		"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/RemoteDesktop/README.md", | 		"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/RemoteDesktop/README.md", | ||||||
| 		"category": "Internet", | 		"category": "Internet", | ||||||
| 		"author": "Dany LE", | 		"author": "Dany LE", | ||||||
| 		"version": "0.1.9-b", | 		"version": "0.1.10-b", | ||||||
| 		"dependencies": [],"category":"Internet","icon":"icon.png","mimes":["none"], | 		"dependencies": [],"category":"Internet","icon":"icon.png","mimes":["none"], | ||||||
| 		"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/RemoteDesktop/build/release/RemoteDesktop.zip" | 		"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/RemoteDesktop/build/release/RemoteDesktop.zip" | ||||||
| 	}, | 	}, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user