@@ -185,6 +185,7 @@ const UI = {
185185 UI . initSetting ( 'bell' , 'on' ) ;
186186 UI . initSetting ( 'view_only' , false ) ;
187187 UI . initSetting ( 'show_dot' , false ) ;
188+ UI . initSetting ( 'notify_clipboard_received' , false ) ;
188189 UI . initSetting ( 'path' , 'websockify' ) ;
189190 UI . initSetting ( 'repeaterID' , '' ) ;
190191 UI . initSetting ( 'reconnect' , false ) ;
@@ -371,6 +372,8 @@ const UI = {
371372 UI . addSettingChangeHandler ( 'view_only' , UI . updateViewOnly ) ;
372373 UI . addSettingChangeHandler ( 'show_dot' ) ;
373374 UI . addSettingChangeHandler ( 'show_dot' , UI . updateShowDotCursor ) ;
375+ UI . addSettingChangeHandler ( 'notify_clipboard_received' ) ;
376+ UI . addSettingChangeHandler ( 'notify_clipboard_received' , UI . updateNotifyClipboardReceived ) ;
374377 UI . addSettingChangeHandler ( 'host' ) ;
375378 UI . addSettingChangeHandler ( 'port' ) ;
376379 UI . addSettingChangeHandler ( 'path' ) ;
@@ -892,6 +895,7 @@ const UI = {
892895 UI . updateSetting ( 'logging' ) ;
893896 UI . updateSetting ( 'reconnect' ) ;
894897 UI . updateSetting ( 'reconnect_delay' ) ;
898+ UI . updateSetting ( 'notify_clipboard_received' ) ;
895899
896900 document . getElementById ( 'noVNC_settings' )
897901 . classList . add ( "noVNC_open" ) ;
@@ -994,6 +998,13 @@ const UI = {
994998 }
995999 } ,
9961000
1001+ notifyClipboardReceived ( ) {
1002+ // When enabled with setting 'notify_clipboard_received', shows
1003+ // notification when a 'clipboard-received'-event is fired by
1004+ // the RFB instance.
1005+ UI . showStatus ( _ ( 'Clipboard updated' ) , 3000 ) ;
1006+ } ,
1007+
9971008 clipboardReceive ( e ) {
9981009 Log . Debug ( ">> UI.clipboardReceive: " + e . detail . text . substr ( 0 , 40 ) + "..." ) ;
9991010 document . getElementById ( 'noVNC_clipboard_text' ) . value = e . detail . text ;
@@ -1104,6 +1115,7 @@ const UI = {
11041115
11051116 UI . updateViewOnly ( ) ; // requires UI.rfb
11061117 UI . updateClipboard ( ) ;
1118+ UI . updateNotifyClipboardReceived ( ) ;
11071119 } ,
11081120
11091121 disconnect ( ) {
@@ -1809,6 +1821,14 @@ const UI = {
18091821 UI . rfb . showDotCursor = UI . getSetting ( 'show_dot' ) ;
18101822 } ,
18111823
1824+ updateNotifyClipboardReceived ( ) {
1825+ if ( ! UI . rfb ) return ;
1826+ UI . rfb . removeEventListener ( 'clipboardreceived' , UI . notifyClipboardReceived ) ;
1827+ if ( UI . getSetting ( 'notify_clipboard_received' ) ) {
1828+ UI . rfb . addEventListener ( 'clipboardreceived' , UI . notifyClipboardReceived ) ;
1829+ }
1830+ } ,
1831+
18121832 updateLogging ( ) {
18131833 WebUtil . initLogging ( UI . getSetting ( 'logging' ) ) ;
18141834 } ,
0 commit comments