1
0
mirror of https://github.com/mifi/lossless-cut.git synced 2024-11-21 18:02:35 +01:00

show LosslessCut last in app title

(show most interesting stuff first)
This commit is contained in:
Mikael Finstad 2024-08-06 20:25:17 +02:00
parent 06266e4a4d
commit 029ba35c01
No known key found for this signature in database
GPG Key ID: 25AB36E3E81CBC26
3 changed files with 14 additions and 10 deletions

2
src/main/common.ts Normal file
View File

@ -0,0 +1,2 @@
export const appName = 'LosslessCut';
export const copyrightYear = 2024;

View File

@ -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();

View File

@ -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() {