Skip to content

Commit

Permalink
release 2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Toinane committed May 17, 2022
1 parent 7b5711f commit 320b2b3
Show file tree
Hide file tree
Showing 27 changed files with 16,808 additions and 14,336 deletions.
22,105 changes: 10,207 additions & 11,898 deletions package-lock.json

Large diffs are not rendered by default.

130 changes: 64 additions & 66 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,69 +1,67 @@
{
"name": "colorpicker",
"productName": "colorpicker",
"version": "2.0.5",
"description": "Colorpicker is a little Electron app that can show colors with hex/rgb code, and generate shading for your color.",
"main": "src/main.js",
"scripts": {
"start": "npx electron src/main.js",
"standard": "standard",
"pack": "electron-builder --dir",
"publish": "snapcraft push --release=stable *.snap",
"release": "electron-builder --publish=never --config colorpicker-build.json",
"release-linux": "electron-builder --publish=never --config colorpicker-build.json --linux deb appImage",
"release-snap": "snapcraft snap",
"release-window": "electron-builder --publish=never --config colorpicker-build.json --win nsis portable",
"nightly": "electron-builder --publish=never --config colorpicker-build-nightly.json",
"nightly-linux": "electron-builder --publish=never --config colorpicker-build-nightly.json --linux deb appImage",
"rebuild": "npm rebuild --runtime=electron --target=9.4.4 --disturl=https://electronjs.org/headers --abi=80"
},
"repository": "https://github.com/toinane/colorpicker",
"keywords": [
"Colorpicker",
"colors",
"code",
"shading",
"picker",
"Toinane",
"Crea-THAT",
"crea-that"
"name": "colorpicker",
"productName": "colorpicker",
"version": "2.1.0",
"description": "Colorpicker is a little Electron app that can show colors with hex/rgb code, and generate shading for your color.",
"main": "src/main.js",
"scripts": {
"start": "npx electron src/main.js",
"standard": "standard",
"pack": "electron-builder --dir",
"publish": "snapcraft push --release=stable *.snap",
"release": "electron-builder --publish=never --config colorpicker-build.json",
"release-linux": "electron-builder --publish=never --config colorpicker-build.json --linux deb appImage",
"release-snap": "snapcraft snap",
"release-window": "electron-builder --publish=never --config colorpicker-build.json --win nsis portable",
"nightly": "electron-builder --publish=never --config colorpicker-build-nightly.json",
"nightly-linux": "electron-builder --publish=never --config colorpicker-build-nightly.json --linux deb appImage",
"rebuild": "npm rebuild --runtime=electron --target=18.2.3 --disturl=https://electronjs.org/headers --abi=103"
},
"repository": "https://github.com/toinane/colorpicker",
"keywords": [
"Colorpicker",
"colors",
"code",
"shading",
"picker",
"Toinane",
"Crea-THAT",
"crea-that"
],
"dependencies": {
"electron-json-storage": "^4.5.0",
"request": "^2.88.2",
"robotjs": "github:Toinane/robotjs",
"semver": "^7.3.7"
},
"optionalDependencies": {
"iohook": "^0.9.3",
"osx-mouse": "git+https://github.com/Toinane/osx-mouse",
"win-mouse": "github:Toinane/win-mouse"
},
"devDependencies": {
"electron": "^18.2.3",
"electron-builder": "^23.0.3",
"standard": "^17.0.0"
},
"author": {
"name": "Toinane",
"email": "[email protected]",
"url": "https://toinane.crea-th.at"
},
"bugs": "https://github.com/toinane/colorpicker/issues",
"homepage": "https://crea-th.at/p/colorpicker",
"license": "GPL-3.0",
"iohook": {
"targets": [
"electron-103"
],
"dependencies": {
"electron-json-storage": "^4.4.0",
"request": "^2.88.2",
"robotjs": "git+https://github.com/Toinane/robotjs",
"sortablejs": "^1.13.0",
"tippy.js": "^6.3.1"
},
"optionalDependencies": {
"iohook": "^0.9.0",
"osx-mouse": "git+https://github.com/Toinane/osx-mouse",
"win-mouse": "git+https://github.com/Toinane/win-mouse"
},
"devDependencies": {
"electron": "9.4.4",
"electron-builder": "22.10.5",
"minimist": "^1.2.5",
"standard": "16.0.3"
},
"author": {
"name": "Toinane",
"email": "[email protected]",
"url": "https://toinane.crea-th.at"
},
"bugs": "https://github.com/toinane/colorpicker/issues",
"homepage": "https://crea-th.at/p/colorpicker",
"license": "GPL-3.0",
"iohook": {
"targets": [
"electron-80"
],
"platforms": [
"linux"
],
"arches": [
"x64",
"ia32"
]
}
"platforms": [
"linux"
],
"arches": [
"x64",
"ia32"
]
}
}
166 changes: 82 additions & 84 deletions src/browsers/colorpicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,100 +3,98 @@
const { BrowserWindow, nativeImage } = require("electron");

module.exports = (dirname, storage, util) => {
const { touchbar } = util;
let win;
const { touchbar } = util;
let win;

/**
* [init]
* @param {boolean} force [force launching new window]
* @return {void} [new Colorpicker]
*/
let init = (force, color) => {
const size = storage.get("size");
if (win === null || win === undefined || force)
createWindow(size.width, size.height);
else win.show();
/**
* [init]
* @param {boolean} force [force launching new window]
* @return {void} [new Colorpicker]
*/
let init = (force, color) => {
const size = storage.get("size");
if (win === null || win === undefined || force)
createWindow(size.width, size.height);
else win.show();
};

/**
* [createWindow - create new Window]
* @param {int} width [width of the window]
* @param {int} height [height of the window]
* @return {void}
*/
let createWindow = (width, height) => {
const pos = storage.get("pos");
let options = {
frame: false,
autoHideMenuBar: true,
width: width,
height: height,
minWidth: 440,
minHeight: 150,
transparent: true,
icon: nativeImage.createFromPath(`${dirname}/build/icon.png`),
webPreferences: {
preload: `${dirname}/preload.js`,
},
};
if (pos) {
options.x = pos.x;
options.y = pos.y;
}

/**
* [createWindow - create new Window]
* @param {int} width [width of the window]
* @param {int} height [height of the window]
* @return {void}
*/
let createWindow = (width, height) => {
const pos = storage.get("pos");
let options = {
frame: false,
autoHideMenuBar: true,
width: width,
height: height,
minWidth: 440,
minHeight: 150,
transparent: true,
icon: nativeImage.createFromPath(`${dirname}/build/icon.png`),
webPreferences: {
nodeIntegration: true,
},
};
if (pos) {
options.x = pos.x;
options.y = pos.y;
}
win = new BrowserWindow(options);
win.loadURL(`file://${dirname}/views/colorpicker.html`);

win = new BrowserWindow(options);
win.loadURL(`file://${dirname}/views/colorpicker.html`);
if (touchbar) win.setTouchBar(touchbar);

if (touchbar) win.setTouchBar(touchbar);
win.on("closed", () => {
win = undefined;
let totalWin = BrowserWindow.getAllWindows();
for (let wins of totalWin) wins.close();
});

win.on("closed", () => {
win = undefined;
let totalWin = BrowserWindow.getAllWindows();
for (let wins of totalWin) wins.close();
});
windowEvents(win);
};

windowEvents(win);
};
/**
* [windowEvents - BrowserWindow events]
* @param {BrowserWindow} win [current window]
* @return {void}
*/
let windowEvents = (win) => {
let timing;

/**
* [windowEvents - BrowserWindow events]
* @param {BrowserWindow} win [current window]
* @return {void}
*/
let windowEvents = (win) => {
let timing;
win.on("focus", (event) => win.webContents.send("hasLooseFocus", false));
win.on("blur", (event) => win.webContents.send("hasLooseFocus", true));

win.on("focus", (event) =>
win.webContents.send("hasLooseFocus", false)
);
win.on("blur", (event) => win.webContents.send("hasLooseFocus", true));
win.on("resize", (event) => {
const size = win.getBounds();
clearTimeout(timing);
timing = setTimeout(
() =>
storage.add({
size: { width: size.width, height: size.height },
}),
300
);
});

win.on("resize", (event) => {
const size = win.getBounds();
clearTimeout(timing);
timing = setTimeout(
() =>
storage.add({
size: { width: size.width, height: size.height },
}),
300
);
});
win.on("move", (event) => {
const pos = win.getBounds();
clearTimeout(timing);
timing = setTimeout(
() => storage.add({ pos: { x: pos.x, y: pos.y } }),
300
);
});
};

win.on("move", (event) => {
const pos = win.getBounds();
clearTimeout(timing);
timing = setTimeout(
() => storage.add({ pos: { x: pos.x, y: pos.y } }),
300
);
});
};
let getWindow = () => win;

let getWindow = () => win;

return {
init: init,
getWindow: getWindow,
};
return {
init: init,
getWindow: getWindow,
};
};
Loading

0 comments on commit 320b2b3

Please sign in to comment.