@@ -31,7 +31,6 @@ import {
31
31
} from 'electron' ;
32
32
import type {
33
33
MenuItemConstructorOptions ,
34
- TitleBarOverlayOptions ,
35
34
LoginItemSettingsOptions ,
36
35
} from 'electron' ;
37
36
import { z } from 'zod' ;
@@ -95,7 +94,6 @@ import { MainSQL } from '../ts/sql/main';
95
94
import * as sqlChannels from './sql_channel' ;
96
95
import * as windowState from './window_state' ;
97
96
import type { CreateTemplateOptionsType } from './menu' ;
98
- import type { MenuActionType } from '../ts/types/menu' ;
99
97
import { createTemplate } from './menu' ;
100
98
import { installFileHandler , installWebHandler } from './protocol_filter' ;
101
99
import OS from '../ts/util/os/osMain' ;
@@ -541,10 +539,7 @@ async function handleUrl(rawTarget: string) {
541
539
}
542
540
}
543
541
544
- async function handleCommonWindowEvents (
545
- window : BrowserWindow ,
546
- titleBarOverlay : TitleBarOverlayOptions | false = false
547
- ) {
542
+ async function handleCommonWindowEvents ( window : BrowserWindow ) {
548
543
window . webContents . on ( 'will-navigate' , ( event , rawTarget ) => {
549
544
event . preventDefault ( ) ;
550
545
@@ -578,23 +573,6 @@ async function handleCommonWindowEvents(
578
573
await zoomFactorService . syncWindow ( window ) ;
579
574
580
575
nativeThemeNotifier . addWindow ( window ) ;
581
-
582
- if ( titleBarOverlay ) {
583
- const onThemeChange = async ( ) => {
584
- try {
585
- const newOverlay = await getTitleBarOverlay ( ) ;
586
- if ( ! newOverlay ) {
587
- return ;
588
- }
589
- window . setTitleBarOverlay ( newOverlay ) ;
590
- } catch ( error ) {
591
- console . error ( 'onThemeChange error' , error ) ;
592
- }
593
- } ;
594
-
595
- nativeTheme . on ( 'updated' , onThemeChange ) ;
596
- settingsChannel ?. on ( 'change:themeSetting' , onThemeChange ) ;
597
- }
598
576
}
599
577
600
578
const DEFAULT_WIDTH = ciMode ? 1024 : 800 ;
@@ -654,45 +632,11 @@ if (OS.isWindows()) {
654
632
// - Windows < 10 (7, 8)
655
633
// - macOS (but no custom titlebar is displayed, see
656
634
// `--title-bar-drag-area-height` in `stylesheets/_titlebar.scss`
657
- const mainTitleBarStyle =
658
- ( OS . isMacOS ( ) || OS . hasCustomTitleBar ( ) ) &&
659
- ! isTestEnvironment ( getEnvironment ( ) )
660
- ? ( 'hidden' as const )
661
- : ( 'default' as const ) ;
662
-
663
- const nonMainTitleBarStyle = OS . hasCustomTitleBar ( )
635
+ const mainTitleBarStyle = OS . isMacOS ( )
664
636
? ( 'hidden' as const )
665
637
: ( 'default' as const ) ;
666
638
667
- async function getTitleBarOverlay ( ) : Promise < TitleBarOverlayOptions | false > {
668
- if ( ! OS . hasCustomTitleBar ( ) ) {
669
- return false ;
670
- }
671
-
672
- const theme = await getResolvedThemeSetting ( ) ;
673
-
674
- let color : string ;
675
- let symbolColor : string ;
676
- if ( theme === 'light' ) {
677
- color = '#e8e8e8' ;
678
- symbolColor = '#1b1b1b' ;
679
- } else if ( theme === 'dark' ) {
680
- // $color-gray-80
681
- color = '#2e2e2e' ;
682
- // $color-gray-05
683
- symbolColor = '#e9e9e9' ;
684
- } else {
685
- throw missingCaseError ( theme ) ;
686
- }
687
-
688
- return {
689
- color,
690
- symbolColor,
691
-
692
- // Should match `--titlebar-height` in stylesheets/_titlebar.scss
693
- height : 28 - 1 ,
694
- } ;
695
- }
639
+ const nonMainTitleBarStyle = 'default' as const ;
696
640
697
641
async function safeLoadURL ( window : BrowserWindow , url : string ) : Promise < void > {
698
642
let wasDestroyed = false ;
@@ -731,8 +675,6 @@ async function createWindow() {
731
675
const usePreloadBundle =
732
676
! isTestEnvironment ( getEnvironment ( ) ) || forcePreloadBundle ;
733
677
734
- const titleBarOverlay = await getTitleBarOverlay ( ) ;
735
-
736
678
const windowOptions : Electron . BrowserWindowConstructorOptions = {
737
679
show : false ,
738
680
width : DEFAULT_WIDTH ,
@@ -741,7 +683,6 @@ async function createWindow() {
741
683
minHeight : MIN_HEIGHT ,
742
684
autoHideMenuBar : false ,
743
685
titleBarStyle : mainTitleBarStyle ,
744
- titleBarOverlay,
745
686
backgroundColor : isTestEnvironment ( getEnvironment ( ) )
746
687
? '#ffffff' // Tests should always be rendered on a white background
747
688
: await getBackgroundColor ( ) ,
@@ -887,7 +828,7 @@ async function createWindow() {
887
828
mainWindow . webContents . openDevTools ( ) ;
888
829
}
889
830
890
- await handleCommonWindowEvents ( mainWindow , titleBarOverlay ) ;
831
+ await handleCommonWindowEvents ( mainWindow ) ;
891
832
892
833
// App dock icon bounce
893
834
bounce . init ( mainWindow ) ;
@@ -1288,15 +1229,12 @@ async function showAbout() {
1288
1229
return ;
1289
1230
}
1290
1231
1291
- const titleBarOverlay = await getTitleBarOverlay ( ) ;
1292
-
1293
1232
const options = {
1294
1233
width : 500 ,
1295
1234
height : 500 ,
1296
1235
resizable : false ,
1297
1236
title : getResolvedMessagesLocale ( ) . i18n ( 'icu:aboutSignalDesktop' ) ,
1298
1237
titleBarStyle : nonMainTitleBarStyle ,
1299
- titleBarOverlay,
1300
1238
autoHideMenuBar : true ,
1301
1239
backgroundColor : await getBackgroundColor ( ) ,
1302
1240
show : false ,
@@ -1313,7 +1251,7 @@ async function showAbout() {
1313
1251
1314
1252
aboutWindow = new BrowserWindow ( options ) ;
1315
1253
1316
- await handleCommonWindowEvents ( aboutWindow , titleBarOverlay ) ;
1254
+ await handleCommonWindowEvents ( aboutWindow ) ;
1317
1255
1318
1256
aboutWindow . on ( 'closed' , ( ) => {
1319
1257
aboutWindow = undefined ;
@@ -1338,16 +1276,13 @@ async function showSettingsWindow() {
1338
1276
return ;
1339
1277
}
1340
1278
1341
- const titleBarOverlay = await getTitleBarOverlay ( ) ;
1342
-
1343
1279
const options = {
1344
1280
width : 700 ,
1345
1281
height : 700 ,
1346
1282
frame : true ,
1347
1283
resizable : false ,
1348
1284
title : getResolvedMessagesLocale ( ) . i18n ( 'icu:signalDesktopPreferences' ) ,
1349
1285
titleBarStyle : mainTitleBarStyle ,
1350
- titleBarOverlay,
1351
1286
autoHideMenuBar : true ,
1352
1287
backgroundColor : await getBackgroundColor ( ) ,
1353
1288
show : false ,
@@ -1364,7 +1299,7 @@ async function showSettingsWindow() {
1364
1299
1365
1300
settingsWindow = new BrowserWindow ( options ) ;
1366
1301
1367
- await handleCommonWindowEvents ( settingsWindow , titleBarOverlay ) ;
1302
+ await handleCommonWindowEvents ( settingsWindow ) ;
1368
1303
1369
1304
settingsWindow . on ( 'closed' , ( ) => {
1370
1305
settingsWindow = undefined ;
@@ -1434,15 +1369,12 @@ async function showDebugLogWindow() {
1434
1369
}
1435
1370
}
1436
1371
1437
- const titleBarOverlay = await getTitleBarOverlay ( ) ;
1438
-
1439
1372
const options : Electron . BrowserWindowConstructorOptions = {
1440
1373
width : 700 ,
1441
1374
height : 500 ,
1442
1375
resizable : false ,
1443
1376
title : getResolvedMessagesLocale ( ) . i18n ( 'icu:debugLog' ) ,
1444
1377
titleBarStyle : nonMainTitleBarStyle ,
1445
- titleBarOverlay,
1446
1378
autoHideMenuBar : true ,
1447
1379
backgroundColor : await getBackgroundColor ( ) ,
1448
1380
show : false ,
@@ -1459,7 +1391,7 @@ async function showDebugLogWindow() {
1459
1391
1460
1392
debugLogWindow = new BrowserWindow ( options ) ;
1461
1393
1462
- await handleCommonWindowEvents ( debugLogWindow , titleBarOverlay ) ;
1394
+ await handleCommonWindowEvents ( debugLogWindow ) ;
1463
1395
1464
1396
debugLogWindow . on ( 'closed' , ( ) => {
1465
1397
debugLogWindow = undefined ;
@@ -2504,12 +2436,6 @@ ipc.on('locale-display-names', event => {
2504
2436
event . returnValue = getResolvedMessagesLocale ( ) . localeDisplayNames ;
2505
2437
} ) ;
2506
2438
2507
- // TODO DESKTOP-5241
2508
- ipc . on ( 'OS.getHasCustomTitleBar' , event => {
2509
- // eslint-disable-next-line no-param-reassign
2510
- event . returnValue = OS . hasCustomTitleBar ( ) ;
2511
- } ) ;
2512
-
2513
2439
// TODO DESKTOP-5241
2514
2440
ipc . on ( 'OS.getClassName' , event => {
2515
2441
// eslint-disable-next-line no-param-reassign
@@ -2836,46 +2762,6 @@ async function zoomReset() {
2836
2762
await zoomFactorService . zoomReset ( ) ;
2837
2763
}
2838
2764
2839
- ipc . handle ( 'executeMenuAction' , async ( _event , action : MenuActionType ) => {
2840
- if ( action === 'forceUpdate' ) {
2841
- drop ( forceUpdate ( ) ) ;
2842
- } else if ( action === 'openArtCreator' ) {
2843
- drop ( openArtCreator ( ) ) ;
2844
- } else if ( action === 'openContactUs' ) {
2845
- openContactUs ( ) ;
2846
- } else if ( action === 'openForums' ) {
2847
- openForums ( ) ;
2848
- } else if ( action === 'openJoinTheBeta' ) {
2849
- openJoinTheBeta ( ) ;
2850
- } else if ( action === 'openReleaseNotes' ) {
2851
- openReleaseNotes ( ) ;
2852
- } else if ( action === 'openSupportPage' ) {
2853
- openSupportPage ( ) ;
2854
- } else if ( action === 'setupAsNewDevice' ) {
2855
- setupAsNewDevice ( ) ;
2856
- } else if ( action === 'setupAsStandalone' ) {
2857
- setupAsStandalone ( ) ;
2858
- } else if ( action === 'showAbout' ) {
2859
- drop ( showAbout ( ) ) ;
2860
- } else if ( action === 'showDebugLog' ) {
2861
- drop ( showDebugLogWindow ( ) ) ;
2862
- } else if ( action === 'showKeyboardShortcuts' ) {
2863
- showKeyboardShortcuts ( ) ;
2864
- } else if ( action === 'showSettings' ) {
2865
- drop ( showSettingsWindow ( ) ) ;
2866
- } else if ( action === 'showWindow' ) {
2867
- showWindow ( ) ;
2868
- } else if ( action === 'zoomIn' ) {
2869
- drop ( zoomIn ( ) ) ;
2870
- } else if ( action === 'zoomOut' ) {
2871
- drop ( zoomOut ( ) ) ;
2872
- } else if ( action === 'zoomReset' ) {
2873
- drop ( zoomReset ( ) ) ;
2874
- } else {
2875
- throw missingCaseError ( action ) ;
2876
- }
2877
- } ) ;
2878
-
2879
2765
ipc . handle (
2880
2766
'net.resolveHost' ,
2881
2767
( _event , hostname : string , queryType ?: 'A' | 'AAAA' ) => {
0 commit comments