Skip to content

The swiss army knife of lossless video/audio editing

show LosslessCut last in app title

Mikael Finstad029ba35c013c
diff --git a/src/main/common.ts b/src/main/common.ts
new file mode 100644
index 00000000..7dfea1be
--- /dev/null
+++ b/src/main/common.ts
@@ -0,0 +1,2 @@
+export const appName = 'LosslessCut';
+export const copyrightYear = 2024;
diff --git a/src/main/index.ts b/src/main/index.ts
index 722ed6c5..21f8a058 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -17,6 +17,7 @@ import logger from './logger.js';
import menu from './menu.js';
import * as configStore from './configStore.js';
import { isLinux } from './util.js';
+import { appName, copyrightYear } from './common.js';
import attachContextMenu from './contextMenu.js';
import HttpServer from './httpServer.js';
import isDev from './isDev.js';
@@ -63,8 +64,6 @@ unhandled({
showDialog: true,
});
-const appName = 'LosslessCut';
-const copyrightYear = 2024;
const appVersion = app.getVersion();
diff --git a/src/renderer/src/util.ts b/src/renderer/src/util.ts
index 43b6f82c..0168428a 100644
--- a/src/renderer/src/util.ts
+++ b/src/renderer/src/util.ts
@@ -12,6 +12,7 @@ import type { PlatformPath } from 'node:path';
import isDev from './isDev';
import Swal, { errorToast, toast } from './swal';
import { ffmpegExtractWindow } from './util/constants';
+import { appName } from '../../main/common';
const { dirname, parse: parsePath, join, extname, isAbsolute, resolve, basename }: PlatformPath = window.require('path');
const fsExtra: typeof FsExtra = window.require('fs-extra');
@@ -400,19 +401,21 @@ export function checkFileSizes(inputSize, outputSize) {
return undefined;
}
-function setDocumentExtraTitle(extra) {
- const baseTitle = 'LosslessCut';
- document.title = extra != null ? `${baseTitle} - ${extra}` : baseTitle;
-}
-
export function setDocumentTitle({ filePath, working, cutProgress }: { filePath?: string | undefined, working?: string | undefined, cutProgress?: number | undefined }) {
const parts: string[] = [];
- if (filePath) parts.push(basename(filePath));
+
if (working) {
- parts.push('-', working);
if (cutProgress != null) parts.push(`${(cutProgress * 100).toFixed(1)}%`);
+ parts.push(working);
}
- setDocumentExtraTitle(parts.length > 0 ? parts.join(' ') : undefined);
+
+ if (filePath) {
+ parts.push(basename(filePath));
+ }
+
+ parts.push(appName);
+
+ document.title = parts.join(' - ');
}
export function mustDisallowVob() {