Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const app = electron.app;
const globalShortcut = electron.globalShortcut;
let screen;
let displays;
let currentDisplay = 0;
// Module to create native browser window.
const BrowserWindow = electron.BrowserWindow;
const Menu = electron.Menu;
const Tray = electron.Tray;
const ipc = require('electron').ipcMain;
const wallpaper = require('wallpaper');
let oldWallpaper;
wallpaper.get().then(imagePath => {
oldWallpaper = imagePath;
console.log(oldWallpaper);
});
let fileName = 'temp.png';
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow;
let appIcon;
function createWindow () {
// Create the browser window.
mainWindow = new BrowserWindow({width: 1366, height: 790, frame: false, skipTaskbar: true, enableLargerThanScreen: true});
app.dock.hide();
// and load the index.html of the app.
{
name: 'addToCollection',
message: 'Do you want add this photo to a collection?',
type: 'confirm',
default: false,
when: () => promptCollection && !flags.quiet,
},
]);
if (!confirmed && confirmWallpaper) {
const lastWP = config.get('lastWP');
wallpaper.set(lastWP);
return;
}
const currentWallpaper = await wallpaper.get();
config.set('lastWP', currentWallpaper);
if (liked === true && promptLike) {
const id = photo._id || photo.id;
try {
await User.likePhoto(id);
console.log();
console.log('Photo liked.');
} catch (error) {
errorHandler(error);
}
}
if (addToCollection === true && promptCollection) {
return new Promise((resolve, reject) => {
wallpaper.get()
.then(file => {
resolve(file);
})
.catch(err => {
//global.Log.error(`Get current System Wallpaper: ${err}`);
reject(err);
});
});
}
spinner.succeed = emptyFunction;
}
}
if (!config.get('directory') || !config.has('directory')) {
config.set('directory', pathFixer('~/Pictures/splash_photos'));
}
if (fs.existsSync(config.get('directory'))) {
mkdirp(config.get('directory'), (error) => {
if (error) return errorHandler(error);
});
}
if (!config.has('lastWP') || !config.get('lastWP')) {
const lastWP = await wallpaper.get();
config.set('lastWP', lastWP);
}
updateNotifier({ pkg: manifest, updateCheckInterval: 1000 * 30 }).notify();
if (frun()) {
await clearSettings();
await Unsplash.shared.picOfTheDay();
Sentry.captureMessage('New User', Sentry.Severity.Info);
printBlock(
chalk`Welcome to ${manifest.name}@{dim ${manifest.version}} {bold @${userInfo().username}}`,
'',
chalk`{dim CLI setup {green completed}!}`,
'',
export default function (opts, path) {
if (path) {
return wallpaper.set(path);
}
return wallpaper.get();
}
componentDidMount() {
this.getLocalPhotos();
wallpaper.get()
.then((path) => {
this.setState({ currentWallpaper: path });
});
}