From 8f18fb80ea8f1a11a8d91ae453cdc1aacd70847c Mon Sep 17 00:00:00 2001 From: JellyBrick Date: Sun, 11 May 2025 22:56:08 +0900 Subject: [PATCH] fix(renderer): fix traffic light --- src/renderer.ts | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/renderer.ts b/src/renderer.ts index c584ae8e..a6d8a1a9 100644 --- a/src/renderer.ts +++ b/src/renderer.ts @@ -32,18 +32,6 @@ let firstDataLoaded = false; registerWindowDefaultTrustedTypePolicy(); -{ - let osType = 'Unknown'; - if (window.electronIs.osx()) { - osType = 'Macintosh'; - } else if (window.electronIs.windows()) { - osType = 'Windows'; - } else if (window.electronIs.linux()) { - osType = 'Linux'; - } - document.documentElement.setAttribute('data-os', osType); -} - async function listenForApiLoad() { if (!isApiLoaded) { api = document.querySelector('#movie_player'); @@ -56,6 +44,19 @@ async function listenForApiLoad() { } async function onApiLoaded() { + // Workaround for macOS traffic lights + { + let osType = 'Unknown'; + if (window.electronIs.osx()) { + osType = 'Macintosh'; + } else if (window.electronIs.windows()) { + osType = 'Windows'; + } else if (window.electronIs.linux()) { + osType = 'Linux'; + } + document.documentElement.setAttribute('data-os', osType); + } + // Workaround for #2459 document .querySelector('button.video-button.ytmusic-av-toggle')