Skip to content

Commit

Permalink
fix git tracking Preferences.js
Browse files Browse the repository at this point in the history
  • Loading branch information
zehfernandes committed Jul 13, 2018
1 parent 6058962 commit 10fbdba
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ node_modules
dist
release-builds
bundle.js
app.js
preferences.js
/app.js
/preferences.js
.vscode
48 changes: 33 additions & 15 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
// Pliim

const path = require("path");
const { BrowserWindow, Menu, ipcMain, shell, app } = require("electron");
const {
BrowserWindow,
Menu,
ipcMain,
shell,
dialog,
app
} = require("electron");
const AutoLaunch = require("auto-launch");
const menubar = require("menubar");

Expand Down Expand Up @@ -59,8 +66,30 @@ mb.on("ready", () => {
if (configs) event.sender.send("listeningConfigs", configs);
});

autoUpdater.init(mb.window);
/* Preferences */
ipcMain.on("set-laucher", (event, value) => {
store.set("launcher", value);
});

ipcMain.on("choose-wallpaper", (event, value) => {
dialog.showOpenDialog(
mb.window,
{
title: "Select your wallpaper",
properties: ["openFile"],
filters: [{ name: "Images", extensions: ["jpg", "png", "gif"] }]
},
function(filePath) {
if (filePath !== undefined) {
console.log(filePath);
store.set("selectedWallpaper", filePath);
}
}
);
});

/* Start */
autoUpdater.init(mb.window);
mb.window.once("ready-to-show", () => {
if (wasOpenedAtLogin) {
return;
Expand Down Expand Up @@ -104,8 +133,6 @@ Preference Window
});
};

ipcMain.on("getConfig", (event, options) => {});

/* -----------
Menu
------------ */
Expand Down Expand Up @@ -170,23 +197,14 @@ if (isSecondInstance) {
Auto-Laucher
------------ */

function toogleAutoLauch() {
const autoLaucher = store.get("laucher");
if (autoLaucher || autoLaucher === true) {
pliimAutoLauncher.enable();
} else {
pliimAutoLauncher.disable();
}
}

const pliimAutoLauncher = new AutoLaunch({
name: "Pliim",
path: "/Applications/Pliim.app"
});

const autoLaucher = store.get("laucher");
const autoLauncher = store.get("launcher");

if (autoLaucher || autoLaucher === true) {
if (autoLauncher || autoLauncher === true) {
pliimAutoLauncher.enable();
} else {
pliimAutoLauncher.disable();
Expand Down

0 comments on commit 10fbdba

Please sign in to comment.