mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-28 18:00:09 +00:00
more work on the electron layer...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
70b65d034f
commit
3bc744e524
@ -11,6 +11,12 @@ if(typeof(process) != 'undefined'){
|
||||
var pathlib = requirejs('path')
|
||||
}
|
||||
|
||||
var electron
|
||||
try{
|
||||
electron = requirejs('electron')
|
||||
} catch(e){ }
|
||||
|
||||
|
||||
var actions = require('lib/actions')
|
||||
var features = require('lib/features')
|
||||
var toggler = require('lib/toggler')
|
||||
@ -109,28 +115,39 @@ module.NWHost = core.ImageGridFeatures.Feature({
|
||||
|
||||
var ElectronHostActions = actions.Actions({
|
||||
get title(){
|
||||
},
|
||||
return electron.remote.getCurrentWindow().getTitle() },
|
||||
set title(value){
|
||||
},
|
||||
electron.remote.getCurrentWindow().setTitle(value) },
|
||||
|
||||
minimize: ['Window/Minimize',
|
||||
function(){
|
||||
// XXX
|
||||
}],
|
||||
electron.remote.getCurrentWindow().minimize() }],
|
||||
|
||||
showDevTools: ['Interface|Development/Show Dev Tools',
|
||||
function(){
|
||||
// XXX
|
||||
}],
|
||||
electron.remote.getCurrentWindow().openDevTools() }],
|
||||
|
||||
// XXX make this portable (osx, linux)...
|
||||
showInFolder: ['File|Image/Show in $folder',
|
||||
function(image){
|
||||
// XXX
|
||||
image = this.images[this.data.getImage(image)]
|
||||
|
||||
var base = image.base_path || this.location.path
|
||||
var filename = image.path
|
||||
var path = pathlib.normalize(base + '/' + filename)
|
||||
|
||||
requirejs('child_process')
|
||||
// XXX make this portable (osx, linux)...
|
||||
.exec('explorer.exe /select,'+JSON.stringify(path.replace(/\//g, '\\')))
|
||||
//.exec('open -R '+JSON.stringify(path))
|
||||
}],
|
||||
|
||||
// XXX this is almost generic, but it is not usable unless within
|
||||
// a user event handler...
|
||||
// ...can we use this on electron???
|
||||
// if this fails use:
|
||||
// electron.remote.getCurrentWindow().isFullScreen(..)
|
||||
// electron.remote.getCurrentWindow().setFullScreen(..)
|
||||
toggleFullScreen: ['Window/Full screen mode',
|
||||
toggler.CSSClassToggler(
|
||||
function(){ return document.body },
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user