Skip to content

Commit

Permalink
update website & win7 more compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
RoderickQiu committed Mar 4, 2020
1 parent ab397ef commit ca9a3ec
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 25 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ This application is being frequently updated, so does this list.

## Contact

- Homepage: [wnr.scris.top](https://wnr.scris.top/).
- Homepage: [getwnr.com](https://getwnr.com/).

- Downloads: [Releases](https://github.com/RoderickQiu/wnr/releases/).

- Need Help: [Go to Help Page](https://wnr.scris.top/guide/1-basic-usage.html) or [Contact Me](mailto:[email protected]).
- Need Help: [Go to Help Page](https://getwnr.com/guide/1-basic-usage.html) or [Contact Me](mailto:[email protected]).

- Any issues or pull requests are appreciated.

Expand Down
70 changes: 53 additions & 17 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { app, BrowserWindow, ipcMain, Tray, Menu, globalShortcut, dialog, shell, powerSaveBlocker, powerMonitor, Notification, nativeTheme } = require('electron')
const { app, BrowserWindow, ipcMain, Tray, Menu, globalShortcut, dialog, shell, powerSaveBlocker, powerMonitor, systemPreferences, Notification, nativeTheme } = require('electron')
const Store = require('electron-store');
const store = new Store();
const path = require("path");
Expand All @@ -9,7 +9,7 @@ var Registry = require('winreg')
let win, settingsWin = null, aboutWin = null, tourWin = null;
let tray = null, contextMenu = null;
let resetAlarm = null, powerSaveBlockerId = null;
let isTimerWin = null, isWorkMode = null;
let isTimerWin = null, isWorkMode = null, isShadowless = null;
let timeLeftTip = null;
let predefinedTasks = null;
let pushNotificationLink = null
Expand Down Expand Up @@ -175,8 +175,8 @@ app.on('ready', () => {
})

globalShortcut.register('CommandOrControl+Shift+L', () => {
let focusWin = BrowserWindow.getFocusedWindow()
focusWin && focusWin.toggleDevTools()
let focusWin = BrowserWindow.getFocusedWindow();
focusWin && focusWin.toggleDevTools();
})//toggle devtools

if (store.get('islocked')) {//locked mode
Expand Down Expand Up @@ -282,6 +282,40 @@ app.on('ready', () => {
powerSaveBlockerId = powerSaveBlocker.start('prevent-app-suspension');
if (win != null) win.webContents.send('alter-start-stop', 'start')
})

if (process.platform == "win32") {
var regKey = new Registry({
hive: Registry.HKCU,
key: '\\Control Panel\\Desktop\\'
})
regKey.values(function (err, items) {
if (err)
return 'unset';
else {
for (var i = 0; i < items.length; i++) {
if (items[i].name == 'UserPreferencesMask') {
if (parseInt(items[i].value, 16).toString(2).charAt(21) == 1 && systemPreferences.isAeroGlassEnabled()) {
isShadowless = false;
try {
store.set("is-shadowless", false);
}
catch (e) {
console.log(e);
}
} else {
isShadowless = true;
try {
store.set("is-shadowless", true);
}
catch (e) {
console.log(e);
}
}
}
}
}
})
}//backport when shadow disabled
})

function notificationSolution(title, body, func) {
Expand Down Expand Up @@ -354,7 +388,7 @@ function traySolution(isFullScreen) {
}, {
label: i18n.__('website'),
click: function () {
shell.openExternal('https://wnr.scris.top/');
shell.openExternal('https://getwnr.com/');
}
}, {
label: i18n.__('github'),
Expand Down Expand Up @@ -455,7 +489,7 @@ function macOSFullscreenSolution(isFullScreen) {
}, {
label: i18n.__('website'),
click: function () {
shell.openExternal('https://wnr.scris.top/');
shell.openExternal('https://getwnr.com/');
}
}, {
label: i18n.__('github'),
Expand Down Expand Up @@ -726,17 +760,19 @@ ipcMain.on('delete-all-data', function () {
})

function windowCloseChk() {
dialog.showMessageBox(win, {
title: i18n.__('window-close-dialog-box-title'),
type: "warning",
message: i18n.__('window-close-dialog-box-content'),
checkboxLabel: i18n.__('window-close-dialog-box-chk'),
checkboxChecked: false
}).then(function (msger) {
if (msger.checkboxChecked) {
app.quit()
}
})
if (app.isPackaged)
dialog.showMessageBox(win, {
title: i18n.__('window-close-dialog-box-title'),
type: "warning",
message: i18n.__('window-close-dialog-box-content'),
checkboxLabel: i18n.__('window-close-dialog-box-chk'),
checkboxChecked: false
}).then(function (msger) {
if (msger.checkboxChecked) {
app.quit()
}
})
else app.quit()
}
ipcMain.on('window-close-chk', windowCloseChk);

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wnr",
"version": "1.12.2",
"version": "1.12.3",
"description": "It's a timer app with strong expansibility for computers. The name is an abbr of \"Work and Rest\".",
"main": "main.js",
"scripts": {
Expand All @@ -15,7 +15,7 @@
},
"author": "RoderickQiu",
"license": "MPL-2.0",
"homepage": "https://wnr.scris.top",
"homepage": "https://getwnr.com",
"appId": "com.scrisstudio.wnr",
"copyright": "(c) Roderick Qiu",
"productName": "wnr",
Expand Down
6 changes: 5 additions & 1 deletion renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@ function isLockMode() {
$('#predefined-tasks-divider').css('display', 'none');
}
}//lock mode settings
isLockMode()
isLockMode()

if (store.get("is-shadowless")) {
$('html').css('border', '#33333333 1px solid')
}
3 changes: 2 additions & 1 deletion res/builder/win.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ const config = {
"nsis": {
"installerLanguages": [
"en-US",
"zh-CN"
"zh-CN",
"zh-TW"
],
"guid": "B5BF1EA0-B474-40D3-B31E-6AD92477CCAF",
"license": "LICENSE",
Expand Down
4 changes: 2 additions & 2 deletions supporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ function call(content) {

function getHelp(idCode) {
require('electron').shell.openExternal(store.get("i18n") == 'zh' ?
'https://wnr.scris.top/zh/' + idCode + '.html' :
'https://wnr.scris.top/' + idCode + '.html');
'https://getwnr.com/zh/' + idCode + '.html' :
'https://getwnr.com/' + idCode + '.html');
}

function isInDark() {
Expand Down

0 comments on commit ca9a3ec

Please sign in to comment.