try hide titlebar

This commit is contained in:
pompurin404 2024-08-31 12:29:47 +08:00
parent 18d901673c
commit cf943948bf
No known key found for this signature in database
14 changed files with 31 additions and 8 deletions

View File

@ -155,6 +155,13 @@ export function createWindow(show = false): void {
x: mainWindowState.x, x: mainWindowState.x,
y: mainWindowState.y, y: mainWindowState.y,
show: false, show: false,
frame: false,
titleBarStyle: 'hidden',
titleBarOverlay: {
color: '#00000000',
symbolColor: '#8D8D8D',
height: 48
},
autoHideMenuBar: true, autoHideMenuBar: true,
...(process.platform === 'linux' ? { icon: icon } : {}), ...(process.platform === 'linux' ? { icon: icon } : {}),
webPreferences: { webPreferences: {

View File

@ -106,12 +106,13 @@ const App: React.FC = () => {
return ( return (
<div className="w-full h-[100vh] flex"> <div className="w-full h-[100vh] flex">
<div className="side w-[250px] h-full overflow-y-auto no-scrollbar"> <div className="side w-[250px] h-full overflow-y-auto no-scrollbar">
<div className="sticky top-0 z-40 backdrop-blur bg-background/40 h-[49px]"> <div className="app-drag sticky top-0 z-40 backdrop-blur bg-background/40 h-[49px]">
<div className="flex justify-between p-2"> <div className="flex justify-between p-2">
<h3 className="text-lg font-bold leading-[32px]">Mihomo Party</h3> <h3 className="text-lg font-bold leading-[32px]">Mihomo Party</h3>
<UpdaterButton /> <UpdaterButton />
<Button <Button
size="sm" size="sm"
className="app-nodrag"
isIconOnly isIconOnly
color={location.pathname.includes('/settings') ? 'primary' : 'default'} color={location.pathname.includes('/settings') ? 'primary' : 'default'}
variant={location.pathname.includes('/settings') ? 'solid' : 'light'} variant={location.pathname.includes('/settings') ? 'solid' : 'light'}

View File

@ -7,6 +7,13 @@
src: url('./NotoColorEmoji.ttf'); src: url('./NotoColorEmoji.ttf');
} }
.app-nodrag {
-webkit-app-region: none;
}
.app-drag {
-webkit-app-region: drag;
}
* { * {
user-select: none; user-select: none;
} }

View File

@ -16,10 +16,11 @@ const BasePage = forwardRef<HTMLDivElement, Props>((props, ref) => {
return ( return (
<div ref={contentRef} className="w-full h-full overflow-y-auto custom-scrollbar"> <div ref={contentRef} className="w-full h-full overflow-y-auto custom-scrollbar">
<div className="sticky top-0 z-40 h-[49px] w-full backdrop-blur bg-background/40"> <div className="sticky top-0 z-40 h-[49px] w-full backdrop-blur bg-background/40">
<div className="p-2 flex justify-between h-[48px]"> <div className="app-drag p-2 flex justify-between h-[48px]">
<div className="title h-full text-lg leading-[32px]">{props.title}</div> <div className="title h-full text-lg leading-[32px]">{props.title}</div>
<div className="header h-full">{props.header}</div> <div className="header h-full mr-[130px]">{props.header}</div>
</div> </div>
<Divider /> <Divider />
</div> </div>
<div className="content">{props.children}</div> <div className="content">{props.children}</div>

View File

@ -30,6 +30,7 @@ const UpdaterButton: React.FC = () => {
/> />
)} )}
<Button <Button
className="app-nodrag"
color="danger" color="danger"
size="sm" size="sm"
onPress={() => { onPress={() => {

View File

@ -102,7 +102,7 @@ const Connections: React.FC = () => {
</span> </span>
</div> </div>
<Button <Button
className="ml-1" className="app-nodrag ml-1"
size="sm" size="sm"
color="primary" color="primary"
onPress={() => { onPress={() => {

View File

@ -122,6 +122,7 @@ const DNS: React.FC = () => {
header={ header={
<Button <Button
size="sm" size="sm"
className="app-nodrag"
color="primary" color="primary"
onPress={() => { onPress={() => {
const hostsObject = Object.fromEntries( const hostsObject = Object.fromEntries(

View File

@ -115,7 +115,7 @@ const Override: React.FC = () => {
<> <>
<Button <Button
size="sm" size="sm"
className="mr-2" className="app-nodrag mr-2"
onPress={() => { onPress={() => {
open('https://mihomo.party/guides/function/override/yaml/') open('https://mihomo.party/guides/function/override/yaml/')
}} }}
@ -123,6 +123,7 @@ const Override: React.FC = () => {
使 使
</Button> </Button>
<Button <Button
className="app-nodrag"
size="sm" size="sm"
onPress={() => { onPress={() => {
open('https://github.com/pompurin404/override-hub') open('https://github.com/pompurin404/override-hub')

View File

@ -103,6 +103,7 @@ const Profiles: React.FC = () => {
header={ header={
<Button <Button
size="sm" size="sm"
className="app-nodrag"
color="primary" color="primary"
isLoading={updating} isLoading={updating}
onPress={async () => { onPress={async () => {

View File

@ -110,7 +110,7 @@ const Proxies: React.FC = () => {
<BasePage <BasePage
title="代理组" title="代理组"
header={ header={
<div> <div className="app-nodrag">
<Button <Button
size="sm" size="sm"
isIconOnly isIconOnly

View File

@ -18,7 +18,7 @@ const Settings: React.FC = () => {
isIconOnly isIconOnly
size="sm" size="sm"
title="官方文档" title="官方文档"
className="mr-2" className="app-nodrag mr-2"
onPress={() => { onPress={() => {
window.open('https://mihomo.party') window.open('https://mihomo.party')
}} }}
@ -28,6 +28,7 @@ const Settings: React.FC = () => {
<Button <Button
isIconOnly isIconOnly
size="sm" size="sm"
className="app-nodrag"
title="GitHub仓库" title="GitHub仓库"
onPress={() => { onPress={() => {
window.open('https://github.com/pompurin404/mihomo-party') window.open('https://github.com/pompurin404/mihomo-party')

View File

@ -71,6 +71,7 @@ const Sniffer: React.FC = () => {
header={ header={
<Button <Button
size="sm" size="sm"
className="app-nodrag"
color="primary" color="primary"
onPress={() => onPress={() =>
onSave({ onSave({

View File

@ -100,7 +100,7 @@ const Sysproxy: React.FC = () => {
<BasePage <BasePage
title="系统代理设置" title="系统代理设置"
header={ header={
<Button size="sm" color="primary" onPress={onSave}> <Button className="app-nodrag" size="sm" color="primary" onPress={onSave}>
</Button> </Button>
} }

View File

@ -62,6 +62,7 @@ const Tun: React.FC = () => {
header={ header={
<Button <Button
size="sm" size="sm"
className="app-nodrag"
color="primary" color="primary"
onPress={() => onPress={() =>
onSave({ onSave({