@@ -6,7 +6,7 @@ import Drawer from '@material-ui/core/Drawer';
6
6
import List from '@material-ui/core/List' ;
7
7
import ListItem from '@material-ui/core/ListItem' ;
8
8
import Tooltip from '@material-ui/core/Tooltip' ;
9
-
9
+ import ListItemText from '@material-ui/core/ListItemText' ;
10
10
/** DIALOG **/
11
11
import TextField from '@material-ui/core/TextField' ;
12
12
import Dialog from '@material-ui/core/Dialog' ;
@@ -48,6 +48,7 @@ const path = require('path');
48
48
const url = require ( 'url' ) ;
49
49
50
50
const ipc = window . require ( 'electron' ) . remote . ipcMain ;
51
+ const globalShortcut = window . require ( 'electron' ) . remote . globalShortcut ;
51
52
52
53
const noIMG = require ( './assets/img/NO-IMAGE.jpg' ) ;
53
54
@@ -79,6 +80,13 @@ class ViewA extends React.Component {
79
80
if ( typeof ( imagesStore ) !== 'undefined' ) {
80
81
this . setState ( { images : imagesStore } )
81
82
}
83
+ var i = 1 ;
84
+ for ( let w in workspacesStore ) {
85
+ globalShortcut . register ( 'CommandOrControl+' + i , ( ) => {
86
+ this . openWorkSpace ( w )
87
+ } )
88
+ i ++ ;
89
+ }
82
90
}
83
91
84
92
componentDidMount = ( ) => {
@@ -88,12 +96,20 @@ class ViewA extends React.Component {
88
96
console . log ( arg [ 1 ] ) ;
89
97
console . log ( arg [ 0 ] ) ;
90
98
console . log ( arg ) ;
91
- } )
99
+ } ) ;
92
100
101
+
93
102
}
94
103
95
104
componentWillUnmount = ( ) => {
96
105
ipc . removeAllListeners ( ) ;
106
+ globalShortcut . unregisterAll ( ) ;
107
+ alert ( 'unmount' )
108
+ }
109
+
110
+
111
+ workspacesShortcut = ( quantity ) => {
112
+
97
113
}
98
114
99
115
/* Get 1st JSON object */
@@ -240,19 +256,31 @@ class ViewA extends React.Component {
240
256
241
257
_renderWorkspaces = ( ) => {
242
258
let children = [ ] ;
259
+ var os = require ( 'os' ) ;
260
+ console . log ( 'plataforma: ' , remote . process . platform ) ;
261
+ //alert(Object.keys(this.state.workSpaces).length);
262
+ var text = remote . process . platform == 'darwin' ? 'cmd' : 'ctrl' ;
263
+ var i = 1 ;
264
+ globalShortcut . unregisterAll ( ) ;
243
265
for ( let workspace in this . state . workSpaces ) {
244
266
children . push (
245
- < ListItem className = "bttn" key = { workspace } style = { { borderRadius : 5 , borderLeft : this . activeColor ( workspace ) === 1 ? '2px solid #FF9735' : 'none' , borderRight : this . activeColor ( workspace ) === 1 ? '2px solid rgba(255, 151, 53, 0.000)' : 'none' } } >
267
+ < ListItem className = "bttn" key = { workspace } >
246
268
{ /*<span style={{borderLeft: this.activeColor(workspace) === 1 ? '1px dotted white' : 'none'}}></span>*/ }
247
- < div style = { { backgroundImage : 'red' , position : 'absolute' , left : 0 , width : 2 } } > </ div >
248
- < a onClick = { ( ) => { this . openWorkSpace ( workspace ) } } href = "#/" >
269
+ < div style = { { backgroundImage : 'red' , borderRadius : 8 , borderLeft : this . activeColor ( workspace ) === 1 ? '6px solid #FF9735' : 'none' , textAlign : 'center' } } >
270
+ < a onClick = { ( ) => { this . openWorkSpace ( workspace ) } } href = "#/" style = { { marginLeft : this . activeColor ( workspace ) === 1 ? '-6px' : '0px' } } >
249
271
< Tooltip title = { workspace } enterDelay = { 700 } leaveDelay = { 200 } placement = "bottom" >
250
272
< img style = { { opacity :this . activeColor ( workspace ) , backgroundColor :'#FFFFFF' } } alt = { workspace } className = "workspace-img" src = { this . getImageBase64 ( workspace ) } />
251
273
{ /*this.getImageBase64(workspace)*/ }
252
274
</ Tooltip >
253
275
</ a >
276
+ </ div >
277
+ < ListItemText className = "secondary" secondary = { `${ text } +${ i } ` } style = { { color : 'red' , textAlign : 'center' } } />
254
278
</ ListItem >
255
279
) ;
280
+ globalShortcut . register ( 'CommandOrControl+' + i , ( ) => {
281
+ this . openWorkSpace ( workspace )
282
+ } )
283
+ i ++ ;
256
284
} ;
257
285
return children ;
258
286
}
0 commit comments