-
Notifications
You must be signed in to change notification settings - Fork 678
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: electron window frame and
backgroundMaterial
Signed-off-by: Innei <i@innei.in>
- Loading branch information
Showing
7 changed files
with
93 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,44 @@ | ||
import { useUISettingKey } from "@renderer/atoms/settings/ui" | ||
import { cn } from "@renderer/lib/utils" | ||
|
||
export const Vibrancy: Component< | ||
type Props = Component< | ||
React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> | ||
> = ({ className, children, ...rest }) => { | ||
const opaqueSidebar = useUISettingKey("opaqueSidebar") | ||
const canVibrancy = | ||
window.electron && | ||
window.electron.process.platform === "darwin" && | ||
!opaqueSidebar | ||
> | ||
const MacOSVibrancy: Props = ({ className, children, ...rest }) => ( | ||
<div className={cn("bg-native/50 dark:bg-native/10", className)} {...rest}> | ||
{children} | ||
</div> | ||
) | ||
|
||
const Noop: Props = ({ children, className, ...rest }) => ( | ||
<div className={cn("bg-native", className)} {...rest}> | ||
{children} | ||
</div> | ||
) | ||
|
||
return ( | ||
<div | ||
className={cn( | ||
canVibrancy ? "bg-native/50 dark:bg-native/10" : "bg-native", | ||
const Win32Material: Props = ({ className, children, ...rest }) => ( | ||
<div className={cn("bg-transparent", className)} {...rest}> | ||
{children} | ||
</div> | ||
) | ||
export const WindowUnderBlur: Props = (props) => { | ||
const opaqueSidebar = useUISettingKey("opaqueSidebar") | ||
if (opaqueSidebar) { | ||
return <Noop {...props} /> | ||
} | ||
|
||
className, | ||
)} | ||
{...rest} | ||
> | ||
{children} | ||
</div> | ||
) | ||
if (!window.electron) { | ||
return <Noop {...props} /> | ||
} | ||
switch (window.electron.process.platform) { | ||
case "darwin": { | ||
return <MacOSVibrancy {...props} /> | ||
} | ||
case "win32": { | ||
return <Win32Material {...props} /> | ||
} | ||
default: { | ||
return <Noop {...props} /> | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export const ElECTRON_CUSTOM_TITLEBAR_HEIGHT = 30 | ||
export const ELECTRON_WINDOWS_RADIUS = 12 | ||
// export const ELECTRON_WINDOWS_RADIUS = 12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters