Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat: Add minimize button to desktop app

Richie McIlroy99f6e6d43fc9
diff --git a/apps/desktop/src/components/WindowActions.tsx b/apps/desktop/src/components/WindowActions.tsx
index c36e41a8b..6fedc2374 100644
--- a/apps/desktop/src/components/WindowActions.tsx
+++ b/apps/desktop/src/components/WindowActions.tsx
@@ -6,6 +6,7 @@ import { openLinkInBrowser } from "@/utils/helpers";
export const WindowActions = () => {
const actionButtonBase = "w-3 h-3 bg-gray-500 rounded-full m-0 p-0 block";
+ const tauriWindow = import("@tauri-apps/api/window");
return (
<div className="w-full flex items-center -mt-3 z-20 absolute top-5">
@@ -23,7 +24,20 @@ export const WindowActions = () => {
></button>
</div>
<div>
- <span className={actionButtonBase}></span>
+ <button
+ onClick={async () => {
+ if (window.fathom !== undefined) {
+ window.fathom.trackEvent("minimize_clicked");
+ }
+ tauriWindow.then(({ WebviewWindow }) => {
+ const main = WebviewWindow.getByLabel("main");
+ if (main) {
+ main.minimize();
+ }
+ });
+ }}
+ className={`bg-orange-400 hover:bg-orange-500 transition-all ${actionButtonBase}`}
+ ></button>
</div>
<div>
<span className={actionButtonBase}></span>