Skip to content
This repository was archived by the owner on Jul 25, 2022. It is now read-only.

Commit 5ce5711

Browse files
committed
feat: Use custom window buttons on Windows
1 parent 6f3fe50 commit 5ce5711

File tree

4 files changed

+32
-1
lines changed

4 files changed

+32
-1
lines changed

src/window/WindowFactory.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { UndefinedObject } from '@common/types/types';
66
import Config from '@common/config/Config';
77
import windowStateKeeper, { State } from 'electron-window-state';
88
import { IConfig } from '@common/config/Config';
9-
import { isDev } from '@common/utils/utils';
9+
import { isDev, isWin } from '@common/utils/utils';
1010
import { callTrigger } from '@common/packages/packages';
1111

1212
export default class WindowFactory implements Factory<BrowserWindow> {
@@ -83,6 +83,7 @@ export default class WindowFactory implements Factory<BrowserWindow> {
8383
transparent: true,
8484
title: 'Squid',
8585
titleBarStyle: 'hidden',
86+
frame: !isWin,
8687
visualEffectState: 'active', // Always show the vibrancy
8788
show: false,
8889
backgroundColor: '#00ffffff',
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React, { FC, ReactElement, useContext } from 'react';
2+
import { ConfigContext } from '@ui/contexts/ConfigContext';
3+
4+
const ButtonSeparator: FC = (): ReactElement => {
5+
6+
const { theme } = useContext(ConfigContext);
7+
8+
return <div
9+
className='button-separator'
10+
style={{ backgroundColor: theme.border }} />;
11+
}
12+
13+
export default ButtonSeparator;

ui/components/navbar/Navbar.tsx

+10
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { ConfigContext } from '@ui/contexts/ConfigContext';
55
import NavbarButton from '@ui/components/navbar/buttons/NavbarButton';
66
import { remote } from 'electron';
77
import { isMac } from '@common/utils/utils';
8+
import ButtonSeparator from '@ui/components/navbar/ButtonSeparator';
89
import '@ui/styles/navbar.scss';
910

1011
const Navbar: FC = (): ReactElement => {
@@ -23,6 +24,15 @@ const Navbar: FC = (): ReactElement => {
2324
onClick={() => remote.getCurrentWindow().webContents.send('menu')}
2425
icon="mdi-settings" />
2526
<AuthButton />
27+
{
28+
!isMac &&
29+
<>
30+
<ButtonSeparator />
31+
<NavbarButton onClick={() => remote.getCurrentWindow().minimize()} icon="mdi-window_minimize" />
32+
<NavbarButton onClick={() => remote.getCurrentWindow().isMaximized() ? remote.getCurrentWindow().unmaximize() : remote.getCurrentWindow().maximize()} icon="mdi-window_restore" />
33+
<NavbarButton onClick={() => remote.getCurrentWindow().close()} icon="mdi-window_close" />
34+
</>
35+
}
2636
</div>
2737
</div>
2838
);

ui/styles/navbar.scss

+7
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@
2121
display: flex;
2222
justify-content: flex-end;
2323

24+
.button-separator {
25+
26+
width: 1px;
27+
height: 100%;
28+
margin: 0 15px;
29+
}
30+
2431
button {
2532

2633
-webkit-app-region: no-drag;

0 commit comments

Comments
 (0)