parent
b828a6e9bc
commit
5984972bb7
|
@ -1,3 +1,8 @@
|
|||
|
||||
# npm
|
||||
node_modules/
|
||||
*.log
|
||||
|
||||
# os crap
|
||||
Thumbs.db
|
||||
~*
|
||||
|
|
|
@ -9,8 +9,7 @@
|
|||
},
|
||||
"file_handlers": {
|
||||
"edit": {
|
||||
"types": ["image/*"],
|
||||
"title": "Paint"
|
||||
"types": ["image/*"]
|
||||
}
|
||||
},
|
||||
"permissions": [
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"name": "jspaint",
|
||||
"version": "0.1.2",
|
||||
"description": "An MS Paint remake.",
|
||||
"main": "index.html",
|
||||
"scripts": {
|
||||
"start": "nw"
|
||||
},
|
||||
"window": {
|
||||
"icon": "images/icons/48.png",
|
||||
"toolbar": false
|
||||
},
|
||||
"dependencies": {
|
||||
"nw": "^0.12.0-1",
|
||||
"wallpaper": "^1.0.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "http://github.com/1j01/jspaint.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "http://github.com/1j01/jspaint/issues"
|
||||
}
|
||||
}
|
|
@ -757,6 +757,25 @@ function set_as_wallpaper_centered(c){
|
|||
layout: 'CENTER_CROPPED',
|
||||
name: file_name,
|
||||
}, function(){});
|
||||
}else if(window.require){
|
||||
var gui = require("nw.gui");
|
||||
var fs = require("fs");
|
||||
var wallpaper = require("wallpaper");
|
||||
|
||||
var base64 = c.toDataURL().replace(/^data:image\/png;base64,/, "");
|
||||
var imgPath = require("path").join(gui.App.dataPath, "bg.png");
|
||||
|
||||
fs.writeFile(imgPath, base64, "base64", function(err){
|
||||
if(err){
|
||||
alert("Failed to set as desktop background:\nCouldn't write temporary image file");
|
||||
}else{
|
||||
wallpaper.set(imgPath, function(err){
|
||||
if(err){
|
||||
alert("Failed to set as desktop background!\n" + err);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}else{
|
||||
window.open(c.toDataURL());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue