From f1a9ea0e1da8242df245d9bfd4392e24546b84c8 Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Mon, 9 Jan 2023 12:39:14 +0800 Subject: [PATCH] show progress in title closes #1417 --- src/App.jsx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/App.jsx b/src/App.jsx index 95c7a874..e32c359c 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -97,6 +97,11 @@ const { focusWindow } = remote.require('./electron'); const calcShouldShowWaveform = (zoomedDuration) => (zoomedDuration != null && zoomedDuration < ffmpegExtractWindow * 8); const calcShouldShowKeyframes = (zoomedDuration) => (zoomedDuration != null && zoomedDuration < ffmpegExtractWindow * 8); +function setDocumentExtraTitle(extra) { + const baseTitle = 'LosslessCut'; + if (extra != null) document.title = `${baseTitle} - ${extra}`; + else document.title = baseTitle; +} const videoStyle = { width: '100%', height: '100%', objectFit: 'contain' }; const bottomMotionStyle = { background: controlsBackground }; @@ -196,6 +201,16 @@ const App = memo(() => { setWorkingState(val); }, []); + useEffect(() => { + if (!working || cutProgress == null) setDocumentExtraTitle(); + else { + const parts = []; + if (working) parts.push(working); + if (cutProgress != null) parts.push(`${(cutProgress * 100).toFixed(1)}%`); + setDocumentExtraTitle(parts.join(' ')); + } + }, [cutProgress, working]); + const zoom = Math.floor(zoomUnrounded); const durationSafe = isDurationValid(duration) ? duration : 1;