mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-18 00:46:45 +00:00
fix(electron): always show app border unless in fullscreen
Previously the 1px border only appeared with the custom title bar enabled. Now it shows for all Electron windows and is hidden during fullscreen via IPC-driven body class toggling.
This commit is contained in:
parent
3b266a5842
commit
78ef3c39d5
6 changed files with 31 additions and 1 deletions
|
|
@ -259,6 +259,19 @@ export const createWindow = async ({
|
|||
}
|
||||
});
|
||||
|
||||
// Notify renderer of fullscreen state changes (used for app border visibility)
|
||||
mainWin.on('enter-full-screen', () => {
|
||||
mainWin.webContents.send(IPC.ENTER_FULL_SCREEN);
|
||||
});
|
||||
mainWin.on('leave-full-screen', () => {
|
||||
mainWin.webContents.send(IPC.LEAVE_FULL_SCREEN);
|
||||
});
|
||||
mainWin.webContents.on('did-finish-load', () => {
|
||||
if (mainWin.isFullScreen()) {
|
||||
mainWin.webContents.send(IPC.ENTER_FULL_SCREEN);
|
||||
}
|
||||
});
|
||||
|
||||
// Listen for theme changes to update title bar overlay color and symbol
|
||||
if (isUseCustomWindowTitleBar && !IS_MAC) {
|
||||
ipcMain.on(IPC.UPDATE_TITLE_BAR_DARK_MODE, (ev, isDarkMode: boolean) => {
|
||||
|
|
|
|||
|
|
@ -53,6 +53,8 @@ export enum IPC {
|
|||
ANY_FILE_DOWNLOADED = 'ANY_FILE_DOWNLOADED',
|
||||
|
||||
FULL_SCREEN_BLOCKER = 'FULL_SCREEN_BLOCKER',
|
||||
ENTER_FULL_SCREEN = 'ENTER_FULL_SCREEN',
|
||||
LEAVE_FULL_SCREEN = 'LEAVE_FULL_SCREEN',
|
||||
|
||||
GET_PATH = 'GET_PATH',
|
||||
GET_BACKUP_PATH = 'GET_BACKUP_PATH',
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ export enum BodyClass {
|
|||
|
||||
isAndroidKeyboardShown = 'isAndroidKeyboardShown',
|
||||
isAndroidKeyboardHidden = 'isAndroidKeyboardHidden',
|
||||
isFullScreen = 'isFullScreen',
|
||||
isAddTaskBarOpen = 'isAddTaskBarOpen',
|
||||
|
||||
// iOS-specific classes
|
||||
|
|
|
|||
|
|
@ -24,6 +24,13 @@ export const ipcSuspend$: Observable<unknown> = IS_ELECTRON
|
|||
? ipcEvent$(IPC.SUSPEND).pipe()
|
||||
: EMPTY;
|
||||
|
||||
export const ipcEnterFullScreen$: Observable<unknown> = IS_ELECTRON
|
||||
? ipcEvent$(IPC.ENTER_FULL_SCREEN).pipe()
|
||||
: EMPTY;
|
||||
export const ipcLeaveFullScreen$: Observable<unknown> = IS_ELECTRON
|
||||
? ipcEvent$(IPC.LEAVE_FULL_SCREEN).pipe()
|
||||
: EMPTY;
|
||||
|
||||
export const ipcShowAddTaskBar$: Observable<unknown> = IS_ELECTRON
|
||||
? ipcEvent$(IPC.SHOW_ADD_TASK_BAR).pipe()
|
||||
: EMPTY;
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import { combineLatest, fromEvent, Observable, of } from 'rxjs';
|
|||
import { IS_FIREFOX } from '../../util/is-firefox';
|
||||
import { ImexViewService } from '../../imex/imex-meta/imex-view.service';
|
||||
import { IS_MOUSE_PRIMARY, IS_TOUCH_PRIMARY } from '../../util/is-mouse-primary';
|
||||
import { ipcEnterFullScreen$, ipcLeaveFullScreen$ } from '../ipc-events';
|
||||
|
||||
import { IS_ANDROID_WEB_VIEW } from '../../util/is-android-web-view';
|
||||
import { androidInterface } from '../../features/android/android-interface';
|
||||
|
|
@ -282,6 +283,12 @@ export class GlobalThemeService {
|
|||
this.document.body.classList.add(BodyClass.isElectron);
|
||||
this.document.body.classList.add(BodyClass.isAdvancedFeatures);
|
||||
this.document.body.classList.remove(BodyClass.isNoAdvancedFeatures);
|
||||
ipcEnterFullScreen$.pipe(takeUntilDestroyed(this._destroyRef)).subscribe(() => {
|
||||
this.document.body.classList.add(BodyClass.isFullScreen);
|
||||
});
|
||||
ipcLeaveFullScreen$.pipe(takeUntilDestroyed(this._destroyRef)).subscribe(() => {
|
||||
this.document.body.classList.remove(BodyClass.isFullScreen);
|
||||
});
|
||||
} else {
|
||||
this.document.body.classList.add(BodyClass.isWeb);
|
||||
this._chromeExtensionInterfaceService.onReady$.pipe(take(1)).subscribe(() => {
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ body {
|
|||
}
|
||||
}
|
||||
|
||||
&.isObsidianStyleHeader.isElectron {
|
||||
&.isElectron:not(.isFullScreen) {
|
||||
border: 1px solid var(--divider-color);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue