From 657a5ec9bbd4f4d5a7679f8a2ed48219d3778b45 Mon Sep 17 00:00:00 2001 From: Xander Frangos <33106561+xanderfrangos@users.noreply.github.com> Date: Tue, 12 Dec 2023 23:40:21 -0500 Subject: [PATCH] Show "detecting" message in flyout before first refresh starts --- src/components/BrightnessPanel.jsx | 2 +- src/electron.js | 9 +++++---- src/panel-preload.js | 7 ++++++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/components/BrightnessPanel.jsx b/src/components/BrightnessPanel.jsx index bc3fd41b..d06f4985 100644 --- a/src/components/BrightnessPanel.jsx +++ b/src/components/BrightnessPanel.jsx @@ -367,7 +367,7 @@ export default class BrightnessPanel extends PureComponent { update: false, sleeping: false, updateProgress: 0, - isRefreshing: false + isRefreshing: window.isRefreshing } this.lastLevels = [] this.updateInterval = null diff --git a/src/electron.js b/src/electron.js index a62bb931..913edefc 100644 --- a/src/electron.js +++ b/src/electron.js @@ -1540,7 +1540,7 @@ function tryVibrancy(window, value = null) { // // -let isRefreshing = false +let isRefreshing = true let shouldShowPanel = false const setIsRefreshing = newValue => { isRefreshing = (newValue ? true : false) @@ -2139,7 +2139,7 @@ ipcMain.on('get-window-history', () => sendToAllWindows('window-history', window let panelState = "hidden" let panelReady = false -function createPanel(toggleOnLoad = false) { +function createPanel(toggleOnLoad = false, isRefreshing = false) { console.log("Creating panel...") @@ -2175,7 +2175,8 @@ function createPanel(toggleOnLoad = false) { zoomFactor: 1.0, additionalArguments: ["jsVars" + Buffer.from(JSON.stringify({ appName: app.name, - appVersion: app.getVersion() + appVersion: app.getVersion(), + isRefreshing: isRefreshing })).toString('base64')], allowRunningInsecureContent: true, webSecurity: false @@ -2739,7 +2740,7 @@ app.on("ready", async () => { //readSettings() getLocalization() showIntro() - createPanel() + createPanel(false, true) startMonitorThread() monitorsThread.once("ready", async () => { diff --git a/src/panel-preload.js b/src/panel-preload.js index 2fe112c8..4f470e06 100644 --- a/src/panel-preload.js +++ b/src/panel-preload.js @@ -18,10 +18,13 @@ console.error = (...e) => { e.forEach((c) => { ipc.send('log', c); con.error(c) window.winPosition = { x: 0, y: 0, width: 0, height: 0 } +let jsVars function getArgumentVars() { try { + if(jsVars) return jsVars; + const jsVarsString = process.argv.find(arg => arg.indexOf("jsVars") === 0) - const jsVars = JSON.parse(atob(jsVarsString.substring(6))) + jsVars = JSON.parse(atob(jsVarsString.substring(6))) return jsVars } catch(e) { return {} @@ -441,4 +444,6 @@ window.showPanel = false window.isAcrylic = false window.theme = "dark" window.settings = {} +window.jsVars = getArgumentVars() +window.isRefreshing = getArgumentVars().isRefreshing window.isAppX = (getArgumentVars().appName == "twinkle-tray-appx" ? true : false) \ No newline at end of file