mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
fix: move app fonts preloading into html/css files, clean up
Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
parent
5d24c4e0f9
commit
939b46c1f8
@ -28,13 +28,14 @@ export interface SendToViewArgs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class WindowManager extends Singleton {
|
export class WindowManager extends Singleton {
|
||||||
|
public mainContentUrl = `http://localhost:${LensProxy.getInstance().port}`;
|
||||||
|
|
||||||
protected mainWindow: BrowserWindow;
|
protected mainWindow: BrowserWindow;
|
||||||
protected splashWindow: BrowserWindow;
|
protected splashWindow: BrowserWindow;
|
||||||
protected windowState: windowStateKeeper.State;
|
protected windowState: windowStateKeeper.State;
|
||||||
protected disposers: Record<string, Function> = {};
|
protected disposers: Record<string, Function> = {};
|
||||||
|
|
||||||
@observable activeClusterId: ClusterId;
|
@observable activeClusterId: ClusterId;
|
||||||
@observable mainContentUrl = `http://localhost:${LensProxy.getInstance().port}`;
|
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
|||||||
@ -11,13 +11,12 @@ import type { TabId } from "../dock/store";
|
|||||||
import { TerminalApi, TerminalChannels } from "../../../api/terminal-api";
|
import { TerminalApi, TerminalChannels } from "../../../api/terminal-api";
|
||||||
import { ThemeStore } from "../../../theme.store";
|
import { ThemeStore } from "../../../theme.store";
|
||||||
import { disposer } from "../../../utils";
|
import { disposer } from "../../../utils";
|
||||||
import { isMac, defaultTerminalFontFamily } from "../../../../common/vars";
|
import { isMac } from "../../../../common/vars";
|
||||||
import { once } from "lodash";
|
import { once } from "lodash";
|
||||||
import { UserStore } from "../../../../common/user-store";
|
import { UserStore } from "../../../../common/user-store";
|
||||||
import { clipboard } from "electron";
|
import { clipboard } from "electron";
|
||||||
import logger from "../../../../common/logger";
|
import logger from "../../../../common/logger";
|
||||||
import type { TerminalConfig } from "../../../../common/user-store/preferences-helpers";
|
import type { TerminalConfig } from "../../../../common/user-store/preferences-helpers";
|
||||||
import RobotoMonoFontUrl from "../../fonts/roboto-mono-nerd.ttf";
|
|
||||||
|
|
||||||
export class Terminal {
|
export class Terminal {
|
||||||
private terminalConfig: TerminalConfig = UserStore.getInstance().terminalConfig;
|
private terminalConfig: TerminalConfig = UserStore.getInstance().terminalConfig;
|
||||||
@ -26,17 +25,6 @@ export class Terminal {
|
|||||||
return document.getElementById("terminal-init");
|
return document.getElementById("terminal-init");
|
||||||
}
|
}
|
||||||
|
|
||||||
static async preloadFonts() {
|
|
||||||
try {
|
|
||||||
const fontFace = new FontFace(defaultTerminalFontFamily, `url(${RobotoMonoFontUrl})`);
|
|
||||||
|
|
||||||
await fontFace.load();
|
|
||||||
document.fonts.add(fontFace);
|
|
||||||
} catch (error) {
|
|
||||||
logger.error(`[TERMINAL]: preloading default font failed`, error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private xterm: XTerm | null = new XTerm({
|
private xterm: XTerm | null = new XTerm({
|
||||||
cursorBlink: true,
|
cursorBlink: true,
|
||||||
cursorStyle: "bar",
|
cursorStyle: "bar",
|
||||||
|
|||||||
@ -13,7 +13,8 @@
|
|||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-display: block;
|
font-display: block;
|
||||||
src: url("../fonts/MaterialIcons-Regular.ttf") format("truetype");
|
src: url("./fonts/MaterialIcons-Regular.woff2") format("woff");
|
||||||
|
src: url("./fonts/MaterialIcons-Regular.ttf") format("truetype");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Patched RobotoMono font with icons
|
// Patched RobotoMono font with icons
|
||||||
@ -21,6 +22,5 @@
|
|||||||
// https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/RobotoMono
|
// https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/RobotoMono
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'RobotoMono';
|
font-family: 'RobotoMono';
|
||||||
src: local('RobotoMono'),
|
src: local('RobotoMono'), url('./fonts/roboto-mono-nerd.ttf') format('truetype');
|
||||||
url('fonts/roboto-mono-nerd.ttf') format('truetype');
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,6 @@
|
|||||||
import type { Cluster } from "../../../../common/cluster/cluster";
|
import type { Cluster } from "../../../../common/cluster/cluster";
|
||||||
import type { CatalogEntityRegistry } from "../../../api/catalog-entity-registry";
|
import type { CatalogEntityRegistry } from "../../../api/catalog-entity-registry";
|
||||||
import logger from "../../../../main/logger";
|
import logger from "../../../../main/logger";
|
||||||
import { Terminal } from "../../../components/dock/terminal/terminal";
|
|
||||||
import type { KubernetesCluster } from "../../../../common/catalog-entities";
|
import type { KubernetesCluster } from "../../../../common/catalog-entities";
|
||||||
import { Notifications } from "../../../components/notifications";
|
import { Notifications } from "../../../components/notifications";
|
||||||
import type { AppEvent } from "../../../../common/app-event-bus/event-bus";
|
import type { AppEvent } from "../../../../common/app-event-bus/event-bus";
|
||||||
@ -40,7 +39,6 @@ export const initClusterFrame =
|
|||||||
`${logPrefix} Init dashboard, clusterId=${hostedCluster.id}, frameId=${frameRoutingId}`,
|
`${logPrefix} Init dashboard, clusterId=${hostedCluster.id}, frameId=${frameRoutingId}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
await Terminal.preloadFonts();
|
|
||||||
await requestSetClusterFrameId(hostedCluster.id);
|
await requestSetClusterFrameId(hostedCluster.id);
|
||||||
await hostedCluster.whenReady; // cluster.activate() is done at this point
|
await hostedCluster.whenReady; // cluster.activate() is done at this point
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,9 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
|
<link rel="preload" as="font" type="font/ttf" href="../renderer/components/fonts/roboto-mono-nerd.ttf"/>
|
||||||
|
<link rel="preload" as="font" type="font/ttf" href="../renderer/components/fonts/MaterialIcons-Regular.ttf"/>
|
||||||
|
<link rel="preload" as="font" type="font/woff2" href="../renderer/components/fonts/MaterialIcons-Regular.woff2"/>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user