Skip to content

Commit 5479cab

Browse files
committed
Move "hide menu bar" feature to the Title bar dropdown
1 parent 0dd2c73 commit 5479cab

11 files changed

Lines changed: 14 additions & 72 deletions

File tree

app/src/lib/app-state.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -374,12 +374,6 @@ export interface IAppState {
374374
*/
375375
readonly hideWindowOnQuit: boolean
376376

377-
/**
378-
* Whether or not the menu bar should be hidden until the user presses Alt.
379-
* Only applicable on Linux.
380-
*/
381-
readonly autoHideMenuBar: boolean
382-
383377
/**
384378
* Whether or not the app should use spell check on commit summary and description
385379
*/

app/src/lib/main-process-config.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@ import { TitleBarStyle } from '../ui/lib/title-bar-style'
77
export type MainProcessConfig = {
88
titleBarStyle: TitleBarStyle
99
hideWindowOnQuit: boolean
10-
autoHideMenuBar: boolean
1110
}
1211

1312
const DEFAULT_CONFIG: MainProcessConfig = {
1413
titleBarStyle: 'native',
1514
hideWindowOnQuit: false,
16-
autoHideMenuBar: false,
1715
}
1816

1917
let cachedMainProcessConfig: MainProcessConfig | null = null
@@ -34,7 +32,8 @@ export function readMainProcessConfig(): MainProcessConfig {
3432

3533
if (
3634
storedMainProcessConfig.titleBarStyle === 'native' ||
37-
storedMainProcessConfig.titleBarStyle === 'custom'
35+
storedMainProcessConfig.titleBarStyle === 'custom' ||
36+
storedMainProcessConfig.titleBarStyle === 'native-without-menu-bar'
3837
) {
3938
cachedMainProcessConfig = storedMainProcessConfig
4039
}

app/src/lib/stores/app-store.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,6 @@ export class AppStore extends TypedBaseStore<IAppState> {
705705
private readonly lastSidebarWorktreeRefreshAt = new Map<string, number>()
706706
private showCompareTab: boolean = showCompareTabDefault
707707
private hideWindowOnQuit: boolean = __DARWIN__
708-
private autoHideMenuBar: boolean = false
709708

710709
private useWindowsOpenSSH: boolean = false
711710

@@ -1318,7 +1317,6 @@ export class AppStore extends TypedBaseStore<IAppState> {
13181317
currentOnboardingTutorialStep: this.currentOnboardingTutorialStep,
13191318
repositoryIndicatorsEnabled: this.repositoryIndicatorsEnabled,
13201319
hideWindowOnQuit: this.hideWindowOnQuit,
1321-
autoHideMenuBar: this.autoHideMenuBar,
13221320
commitSpellcheckEnabled: this.commitSpellcheckEnabled,
13231321
showCommitAuthorInfo: this.showCommitAuthorInfo,
13241322
currentDragElement: this.currentDragElement,
@@ -2759,7 +2757,6 @@ export class AppStore extends TypedBaseStore<IAppState> {
27592757
const mainProcessConfig = await getMainProcessConfig()
27602758
this.titleBarStyle = mainProcessConfig.titleBarStyle
27612759
this.hideWindowOnQuit = mainProcessConfig.hideWindowOnQuit
2762-
this.autoHideMenuBar = mainProcessConfig.autoHideMenuBar
27632760

27642761
this.lastThankYou = getObject<ILastThankYou>(lastThankYouKey)
27652762

@@ -8432,15 +8429,6 @@ export class AppStore extends TypedBaseStore<IAppState> {
84328429
return updateMainProcessConfig({ hideWindowOnQuit })
84338430
}
84348431

8435-
public _setAutoHideMenuBar(autoHideMenuBar: boolean) {
8436-
if (this.autoHideMenuBar === autoHideMenuBar) {
8437-
return
8438-
}
8439-
this.autoHideMenuBar = autoHideMenuBar
8440-
this.emitUpdate()
8441-
return updateMainProcessConfig({ autoHideMenuBar })
8442-
}
8443-
84448432
public async _resolveCurrentEditor() {
84458433
const match = await findEditorOrDefault(this.selectedExternalEditor)
84468434
const resolvedExternalEditor = match != null ? match.editor : null

app/src/main-process/app-window.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,13 @@ export class AppWindow {
7979
} else if (__WIN32__) {
8080
windowOptions.frame = false
8181
} else if (__LINUX__) {
82-
if (readMainProcessConfig().titleBarStyle === 'custom') {
82+
const config = readMainProcessConfig()
83+
if (config.titleBarStyle === 'custom') {
8384
windowOptions.frame = false
8485
}
8586
windowOptions.icon = join(__dirname, 'static', 'logos', '512x512.png')
86-
windowOptions.autoHideMenuBar = readMainProcessConfig().autoHideMenuBar
87+
windowOptions.autoHideMenuBar =
88+
config.titleBarStyle === 'native-without-menu-bar'
8789

8890
// relax restriction here for users trying to run app at a small
8991
// resolution and any other side-effects of dropping this restriction are

app/src/ui/app.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1745,7 +1745,6 @@ export class App extends React.Component<IAppProps, IAppState> {
17451745
showCompareTab={this.state.showCompareTab}
17461746
repositoryIndicatorsEnabled={this.state.repositoryIndicatorsEnabled}
17471747
hideWindowOnQuit={this.state.hideWindowOnQuit}
1748-
autoHideMenuBar={this.state.autoHideMenuBar}
17491748
onEditGlobalGitConfig={this.editGlobalGitConfig}
17501749
underlineLinks={this.state.underlineLinks}
17511750
showDiffCheckMarks={this.state.showDiffCheckMarks}

app/src/ui/dispatcher/dispatcher.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3011,10 +3011,6 @@ export class Dispatcher {
30113011
this.appStore._setHideWindowOnQuit(hideWindowOnQuit)
30123012
}
30133013

3014-
public setAutoHideMenuBar(autoHideMenuBar: boolean) {
3015-
this.appStore._setAutoHideMenuBar(autoHideMenuBar)
3016-
}
3017-
30183014
public setCommitSpellcheckEnabled(commitSpellcheckEnabled: boolean) {
30193015
this.appStore._setCommitSpellcheckEnabled(commitSpellcheckEnabled)
30203016
}

app/src/ui/lib/title-bar-style.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
* - macOS uses the native title bar
1515
* - Windows uses the custom title bar
1616
*/
17-
export type TitleBarStyle = 'native' | 'custom'
17+
export type TitleBarStyle = 'native' | 'custom' | 'native-without-menu-bar'

app/src/ui/preferences/advanced.tsx

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,11 @@ interface IAdvancedPreferencesProps {
1111
readonly useExternalCredentialHelper: boolean
1212
readonly repositoryIndicatorsEnabled: boolean
1313
readonly hideWindowOnQuit: boolean
14-
readonly autoHideMenuBar: boolean
1514
readonly onUseWindowsOpenSSHChanged: (checked: boolean) => void
1615
readonly onOptOutofReportingChanged: (checked: boolean) => void
1716
readonly onUseExternalCredentialHelperChanged: (checked: boolean) => void
1817
readonly onRepositoryIndicatorsEnabledChanged: (enabled: boolean) => void
1918
readonly onHideWindowOnQuitChanged: (enabled: boolean) => void
20-
readonly onAutoHideMenuBarChanged: (enabled: boolean) => void
2119
}
2220

2321
interface IAdvancedPreferencesState {
@@ -84,12 +82,6 @@ export class Advanced extends React.Component<
8482
this.props.onHideWindowOnQuitChanged(event.currentTarget.checked)
8583
}
8684

87-
private onAutoHideMenuBarChanged = (
88-
event: React.FormEvent<HTMLInputElement>
89-
) => {
90-
this.props.onAutoHideMenuBarChanged(event.currentTarget.checked)
91-
}
92-
9385
private reportDesktopUsageLabel() {
9486
return (
9587
<span>
@@ -101,7 +93,7 @@ export class Advanced extends React.Component<
10193

10294
public render() {
10395
return (
104-
<DialogContent className="advanced-tab">
96+
<DialogContent>
10597
{!__DARWIN__ && this.renderAppSettings()}
10698
<div className="advanced-section">
10799
<h2>Background updates</h2>
@@ -209,25 +201,6 @@ export class Advanced extends React.Component<
209201
background. Use Ctrl+Q to completely quit the app.
210202
</p>
211203
</div>
212-
{!__DARWIN__ && (
213-
<div style={{ marginTop: 'var(--spacing)' }}>
214-
<Checkbox
215-
label="Auto-hide menu bar"
216-
value={
217-
this.props.autoHideMenuBar
218-
? CheckboxValue.On
219-
: CheckboxValue.Off
220-
}
221-
onChange={this.onAutoHideMenuBarChanged}
222-
/>
223-
<div className="git-settings-description">
224-
<p>
225-
Hide the menu bar and show it temporarily when Alt is pressed.
226-
Takes effect after restarting the app.
227-
</p>
228-
</div>
229-
</div>
230-
)}
231204
</div>
232205
)
233206
}

app/src/ui/preferences/appearance.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ function getTitleBarStyleDescription(titleBarStyle: TitleBarStyle): string {
9292
return 'Uses the menu system provided by GitHub Desktop, hiding the default chrome provided by your window manager.'
9393
case 'native':
9494
return 'Uses the menu system and chrome provided by your window manager.'
95+
case 'native-without-menu-bar':
96+
return 'Uses the native window chrome, but hides the menu bar. Press Alt to show it temporarily. Takes effect after restarting the app.'
9597
}
9698
}
9799

@@ -343,6 +345,9 @@ export class Appearance extends React.Component<
343345
>
344346
<option value="native">Native</option>
345347
<option value="custom">Custom</option>
348+
<option value="native-without-menu-bar">
349+
Native without menu bar
350+
</option>
346351
</Select>
347352

348353
<div className="git-settings-description">

app/src/ui/preferences/preferences.tsx

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ interface IPreferencesProps {
131131
readonly showBranchNameInRepoList: ShowBranchNameInRepoListSetting
132132
readonly branchSortOrder: BranchSortOrder
133133
readonly hideWindowOnQuit: boolean
134-
readonly autoHideMenuBar: boolean
135134
readonly onEditGlobalGitConfig: () => void
136135
readonly underlineLinks: boolean
137136
readonly showDiffCheckMarks: boolean
@@ -194,7 +193,6 @@ interface IPreferencesState {
194193
readonly showBranchNameInRepoList: ShowBranchNameInRepoListSetting
195194
readonly branchSortOrder: BranchSortOrder
196195
readonly hideWindowOnQuit: boolean
197-
readonly autoHideMenuBar: boolean
198196

199197
readonly initiallySelectedTheme: ApplicationTheme
200198
readonly initiallySelectedTabSize: number
@@ -285,7 +283,6 @@ export class Preferences extends React.Component<
285283
showBranchNameInRepoList: this.props.showBranchNameInRepoList,
286284
branchSortOrder: this.props.branchSortOrder,
287285
hideWindowOnQuit: this.props.hideWindowOnQuit,
288-
autoHideMenuBar: this.props.autoHideMenuBar,
289286
initiallySelectedTheme: this.props.selectedTheme,
290287
initiallySelectedTabSize: this.props.selectedTabSize,
291288
initiallySelectedDiffFontSize: this.props.selectedDiffFontSize,
@@ -784,7 +781,6 @@ export class Preferences extends React.Component<
784781
useExternalCredentialHelper={this.state.useExternalCredentialHelper}
785782
repositoryIndicatorsEnabled={this.state.repositoryIndicatorsEnabled}
786783
hideWindowOnQuit={this.state.hideWindowOnQuit}
787-
autoHideMenuBar={this.state.autoHideMenuBar}
788784
onUseWindowsOpenSSHChanged={this.onUseWindowsOpenSSHChanged}
789785
onOptOutofReportingChanged={this.onOptOutofReportingChanged}
790786
onUseExternalCredentialHelperChanged={
@@ -794,7 +790,6 @@ export class Preferences extends React.Component<
794790
this.onRepositoryIndicatorsEnabledChanged
795791
}
796792
onHideWindowOnQuitChanged={this.onHideWindowOnQuitChanged}
797-
onAutoHideMenuBarChanged={this.onAutoHideMenuBarChanged}
798793
/>
799794
)
800795
break
@@ -834,10 +829,6 @@ export class Preferences extends React.Component<
834829
this.setState({ hideWindowOnQuit })
835830
}
836831

837-
private onAutoHideMenuBarChanged = (autoHideMenuBar: boolean) => {
838-
this.setState({ autoHideMenuBar })
839-
}
840-
841832
private onLockFileDeleted = () => {
842833
this.setState({ existingLockFilePath: undefined })
843834
}
@@ -1185,10 +1176,6 @@ export class Preferences extends React.Component<
11851176
dispatcher.setHideWindowOnQuit(this.state.hideWindowOnQuit)
11861177
}
11871178

1188-
if (this.state.autoHideMenuBar !== this.props.autoHideMenuBar) {
1189-
dispatcher.setAutoHideMenuBar(this.state.autoHideMenuBar)
1190-
}
1191-
11921179
if (this.state.hooksPreferencesDirty) {
11931180
if (this.state.enableGitHookEnv !== undefined) {
11941181
setHooksEnvEnabled(this.state.enableGitHookEnv)

0 commit comments

Comments
 (0)