@@ -6,7 +6,7 @@ import Drawer from '@material-ui/core/Drawer';
66import List from '@material-ui/core/List' ;
77import ListItem from '@material-ui/core/ListItem' ;
88import Tooltip from '@material-ui/core/Tooltip' ;
9-
9+ import ListItemText from '@material-ui/core/ListItemText' ;
1010/** DIALOG **/
1111import TextField from '@material-ui/core/TextField' ;
1212import Dialog from '@material-ui/core/Dialog' ;
@@ -48,6 +48,7 @@ const path = require('path');
4848const url = require ( 'url' ) ;
4949
5050const ipc = window . require ( 'electron' ) . remote . ipcMain ;
51+ const globalShortcut = window . require ( 'electron' ) . remote . globalShortcut ;
5152
5253const noIMG = require ( './assets/img/NO-IMAGE.jpg' ) ;
5354
@@ -79,6 +80,13 @@ class ViewA extends React.Component {
7980 if ( typeof ( imagesStore ) !== 'undefined' ) {
8081 this . setState ( { images : imagesStore } )
8182 }
83+ var i = 1 ;
84+ for ( let w in workspacesStore ) {
85+ globalShortcut . register ( 'CommandOrControl+' + i , ( ) => {
86+ this . openWorkSpace ( w )
87+ } )
88+ i ++ ;
89+ }
8290 }
8391
8492 componentDidMount = ( ) => {
@@ -88,12 +96,20 @@ class ViewA extends React.Component {
8896 console . log ( arg [ 1 ] ) ;
8997 console . log ( arg [ 0 ] ) ;
9098 console . log ( arg ) ;
91- } )
99+ } ) ;
92100
101+
93102 }
94103
95104 componentWillUnmount = ( ) => {
96105 ipc . removeAllListeners ( ) ;
106+ globalShortcut . unregisterAll ( ) ;
107+ alert ( 'unmount' )
108+ }
109+
110+
111+ workspacesShortcut = ( quantity ) => {
112+
97113 }
98114
99115 /* Get 1st JSON object */
@@ -240,19 +256,31 @@ class ViewA extends React.Component {
240256
241257 _renderWorkspaces = ( ) => {
242258 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 ( ) ;
243265 for ( let workspace in this . state . workSpaces ) {
244266 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 } >
246268 { /*<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' } } >
249271 < Tooltip title = { workspace } enterDelay = { 700 } leaveDelay = { 200 } placement = "bottom" >
250272 < img style = { { opacity :this . activeColor ( workspace ) , backgroundColor :'#FFFFFF' } } alt = { workspace } className = "workspace-img" src = { this . getImageBase64 ( workspace ) } />
251273 { /*this.getImageBase64(workspace)*/ }
252274 </ Tooltip >
253275 </ a >
276+ </ div >
277+ < ListItemText className = "secondary" secondary = { `${ text } +${ i } ` } style = { { color : 'red' , textAlign : 'center' } } />
254278 </ ListItem >
255279 ) ;
280+ globalShortcut . register ( 'CommandOrControl+' + i , ( ) => {
281+ this . openWorkSpace ( workspace )
282+ } )
283+ i ++ ;
256284 } ;
257285 return children ;
258286 }
0 commit comments