mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-01 10:23:33 +00:00
Add native titlebar & fix app restart for AppImages
This commit is contained in:
parent
d055ae89e0
commit
a878875f83
12 changed files with 82 additions and 23 deletions
|
|
@ -138,7 +138,9 @@ const HomeRoute = () => {
|
|||
<Box
|
||||
ref={cq.ref}
|
||||
mb="5rem"
|
||||
pt={windowBarStyle === Platform.WEB ? '5rem' : '3rem'}
|
||||
pt={
|
||||
windowBarStyle === Platform.WEB || windowBarStyle === Platform.LINUX ? '5rem' : '3rem'
|
||||
}
|
||||
px="2rem"
|
||||
>
|
||||
<Stack spacing="lg">
|
||||
|
|
|
|||
|
|
@ -13,16 +13,17 @@ export const SidebarPlayQueue = () => {
|
|||
const queueRef = useRef<{ grid: AgGridReactType<Song> } | null>(null);
|
||||
const { windowBarStyle } = useWindowSettings();
|
||||
|
||||
const webOrNative = windowBarStyle === Platform.WEB || windowBarStyle === Platform.LINUX;
|
||||
return (
|
||||
<VirtualGridContainer>
|
||||
{windowBarStyle === Platform.WEB && (
|
||||
<Stack mr={windowBarStyle === Platform.WEB ? '130px' : undefined}>
|
||||
{webOrNative && (
|
||||
<Stack mr={webOrNative ? '130px' : undefined}>
|
||||
<PageHeader backgroundColor="var(--titlebar-bg)" />
|
||||
</Stack>
|
||||
)}
|
||||
<Paper
|
||||
display={windowBarStyle !== Platform.WEB ? 'flex' : undefined}
|
||||
h={windowBarStyle !== Platform.WEB ? '65px' : undefined}
|
||||
display={!webOrNative ? 'flex' : undefined}
|
||||
h={!webOrNative ? '65px' : undefined}
|
||||
>
|
||||
<PlayQueueListControls
|
||||
tableRef={queueRef}
|
||||
|
|
|
|||
|
|
@ -129,7 +129,10 @@ const containerVariants: Variants = {
|
|||
closed: (custom) => {
|
||||
const { windowBarStyle } = custom;
|
||||
return {
|
||||
height: windowBarStyle !== Platform.WEB ? 'calc(100vh - 120px)' : 'calc(100vh - 90px)',
|
||||
height:
|
||||
windowBarStyle === Platform.WINDOWS || windowBarStyle === Platform.MACOS
|
||||
? 'calc(100vh - 120px)'
|
||||
: 'calc(100vh - 90px)',
|
||||
position: 'absolute',
|
||||
top: '100vh',
|
||||
transition: {
|
||||
|
|
@ -144,7 +147,10 @@ const containerVariants: Variants = {
|
|||
const { dynamicBackground, background, windowBarStyle } = custom;
|
||||
return {
|
||||
background: dynamicBackground ? background : 'var(--main-bg)',
|
||||
height: windowBarStyle !== Platform.WEB ? 'calc(100vh - 120px)' : 'calc(100vh - 90px)',
|
||||
height:
|
||||
windowBarStyle === Platform.WINDOWS || windowBarStyle === Platform.MACOS
|
||||
? 'calc(100vh - 120px)'
|
||||
: 'calc(100vh - 90px)',
|
||||
left: 0,
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
|
|
|
|||
|
|
@ -5,12 +5,13 @@ import {
|
|||
SettingsSection,
|
||||
SettingOption,
|
||||
} from '/@/renderer/features/settings/components/settings-section';
|
||||
import { Select, Switch } from '/@/renderer/components';
|
||||
import { Select, Switch, toast } from '/@/renderer/components';
|
||||
|
||||
const WINDOW_BAR_OPTIONS = [
|
||||
{ label: 'Web (hidden)', value: Platform.WEB },
|
||||
{ label: 'Windows', value: Platform.WINDOWS },
|
||||
{ label: 'macOS', value: Platform.MACOS },
|
||||
{ label: 'Native', value: Platform.LINUX },
|
||||
];
|
||||
|
||||
const localSettings = isElectron() ? window.electron.localSettings : null;
|
||||
|
|
@ -28,6 +29,26 @@ export const WindowSettings = () => {
|
|||
value={settings.windowBarStyle}
|
||||
onChange={(e) => {
|
||||
if (!e) return;
|
||||
|
||||
// warn that a restart is required
|
||||
if (
|
||||
(localSettings?.get('window_has_frame') && e !== Platform.LINUX) ||
|
||||
(!localSettings?.get('window_has_frame') && e === Platform.LINUX)
|
||||
) {
|
||||
toast.info({
|
||||
autoClose: false,
|
||||
id: 'restart-toast',
|
||||
message: 'Restart to apply changes... close the notification to restart Feishin',
|
||||
onClose: () => {
|
||||
window.electron.ipc.send('app-restart');
|
||||
},
|
||||
title: 'Restart required',
|
||||
});
|
||||
} else {
|
||||
toast.update({ autoClose: 0, id: 'restart-toast', message: '', onClose: () => {} }); // clean old toasts
|
||||
}
|
||||
|
||||
localSettings?.set('window_window_bar_style', e as Platform);
|
||||
setSettings({
|
||||
window: {
|
||||
...settings,
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ const SidebarContainer = styled(motion.div)<{ windowBarStyle: Platform }>`
|
|||
flex-direction: column;
|
||||
height: 100%;
|
||||
max-height: ${(props) =>
|
||||
props.windowBarStyle === Platform.WEB
|
||||
props.windowBarStyle === Platform.WEB || props.windowBarStyle === Platform.LINUX
|
||||
? 'calc(100vh - 149px)'
|
||||
: 'calc(100vh - 119px)'}; // Playerbar (90px), titlebar (65px), windowbar (30px)
|
||||
user-select: none;
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ import { useWindowSettings } from '../../../store/settings.store';
|
|||
const SidebarContainer = styled.div<{ windowBarStyle: Platform }>`
|
||||
height: 100%;
|
||||
max-height: ${(props) =>
|
||||
props.windowBarStyle === Platform.WEB
|
||||
props.windowBarStyle === Platform.WEB || props.windowBarStyle === Platform.LINUX
|
||||
? 'calc(100vh - 149px)'
|
||||
: 'calc(100vh - 179px)'}; // Playerbar (90px), titlebar (65px), windowbar (30px)
|
||||
user-select: none;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue