diff --git a/src/main/services/dialogs-service.ts b/src/main/services/dialogs-service.ts index 72c35637e..52ed29c33 100644 --- a/src/main/services/dialogs-service.ts +++ b/src/main/services/dialogs-service.ts @@ -101,9 +101,8 @@ export class DialogsService { browserView = await this.createBrowserView(); } - const appWindow = Application.instance.windows.fromBrowserWindow( - browserWindow, - ); + const appWindow = + Application.instance.windows.fromBrowserWindow(browserWindow); if (foundDialog && tabAssociation) { foundDialog.tabIds.push(tabAssociation.tabId); @@ -111,6 +110,7 @@ export class DialogsService { } browserWindow.webContents.send('dialog-visibility-change', name, true); + appWindow.fixDragging(); this.browserViewDetails.set(browserView.webContents.id, true); @@ -160,6 +160,7 @@ export class DialogsService { if (tabId && tabId !== selectedId) return; browserWindow.webContents.send('dialog-visibility-change', name, false); + appWindow.fixDragging(); browserWindow.removeBrowserView(browserView); @@ -220,6 +221,7 @@ export class DialogsService { tabsEvents.activate = (id) => { const visible = dialog.tabIds.includes(id); browserWindow.webContents.send('dialog-visibility-change', name, visible); + appWindow.fixDragging(); if (visible) { dialog._sendTabInfo(id); diff --git a/src/renderer/views/app/components/App/index.tsx b/src/renderer/views/app/components/App/index.tsx index c7afd76c2..8b93b5e89 100644 --- a/src/renderer/views/app/components/App/index.tsx +++ b/src/renderer/views/app/components/App/index.tsx @@ -58,6 +58,7 @@ const App = observer(() => { !!x)} > diff --git a/src/renderer/views/app/components/App/style.ts b/src/renderer/views/app/components/App/style.ts index b27aa0533..842032458 100644 --- a/src/renderer/views/app/components/App/style.ts +++ b/src/renderer/views/app/components/App/style.ts @@ -10,9 +10,16 @@ export const Line = styled.div` background-color: black; `; -export const StyledApp = styled.div` +interface StyledAppProps { + dialogOpen: boolean; +} + +export const StyledApp = styled.div` display: flex; flex-flow: column; background-color: #fff; - -webkit-app-region: drag; + ${({ dialogOpen }) => + css` + -webkit-app-region: ${dialogOpen ? 'no-drag' : 'drag'}; + `} `; diff --git a/src/renderer/views/app/components/Titlebar/index.tsx b/src/renderer/views/app/components/Titlebar/index.tsx index f198daaaf..ac0a10cf7 100644 --- a/src/renderer/views/app/components/Titlebar/index.tsx +++ b/src/renderer/views/app/components/Titlebar/index.tsx @@ -24,6 +24,7 @@ export const Titlebar = observer(() => { onMouseDown={onMouseDown} isFullscreen={store.isFullscreen} color={store.tabs.selectedTab?.color} + dialogOpen={Object.values(store.dialogsVisibility).some((x) => !!x)} > {store.isCompact && } diff --git a/src/renderer/views/app/components/Titlebar/style.ts b/src/renderer/views/app/components/Titlebar/style.ts index e9a9b08af..d1e56ca60 100644 --- a/src/renderer/views/app/components/Titlebar/style.ts +++ b/src/renderer/views/app/components/Titlebar/style.ts @@ -7,6 +7,7 @@ import { centerIcon } from '~/renderer/mixins'; interface TitlebarProps { isFullscreen: boolean; theme: ITheme; + dialogOpen: boolean; } export const StyledTitlebar = styled.div` @@ -27,13 +28,13 @@ export const StyledTitlebar = styled.div` content: ''; } - ${({ isFullscreen, theme, color }) => css` + ${({ isFullscreen, theme, color, dialogOpen }) => css` background-color: ${color ? color : theme['titlebar.backgroundColor']}; height: 45px; align-items: ${theme.isCompact ? 'center' : 'initial'}; &:before { - -webkit-app-region: ${isFullscreen ? 'no-drag' : 'drag'}; + -webkit-app-region: ${isFullscreen || dialogOpen ? 'no-drag' : 'drag'}; } `}; diff --git a/src/renderer/views/app/components/Toolbar/index.tsx b/src/renderer/views/app/components/Toolbar/index.tsx index 7fd7d5bce..d7c2cedec 100644 --- a/src/renderer/views/app/components/Toolbar/index.tsx +++ b/src/renderer/views/app/components/Toolbar/index.tsx @@ -50,6 +50,7 @@ export const Toolbar = observer(() => { onMouseDown={onMouseDown} isFullscreen={store.isFullscreen} color={store.tabs.selectedTab?.color} + dialogOpen={Object.values(store.dialogsVisibility).some((x) => !!x)} >
diff --git a/src/renderer/views/app/components/Toolbar/style.ts b/src/renderer/views/app/components/Toolbar/style.ts index 1bf99a996..36101fc24 100644 --- a/src/renderer/views/app/components/Toolbar/style.ts +++ b/src/renderer/views/app/components/Toolbar/style.ts @@ -8,6 +8,7 @@ export interface ToolbarProps { isFullscreen: boolean; theme: ITheme; color?: string; + dialogOpen: boolean; } export const StyledToolbar = styled.div` @@ -18,15 +19,14 @@ export const StyledToolbar = styled.div` flex-flow: row; width: 100%; justify-content: center; - -webkit-app-region: drag; - ${({ isFullscreen, theme, color }) => css` + ${({ isFullscreen, theme, color, dialogOpen }) => css` background-color: ${!!color ? color : theme['titlebar.backgroundColor']}; align-items: ${theme.isCompact ? 'center' : 'initial'}; padding-left: ${platform() === 'darwin' && !isFullscreen ? 78 : 4}px; padding-top: 10px; padding-bottom: 10px; &:before { - -webkit-app-region: ${isFullscreen ? 'no-drag' : 'drag'}; + -webkit-app-region: ${isFullscreen || dialogOpen ? 'no-drag' : 'drag'}; } `}; diff --git a/src/renderer/views/app/store/index.ts b/src/renderer/views/app/store/index.ts index 318e4c548..c93b1ed9e 100644 --- a/src/renderer/views/app/store/index.ts +++ b/src/renderer/views/app/store/index.ts @@ -1,4 +1,10 @@ -import { observable, computed, makeObservable, makeAutoObservable } from 'mobx'; +import { + observable, + computed, + makeObservable, + makeAutoObservable, + autorun, +} from 'mobx'; import { TabsStore } from './tabs'; import { TabGroupsStore } from './tab-groups';