From 0f75972616fc8365a92337086f44a6675b2b547a Mon Sep 17 00:00:00 2001 From: cutls Date: Sat, 26 Sep 2020 21:02:48 +0900 Subject: [PATCH] TheDesk Tips redesign --- app/css/tl.css | 10 ++-------- app/js/platform/end.js | 2 +- app/js/platform/preload.js | 2 +- app/js/ui/tips.js | 27 +++++++++++++++------------ app/main/system.js | 4 ++-- app/view/make/index.sample.html | 2 +- 6 files changed, 22 insertions(+), 25 deletions(-) diff --git a/app/css/tl.css b/app/css/tl.css index 8223fddd..3501c882 100644 --- a/app/css/tl.css +++ b/app/css/tl.css @@ -93,7 +93,7 @@ display: grid; grid-template-columns: 3rem 2.3rem 2.5fr 1fr 4.6rem; grid-template-rows: 1.7rem 1.5rem; - grid-template-areas: 'cover name name artist refresh' 'cover progress progress progress time'; + grid-template-areas: 'cover name name name refresh' 'cover progress progress progress time'; } #spot-refresh { grid-area: refresh; @@ -108,18 +108,12 @@ overflow: hidden; line-height: 1.92rem; } -#spot-artist { - grid-area: artist; - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; - line-height: 1.92rem; -} #spot-img { width: 90%; } #spot-time { grid-area: time; + line-height: 0.5rem; } .progress { grid-area: progress; diff --git a/app/js/platform/end.js b/app/js/platform/end.js index 39e87661..62fc2e57 100644 --- a/app/js/platform/end.js +++ b/app/js/platform/end.js @@ -170,7 +170,7 @@ onmessage = function(e) { } else if (e.data[0] == 'npCore') { npCore(e.data[1]) } else if (e.data[0] == 'renderMem') { - renderMem(e.data[1][0], e.data[1][1], e.data[1][2]) + renderMem(e.data[1][0], e.data[1][1], e.data[1][2], e.data[1][3], e.data[1][4]) } else if (e.data[0] == 'updateProg') { updateProg(e.data[1]) } else if (e.data[0] == 'updateMess') { diff --git a/app/js/platform/preload.js b/app/js/platform/preload.js index 0c98e0f5..ea64945c 100644 --- a/app/js/platform/preload.js +++ b/app/js/platform/preload.js @@ -204,7 +204,7 @@ ipc.on('memory', function(event, arg) { var use = arg[0] var cpu = arg[1] var total = arg[2] - postMessage(['renderMem', [use, cpu, total]], '*') + postMessage(['renderMem', [use, cpu, total, arg[3], arg[4]]], '*') }) //log ipc.on('logData', function(event, args) { diff --git a/app/js/ui/tips.js b/app/js/ui/tips.js index 7ed67803..d9abf97c 100644 --- a/app/js/ui/tips.js +++ b/app/js/ui/tips.js @@ -63,16 +63,21 @@ function tips(mode) { function startmem() { postMessage(['sendSinmpleIpc', 'startmem'], '*') } -function renderMem(use, cpu, total) { +function renderMem(use, cpu, total, core, uptime) { + let day = Math.floor(uptime / 60 / 60 / 24) + let hour = Math.floor(uptime / 60 /60 % 24) + if(hour < 10) hour = '0' + hour + let min = Math.floor(uptime / 60 % 60) + if(min < 10) min = '0' + min + let sec = Math.floor(uptime % 60) + if(sec < 10) sec = '0' + sec + let time = `${day ? day + ' days ' : ''}${hour ? hour + ':' : ''}${min}:${sec}` + //Intel + cpu = cpu.replace('Intel(R)', '').replace('(TM)', '').replace(' CPU', '') + //AMD + cpu = cpu.replace('AMD ', '').replace(/\s[0-9]{1,3}-Core\sProcessor/, '') $('#tips-text').html( - escapeHTML(cpu) + - '
Memory:' + - Math.floor(use / 1024 / 1024 / 102.4) / 10 + - '/' + - Math.floor(total / 1024 / 1024 / 102.4) / 10 + - 'GB(' + - Math.floor((use / total) * 100) + - '%)' + `${escapeHTML(cpu)} x ${core}
RAM: ${Math.floor(use / 1024 / 1024 / 102.4) / 10}/${Math.floor(total / 1024 / 1024 / 102.4) / 10}GB(${Math.floor((use / total) * 100)}%) UP:${time}` ) } //トレンドタグ @@ -196,12 +201,10 @@ function spotifytips() { send
- +
${escapeHTML(item.name)} -
-
${artisttxt}
diff --git a/app/main/system.js b/app/main/system.js index dc5e1c1f..aaa7fd04 100644 --- a/app/main/system.js +++ b/app/main/system.js @@ -188,8 +188,8 @@ function system(mainWindow, dir, lang, dirname) { }) function mems() { var mem = os.totalmem() - os.freemem() - if (mainWindow) { - event.webContents.send('memory', [mem, os.cpus()[0].model, os.totalmem()]) + if (mainWindow && event.webContents) { + event.webContents.send('memory', [mem, os.cpus()[0].model, os.totalmem(), os.cpus().length, os.uptime()]) } } ipc.on('endmem', (e, arg) => { diff --git a/app/view/make/index.sample.html b/app/view/make/index.sample.html index 5d38301f..d6c0aa0f 100644 --- a/app/view/make/index.sample.html +++ b/app/view/make/index.sample.html @@ -1149,7 +1149,7 @@ bubble_chart -
+