File tree Expand file tree Collapse file tree 5 files changed +68
-1
lines changed
plugins/windows/src/window Expand file tree Collapse file tree 5 files changed +68
-1
lines changed Original file line number Diff line number Diff line change @@ -13,12 +13,14 @@ import { Button } from "@hypr/ui/components/ui/button";
1313import { cn } from "@hypr/utils" ;
1414
1515import { useShell } from "../../../contexts/shell" ;
16+ import { useIsLinux } from "../../../hooks/usePlatform" ;
1617import {
1718 type Tab ,
1819 uniqueIdfromTab ,
1920 useTabs ,
2021} from "../../../store/zustand/tabs" ;
2122import { ChatFloatingButton } from "../../chat" ;
23+ import { TrafficLights } from "../../window/traffic-lights" ;
2224import { useNewNote } from "../shared" ;
2325import { TabContentContact , TabItemContact } from "./contacts" ;
2426import { TabContentEmpty , TabItemEmpty } from "./empty" ;
@@ -58,6 +60,7 @@ export function Body() {
5860
5961function Header ( { tabs } : { tabs : Tab [ ] } ) {
6062 const { leftsidebar } = useShell ( ) ;
63+ const isLinux = useIsLinux ( ) ;
6164 const {
6265 select,
6366 close,
@@ -93,8 +96,10 @@ function Header({ tabs }: { tabs: Tab[] }) {
9396 className = { cn ( [
9497 "w-full h-9 flex items-center" ,
9598 ! leftsidebar . expanded && "pl-[72px]" ,
99+ isLinux && "pl-3" ,
96100 ] ) }
97101 >
102+ { isLinux && < TrafficLights className = "mr-2" /> }
98103 { ! leftsidebar . expanded && (
99104 < Button
100105 size = "icon"
Original file line number Diff line number Diff line change 1+ import { getCurrentWebviewWindow } from "@tauri-apps/api/webviewWindow" ;
2+
3+ import { cn } from "@hypr/utils" ;
4+
5+ export function TrafficLights ( { className } : { className ?: string } ) {
6+ const win = getCurrentWebviewWindow ( ) ;
7+
8+ const onClose = ( ) => win . close ( ) ;
9+ const onMinimize = ( ) => win . minimize ( ) ;
10+ const onMaximize = ( ) => win . toggleMaximize ( ) ;
11+
12+ return (
13+ < div className = { cn ( [ "flex gap-2 items-center" , className ] ) } >
14+ < button
15+ type = "button"
16+ data-tauri-drag-region = "false"
17+ onClick = { onClose }
18+ className = "h-3 w-3 rounded-full bg-[#ff5f57] border border-black/10 hover:brightness-90 transition-all"
19+ />
20+ < button
21+ type = "button"
22+ data-tauri-drag-region = "false"
23+ onClick = { onMinimize }
24+ className = "h-3 w-3 rounded-full bg-[#ffbd2e] border border-black/10 hover:brightness-90 transition-all"
25+ />
26+ < button
27+ type = "button"
28+ data-tauri-drag-region = "false"
29+ onClick = { onMaximize }
30+ className = "h-3 w-3 rounded-full bg-[#28c840] border border-black/10 hover:brightness-90 transition-all"
31+ />
32+ </ div >
33+ ) ;
34+ }
Original file line number Diff line number Diff line change 1+ import { platform , type Platform } from "@tauri-apps/plugin-os" ;
2+
3+ export type { Platform } ;
4+
5+ export function usePlatform ( ) : Platform {
6+ return platform ( ) ;
7+ }
8+
9+ export function useIsLinux ( ) : boolean {
10+ return usePlatform ( ) === "linux" ;
11+ }
12+
13+ export function useIsMacos ( ) : boolean {
14+ return usePlatform ( ) === "macos" ;
15+ }
16+
17+ export function useIsWindows ( ) : boolean {
18+ return usePlatform ( ) === "windows" ;
19+ }
Original file line number Diff line number Diff line change @@ -23,6 +23,8 @@ import { Button } from "@hypr/ui/components/ui/button";
2323import { cn } from "@hypr/utils" ;
2424
2525import { useTemplateNavigation } from "../../../components/settings/template/utils" ;
26+ import { TrafficLights } from "../../../components/window/traffic-lights" ;
27+ import { useIsLinux } from "../../../hooks/usePlatform" ;
2628import * as main from "../../../store/tinybase/main" ;
2729
2830const TAB_KEYS = [
@@ -166,6 +168,7 @@ function Group({
166168 includeTrafficLight ?: boolean ;
167169} ) {
168170 const navigate = Route . useNavigate ( ) ;
171+ const isLinux = useIsLinux ( ) ;
169172
170173 const handleTabClick = async ( tab : TabKey ) => {
171174 if ( tab === "feedback" ) {
@@ -184,7 +187,11 @@ function Group({
184187 expandHeight && "flex-1" ,
185188 ] ) }
186189 >
187- { includeTrafficLight && < div data-tauri-drag-region className = "h-9" /> }
190+ { includeTrafficLight && (
191+ < div data-tauri-drag-region className = "h-9 flex items-center px-3" >
192+ { isLinux && < TrafficLights /> }
193+ </ div >
194+ ) }
188195 { tabs . map ( ( tab ) => {
189196 const tabInfo = info ( tab ) ;
190197 const Icon = tabInfo . icon ;
Original file line number Diff line number Diff line change @@ -132,6 +132,8 @@ impl WindowImpl for AppWindow {
132132 let window = self
133133 . window_builder ( app, "/app/settings" )
134134 . resizable ( true )
135+ . minimizable ( true )
136+ . maximizable ( true )
135137 . min_inner_size ( 800.0 , 600.0 )
136138 . build ( ) ?;
137139
You can’t perform that action at this time.
0 commit comments