mirror of
https://github.com/LCE-Hub/LCE-Emerald-Launcher.git
synced 2026-07-15 23:10:48 +00:00
feat: bring back titlebar on non-macOS systems, and show on fullscreen (#96)
This commit is contained in:
@@ -15,6 +15,11 @@
|
|||||||
"core:tray:default",
|
"core:tray:default",
|
||||||
"core:webview:default",
|
"core:webview:default",
|
||||||
"core:window:default",
|
"core:window:default",
|
||||||
|
"core:window:allow-set-decorations",
|
||||||
|
"core:window:allow-is-fullscreen",
|
||||||
|
"core:window:allow-minimize",
|
||||||
|
"core:window:allow-toggle-maximize",
|
||||||
|
"core:window:allow-close",
|
||||||
"opener:default",
|
"opener:default",
|
||||||
"gamepad:default",
|
"gamepad:default",
|
||||||
"drpc:default",
|
"drpc:default",
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"default":{"identifier":"default","description":"Default permissions","local":true,"windows":["main"],"permissions":["core:default","core:app:default","core:event:default","core:image:default","core:menu:default","core:path:default","core:resources:default","core:tray:default","core:webview:default","core:window:default","opener:default","gamepad:default","drpc:default","updater:default",{"identifier":"opener:allow-open-path","allow":[{"path":"**"}]},{"identifier":"opener:allow-reveal-item-in-dir","allow":[{"path":"**"}]},"process:default","deep-link:default"]},"desktop-capability":{"identifier":"desktop-capability","description":"","local":true,"windows":["main"],"permissions":["updater:default","process:default","deep-link:default"],"platforms":["macOS","windows","linux"]}}
|
{"default":{"identifier":"default","description":"Default permissions","local":true,"windows":["main"],"permissions":["core:default","core:app:default","core:event:default","core:image:default","core:menu:default","core:path:default","core:resources:default","core:tray:default","core:webview:default","core:window:default","core:window:allow-set-decorations","core:window:allow-is-fullscreen","core:window:allow-minimize","core:window:allow-toggle-maximize","core:window:allow-close","opener:default","gamepad:default","drpc:default","updater:default",{"identifier":"opener:allow-open-path","allow":[{"path":"**"}]},{"identifier":"opener:allow-reveal-item-in-dir","allow":[{"path":"**"}]},"process:default","deep-link:default"]},"desktop-capability":{"identifier":"desktop-capability","description":"","local":true,"windows":["main"],"permissions":["updater:default","process:default","deep-link:default"],"platforms":["macOS","windows","linux"]}}
|
||||||
@@ -23,6 +23,7 @@ import PanoramaBackground from "../components/common/PanoramaBackground";
|
|||||||
import { ClickParticles } from "../components/common/ClickParticles";
|
import { ClickParticles } from "../components/common/ClickParticles";
|
||||||
import { CinematicIntro } from "../components/common/CinematicIntro";
|
import { CinematicIntro } from "../components/common/CinematicIntro";
|
||||||
import { DownloadOverlay } from "../components/layout/DownloadOverlay";
|
import { DownloadOverlay } from "../components/layout/DownloadOverlay";
|
||||||
|
import { AppHeader } from "../components/layout/AppHeader";
|
||||||
import { AchievementToast } from "../components/common/AchievementToast";
|
import { AchievementToast } from "../components/common/AchievementToast";
|
||||||
import {
|
import {
|
||||||
useUI,
|
useUI,
|
||||||
@@ -34,12 +35,14 @@ import {
|
|||||||
import { TauriService } from "../services/TauriService";
|
import { TauriService } from "../services/TauriService";
|
||||||
import { useLceLiveNotifications } from "../hooks/useLceLiveNotifications";
|
import { useLceLiveNotifications } from "../hooks/useLceLiveNotifications";
|
||||||
import { usePluginViews } from "../plugins/PluginContext";
|
import { usePluginViews } from "../plugins/PluginContext";
|
||||||
|
import { usePlatform } from "../hooks/usePlatform";
|
||||||
import { PluginManager } from "../plugins/PluginManager";
|
import { PluginManager } from "../plugins/PluginManager";
|
||||||
import { PluginViewContainer } from "../components/plugins/PluginViewContainer";
|
import { PluginViewContainer } from "../components/plugins/PluginViewContainer";
|
||||||
import type { Edition } from "../types/edition";
|
import type { Edition } from "../types/edition";
|
||||||
import type { ToastOptions } from "../plugins/types";
|
import type { ToastOptions } from "../plugins/types";
|
||||||
import pkg from "../../package.json";
|
import pkg from "../../package.json";
|
||||||
import { getCurrent, onOpenUrl } from "@tauri-apps/plugin-deep-link";
|
import { getCurrent, onOpenUrl } from "@tauri-apps/plugin-deep-link";
|
||||||
|
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||||
import { listen } from "@tauri-apps/api/event";
|
import { listen } from "@tauri-apps/api/event";
|
||||||
export default function App() {
|
export default function App() {
|
||||||
const ui = useUI();
|
const ui = useUI();
|
||||||
@@ -152,7 +155,11 @@ export default function App() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action === "lcelive" && parts.length >= 2 && parts[1] === "addfriend") {
|
if (
|
||||||
|
action === "lcelive" &&
|
||||||
|
parts.length >= 2 &&
|
||||||
|
parts[1] === "addfriend"
|
||||||
|
) {
|
||||||
const username = parsed.searchParams.get("username");
|
const username = parsed.searchParams.get("username");
|
||||||
if (username) {
|
if (username) {
|
||||||
setActiveView("lcelive");
|
setActiveView("lcelive");
|
||||||
@@ -243,6 +250,19 @@ export default function App() {
|
|||||||
if (unlistenEvent) unlistenEvent();
|
if (unlistenEvent) unlistenEvent();
|
||||||
};
|
};
|
||||||
}, [queueDeepLink]);
|
}, [queueDeepLink]);
|
||||||
|
const { isMac } = usePlatform();
|
||||||
|
const [isFullscreen, setIsFullscreen] = useState(false);
|
||||||
|
useEffect(() => {
|
||||||
|
const appWindow = getCurrentWindow();
|
||||||
|
if (!isMac) appWindow.setDecorations(false);
|
||||||
|
const checkFs = async () => setIsFullscreen(await appWindow.isFullscreen());
|
||||||
|
checkFs();
|
||||||
|
const unlisten = appWindow.onResized(checkFs);
|
||||||
|
return () => {
|
||||||
|
unlisten.then((fn: () => void) => fn());
|
||||||
|
};
|
||||||
|
}, [isMac]);
|
||||||
|
const showHeader = !isMac || isFullscreen;
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (config.isLoaded) {
|
if (config.isLoaded) {
|
||||||
const setupCompleted =
|
const setupCompleted =
|
||||||
@@ -341,6 +361,9 @@ export default function App() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{config.vfxEnabled && <ClickParticles />}
|
{config.vfxEnabled && <ClickParticles />}
|
||||||
|
{showHeader && (
|
||||||
|
<AppHeader playPressSound={audio.playPressSound} uiFade={uiFade} />
|
||||||
|
)}
|
||||||
|
|
||||||
<DownloadOverlay
|
<DownloadOverlay
|
||||||
downloadProgress={game.downloadProgress}
|
downloadProgress={game.downloadProgress}
|
||||||
@@ -393,10 +416,10 @@ export default function App() {
|
|||||||
<motion.div
|
<motion.div
|
||||||
initial={{ opacity: 0 }}
|
initial={{ opacity: 0 }}
|
||||||
animate={{ opacity: 1 }}
|
animate={{ opacity: 1 }}
|
||||||
className="flex flex-col h-full z-10 w-full relative"
|
className={`flex flex-col h-full z-10 w-full relative ${showHeader ? "pt-12" : ""}`}
|
||||||
>
|
>
|
||||||
{!config.legacyMode && (
|
{!config.legacyMode && (
|
||||||
<motion.div {...uiFade} className="absolute top-4 left-8 z-50">
|
<motion.div {...uiFade} className="absolute top-10 left-8 z-50">
|
||||||
<button
|
<button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
audio.playPressSound();
|
audio.playPressSound();
|
||||||
|
|||||||
Reference in New Issue
Block a user