From e23ce66d756696b6cf53392dbdbb1ed02b8f9898 Mon Sep 17 00:00:00 2001 From: Roderick Qiu Date: Fri, 1 May 2020 10:03:58 +0800 Subject: [PATCH] optimized for mac exp --- locales/en.json | 3 ++- locales/zh-CN.json | 5 +++-- locales/zh-TW.json | 5 +++-- main.js | 17 ++++++++++++----- package.json | 2 +- timer.html | 3 +++ 6 files changed, 24 insertions(+), 11 deletions(-) diff --git a/locales/en.json b/locales/en.json index 76ae00e..2177e1f 100644 --- a/locales/en.json +++ b/locales/en.json @@ -213,5 +213,6 @@ "personalization-white-or-dark-tip": "Select whether you like light mode or the dark one.", "personalization-white-or-dark-mode-white": "Light Mode", "personalization-white-or-dark-mode-dark": "Dark Mode", - "personalization-white-or-dark-mode-auto": "Auto Switch" + "personalization-white-or-dark-mode-auto": "Auto Switch", + "stopped": "Stopped" } \ No newline at end of file diff --git a/locales/zh-CN.json b/locales/zh-CN.json index a5e76a3..a56f103 100644 --- a/locales/zh-CN.json +++ b/locales/zh-CN.json @@ -120,7 +120,7 @@ "working": "工作", "resting": "休息", "looping": "循环", - "time-left": "% 时间剩余", + "time-left": "% 剩余", "add": "添加", "delete": "删除", "predefined-tasks-settings": "预设设置", @@ -213,5 +213,6 @@ "personalization-white-or-dark-tip": "选择是始终使用明亮模式、暗黑模式还是自动切换(部分系统不支持自动切换,将会始终使用明亮模式)。", "personalization-white-or-dark-mode-white": "明亮模式", "personalization-white-or-dark-mode-dark": "暗黑模式", - "personalization-white-or-dark-mode-auto": "自动选择" + "personalization-white-or-dark-mode-auto": "自动选择", + "stopped": "已暂停" } \ No newline at end of file diff --git a/locales/zh-TW.json b/locales/zh-TW.json index bd2c3f1..94b1ebb 100644 --- a/locales/zh-TW.json +++ b/locales/zh-TW.json @@ -120,7 +120,7 @@ "working": "工作", "resting": "休息", "looping": "循環", - "time-left": "% 時間剩余", + "time-left": "% 剩余", "add": "添加", "delete": "刪除", "predefined-tasks-settings": "預設設置", @@ -213,5 +213,6 @@ "personalization-white-or-dark-tip": "選擇是始終使用明亮模式、暗黑模式還是自動切換(部分系統不支持自動切換,將會始終使用明亮模式)。", "personalization-white-or-dark-mode-white": "明亮模式", "personalization-white-or-dark-mode-dark": "暗黑模式", - "personalization-white-or-dark-mode-auto": "自動選擇" + "personalization-white-or-dark-mode-auto": "自動選擇", + "stopped": "已暫停" } \ No newline at end of file diff --git a/main.js b/main.js index 22b31aa..f3060bf 100644 --- a/main.js +++ b/main.js @@ -604,7 +604,10 @@ function notificationSolution(title, body, func) { function traySolution(isFullScreen) { if (app.isReady()) { if (tray != null) { - if (!isTimerWin) tray.setImage(path.join(__dirname, '\\res\\icons\\iconWin.ico')); + if (!isTimerWin) { + if (process.platform == "win32") tray.setImage(path.join(__dirname, '\\res\\icons\\iconWin.ico')); + else tray.setTitle(""); + } } if (!isFullScreen) { if ((!store.get("islocked")) && win != null) win.closable = true; @@ -1451,12 +1454,14 @@ ipcMain.on('only-one-min-left', function () { }) ipcMain.on('tray-image-change', function (event, message) { - if (tray != null && process.platform == "win32") { + if (tray != null) { if (message == "stop") { - tray.setImage(path.join(__dirname, '\\res\\icons\\wnrIconStopped.png')); + if (process.platform == "win32") tray.setImage(path.join(__dirname, '\\res\\icons\\wnrIconStopped.png')); + else tray.setTitle(" " + i18n.__('stopped')); isStopped = true; } else { - tray.setImage(path.join(__dirname, '\\res\\icons\\iconWin.ico')); + if (process.platform == "win32") tray.setImage(path.join(__dirname, '\\res\\icons\\iconWin.ico')); + else tray.setTitle(" " + 100 - (progress * 100) + timeLeftTip); isStopped = false; } } @@ -1466,8 +1471,10 @@ ipcMain.on("progress-bar-set", function (event, message) { progress = 1 - message / 100; if (win != null) win.setProgressBar(progress); if (tray != null) tray.setToolTip(message + timeLeftTip) - if (process.platform == "darwin") + if (process.platform == "darwin") { if (timeLeftOnBar != null) timeLeftOnBar.label = message + timeLeftTip; + if (tray != null) tray.setTitle(" " + message + timeLeftTip); + } }) ipcMain.on("notify", function (event, message) { diff --git a/package.json b/package.json index ce489c5..5d1ab64 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wnr", - "version": "1.15.1", + "version": "1.15.2", "description": "Work and rest, with wnr now!", "main": "main.js", "scripts": { diff --git a/timer.html b/timer.html index 8238268..14c8995 100644 --- a/timer.html +++ b/timer.html @@ -385,6 +385,7 @@

$(".time-bar-focus").removeClass("time-bar-focus"); $nowTiming.removeClass("display-1"); $nowTiming.addClass("h1"); + $("#fullscreen-experience-tip").css("display", "none"); } warningGiver(1); } else { @@ -416,6 +417,7 @@

$(".time-bar-focus").removeClass("time-bar-focus"); $nowTiming.removeClass("display-1"); $nowTiming.addClass("h1"); + $("#fullscreen-experience-tip").css("display", "none"); } if (shouldNap) { lastNapSecond = workTime / 1000; @@ -431,6 +433,7 @@

canStop = false; window.clearInterval(int); $("#only-one").css("display", "none"); + $("#fullscreen-experience-tip").css("display", "none"); $("#work-rest").text(""); $nowTiming.text(i18n.__('ended')); isClockWorking = 0;