mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-01-23 21:44:55 +03:00
fix: fixing window on macos
This commit is contained in:
parent
238d207590
commit
3e33e1f4b3
@ -63,7 +63,7 @@ export class WindowManager {
|
|||||||
minWidth: 1024,
|
minWidth: 1024,
|
||||||
minHeight: 540,
|
minHeight: 540,
|
||||||
backgroundColor: "#1c1c1c",
|
backgroundColor: "#1c1c1c",
|
||||||
titleBarStyle: process.platform === "win32" ? "hidden" : "default",
|
titleBarStyle: process.platform === "linux" ? "default" : "hidden",
|
||||||
...(process.platform === "linux" ? { icon } : {}),
|
...(process.platform === "linux" ? { icon } : {}),
|
||||||
trafficLightPosition: { x: 16, y: 16 },
|
trafficLightPosition: { x: 16, y: 16 },
|
||||||
titleBarOverlay: {
|
titleBarOverlay: {
|
||||||
|
@ -5,6 +5,8 @@ import { workerData } from "node:worker_threads";
|
|||||||
|
|
||||||
const { binaryPath } = workerData;
|
const { binaryPath } = workerData;
|
||||||
|
|
||||||
|
let backupGameProcess: cp.ChildProcess | null = null;
|
||||||
|
|
||||||
export const backupGame = ({
|
export const backupGame = ({
|
||||||
title,
|
title,
|
||||||
backupPath,
|
backupPath,
|
||||||
@ -16,15 +18,32 @@ export const backupGame = ({
|
|||||||
preview?: boolean;
|
preview?: boolean;
|
||||||
winePrefix?: string;
|
winePrefix?: string;
|
||||||
}) => {
|
}) => {
|
||||||
const args = ["backup", title, "--api", "--force"];
|
if (backupGameProcess && !backupGameProcess.killed) {
|
||||||
|
backupGameProcess.kill();
|
||||||
|
backupGameProcess = null;
|
||||||
|
}
|
||||||
|
|
||||||
if (preview) args.push("--preview");
|
return new Promise((resolve, reject) => {
|
||||||
if (backupPath) args.push("--path", backupPath);
|
const args = ["backup", title, "--api", "--force"];
|
||||||
if (winePrefix) args.push("--wine-prefix", winePrefix);
|
|
||||||
|
|
||||||
const result = cp.execFileSync(binaryPath, args);
|
if (preview) args.push("--preview");
|
||||||
|
if (backupPath) args.push("--path", backupPath);
|
||||||
|
if (winePrefix) args.push("--wine-prefix", winePrefix);
|
||||||
|
|
||||||
return JSON.parse(result.toString("utf-8")) as LudusaviBackup;
|
backupGameProcess = cp.execFile(
|
||||||
|
binaryPath,
|
||||||
|
args,
|
||||||
|
(err: cp.ExecFileException | null, stdout: string) => {
|
||||||
|
if (err) {
|
||||||
|
backupGameProcess = null;
|
||||||
|
return reject(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
backupGameProcess = null;
|
||||||
|
return resolve(JSON.parse(stdout) as LudusaviBackup);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const restoreBackup = (backupPath: string) => {
|
export const restoreBackup = (backupPath: string) => {
|
||||||
|
BIN
src/renderer/src/assets/icons/flame-animated.gif
Normal file
BIN
src/renderer/src/assets/icons/flame-animated.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 229 KiB |
BIN
src/renderer/src/assets/icons/flame-static.png
Normal file
BIN
src/renderer/src/assets/icons/flame-static.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
BIN
src/renderer/src/assets/icons/stars-animated.gif
Normal file
BIN
src/renderer/src/assets/icons/stars-animated.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 68 KiB |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -21,7 +21,6 @@ import { store } from "./store";
|
|||||||
import resources from "@locales";
|
import resources from "@locales";
|
||||||
import { AchievementNotification } from "./pages/achievements/notification/achievement-notification";
|
import { AchievementNotification } from "./pages/achievements/notification/achievement-notification";
|
||||||
|
|
||||||
import "./workers";
|
|
||||||
import { RepacksContextProvider } from "./context";
|
import { RepacksContextProvider } from "./context";
|
||||||
import { SuspenseWrapper } from "./components";
|
import { SuspenseWrapper } from "./components";
|
||||||
|
|
||||||
|
@ -68,3 +68,10 @@ export const buttonsList = style({
|
|||||||
padding: "0",
|
padding: "0",
|
||||||
gap: `${SPACING_UNIT}px`,
|
gap: `${SPACING_UNIT}px`,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const flameIcon = style({
|
||||||
|
width: "30px",
|
||||||
|
top: "-10px",
|
||||||
|
left: "-5px",
|
||||||
|
position: "absolute",
|
||||||
|
});
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { useCallback, useEffect, useRef, useState } from "react";
|
import { useCallback, useEffect, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
@ -7,12 +7,12 @@ import Skeleton, { SkeletonTheme } from "react-loading-skeleton";
|
|||||||
import { Button, GameCard, Hero } from "@renderer/components";
|
import { Button, GameCard, Hero } from "@renderer/components";
|
||||||
import type { Steam250Game, CatalogueEntry } from "@types";
|
import type { Steam250Game, CatalogueEntry } from "@types";
|
||||||
|
|
||||||
import starsAnimation from "@renderer/assets/lottie/stars.json";
|
import flameIconStatic from "@renderer/assets/icons/flame-static.png";
|
||||||
import flameAnimation from "@renderer/assets/lottie/flame.json";
|
import flameIconAnimated from "@renderer/assets/icons/flame-animated.gif";
|
||||||
|
import starsIconAnimated from "@renderer/assets/icons/stars-animated.gif";
|
||||||
|
|
||||||
import * as styles from "./home.css";
|
import * as styles from "./home.css";
|
||||||
import { SPACING_UNIT, vars } from "@renderer/theme.css";
|
import { SPACING_UNIT, vars } from "@renderer/theme.css";
|
||||||
import Lottie, { type LottieRefCurrentProps } from "lottie-react";
|
|
||||||
import { buildGameDetailsPath } from "@renderer/helpers";
|
import { buildGameDetailsPath } from "@renderer/helpers";
|
||||||
import { CatalogueCategory } from "@shared";
|
import { CatalogueCategory } from "@shared";
|
||||||
|
|
||||||
@ -20,8 +20,7 @@ export default function Home() {
|
|||||||
const { t } = useTranslation("home");
|
const { t } = useTranslation("home");
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const flameAnimationRef = useRef<LottieRefCurrentProps>(null);
|
const [animateFlame, setAnimateFlame] = useState(false);
|
||||||
|
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const [randomGame, setRandomGame] = useState<Steam250Game | null>(null);
|
const [randomGame, setRandomGame] = useState<Steam250Game | null>(null);
|
||||||
|
|
||||||
@ -88,13 +87,13 @@ export default function Home() {
|
|||||||
|
|
||||||
const handleMouseEnterCategory = (category: CatalogueCategory) => {
|
const handleMouseEnterCategory = (category: CatalogueCategory) => {
|
||||||
if (category === CatalogueCategory.Hot) {
|
if (category === CatalogueCategory.Hot) {
|
||||||
flameAnimationRef?.current?.play();
|
setAnimateFlame(true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleMouseLeaveCategory = (category: CatalogueCategory) => {
|
const handleMouseLeaveCategory = (category: CatalogueCategory) => {
|
||||||
if (category === CatalogueCategory.Hot) {
|
if (category === CatalogueCategory.Hot) {
|
||||||
flameAnimationRef?.current?.stop();
|
setAnimateFlame(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -123,17 +122,17 @@ export default function Home() {
|
|||||||
<div
|
<div
|
||||||
style={{ width: 16, height: 16, position: "relative" }}
|
style={{ width: 16, height: 16, position: "relative" }}
|
||||||
>
|
>
|
||||||
<Lottie
|
<img
|
||||||
lottieRef={flameAnimationRef}
|
src={flameIconStatic}
|
||||||
animationData={flameAnimation}
|
alt="Flame icon"
|
||||||
loop={false}
|
className={styles.flameIcon}
|
||||||
autoplay={false}
|
style={{ display: animateFlame ? "none" : "block" }}
|
||||||
style={{
|
/>
|
||||||
width: 30,
|
<img
|
||||||
top: -10,
|
src={flameIconAnimated}
|
||||||
left: -5,
|
alt="Flame animation"
|
||||||
position: "absolute",
|
className={styles.flameIcon}
|
||||||
}}
|
style={{ display: animateFlame ? "block" : "none" }}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@ -150,10 +149,10 @@ export default function Home() {
|
|||||||
disabled={!randomGame}
|
disabled={!randomGame}
|
||||||
>
|
>
|
||||||
<div style={{ width: 16, height: 16, position: "relative" }}>
|
<div style={{ width: 16, height: 16, position: "relative" }}>
|
||||||
<Lottie
|
<img
|
||||||
animationData={starsAnimation}
|
src={starsIconAnimated}
|
||||||
|
alt="Stars animation"
|
||||||
style={{ width: 70, position: "absolute", top: -28, left: -27 }}
|
style={{ width: 70, position: "absolute", top: -28, left: -27 }}
|
||||||
loop={false}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{t("surprise_me")}
|
{t("surprise_me")}
|
||||||
@ -163,10 +162,9 @@ export default function Home() {
|
|||||||
<h2 style={{ display: "flex", gap: SPACING_UNIT }}>
|
<h2 style={{ display: "flex", gap: SPACING_UNIT }}>
|
||||||
{currentCatalogueCategory === CatalogueCategory.Hot && (
|
{currentCatalogueCategory === CatalogueCategory.Hot && (
|
||||||
<div style={{ width: 24, height: 24, position: "relative" }}>
|
<div style={{ width: 24, height: 24, position: "relative" }}>
|
||||||
<Lottie
|
<img
|
||||||
animationData={flameAnimation}
|
src={flameIconAnimated}
|
||||||
loop={false}
|
alt="Flame animation"
|
||||||
autoplay
|
|
||||||
style={{
|
style={{
|
||||||
width: 40,
|
width: 40,
|
||||||
top: -10,
|
top: -10,
|
||||||
|
Loading…
Reference in New Issue
Block a user