Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
- Custom titlebar is now toggle-able (requires restart)
Browse files Browse the repository at this point in the history
- Fixed issue where menu text could be selected
  • Loading branch information
bsclifton committed Sep 13, 2016
1 parent 55ae038 commit d1d1e6c
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions app/extensions/brave/locales/en-US/preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ flashAllowAlways=Allow until {{time}}
alwaysAllow=Always allow
alwaysDeny=Always deny
appearanceSettings=Appearance Settings
disableCustomTitlebar=Disable custom titlebar (requires browser restart)
autoHideMenuBar=Hide the menu bar by default
disableTitleMode=Always show the URL bar
tabsSettings=Tabs Settings
Expand Down
1 change: 1 addition & 0 deletions app/locale.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ var rendererIdentifiers = function () {
'lookupSelection',
// Other identifiers
'urlCopied',
'disableCustomTitlebar',
'autoHideMenuBar',
'unexpectedErrorWindowReload',
'updateChannel',
Expand Down
6 changes: 5 additions & 1 deletion js/about/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,9 @@ class GeneralTab extends ImmutableComponent {
<div className='sectionTitle' data-l10n-id='appearanceSettings' />
<SettingsList>
<SettingCheckbox dataL10nId='showHomeButton' prefKey={settings.SHOW_HOME_BUTTON} settings={this.props.settings} onChangeSetting={this.props.onChangeSetting} />
{
isWindows ? <SettingCheckbox dataL10nId='disableCustomTitlebar' prefKey={settings.DISABLE_CUSTOM_TITLEBAR} settings={this.props.settings} onChangeSetting={this.props.onChangeSetting} /> : null
}
{
isDarwin ? null : <SettingCheckbox dataL10nId='autoHideMenuBar' prefKey={settings.AUTO_HIDE_MENU} settings={this.props.settings} onChangeSetting={this.props.onChangeSetting} />
}
Expand Down Expand Up @@ -1337,7 +1340,8 @@ class AboutPreferences extends React.Component {
})
aboutActions.changeSetting(key, value)
if (key === settings.DO_NOT_TRACK || key === settings.HARDWARE_ACCELERATION_ENABLED ||
key === settings.PDFJS_ENABLED || key === settings.SMOOTH_SCROLL_ENABLED) {
key === settings.PDFJS_ENABLED || key === settings.SMOOTH_SCROLL_ENABLED ||
key === settings.DISABLE_CUSTOM_TITLEBAR) {
ipc.send(messages.PREFS_RESTART, key, value)
}
if (key === settings.PAYMENTS_ENABLED) {
Expand Down
6 changes: 3 additions & 3 deletions js/components/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -749,8 +749,8 @@ class Main extends ImmutableComponent {
const braverySettings = siteSettings.activeSettings(activeSiteSettings, this.props.appState, appConfig)
const loginRequiredDetail = activeFrame ? basicAuthState.getLoginRequiredDetail(this.props.appState, activeFrame.get('tabId')) : null

const menubarEnabled = isWindows
const menubarVisible = menubarEnabled && (!getSetting(settings.AUTO_HIDE_MENU) || this.props.windowState.getIn(['ui', 'menubar', 'isVisible']))
const customTitlebarEnabled = isWindows && !getSetting(settings.DISABLE_CUSTOM_TITLEBAR)
const menubarVisible = customTitlebarEnabled && (!getSetting(settings.AUTO_HIDE_MENU) || this.props.windowState.getIn(['ui', 'menubar', 'isVisible']))
const menubarTemplate = menubarVisible ? this.props.appState.getIn(['menu', 'template']) : null
const menubarSelectedLabel = this.props.windowState.getIn(['ui', 'menubar', 'selectedLabel'])

Expand Down Expand Up @@ -856,7 +856,7 @@ class Main extends ImmutableComponent {
</div>
</div>
{
menubarEnabled
customTitlebarEnabled
? <WindowCaptionButtons windowMaximized={this.props.windowState.getIn(['ui', 'isMaximized'])} />
: null
}
Expand Down
1 change: 1 addition & 0 deletions js/constants/appConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ module.exports = {
'general.show-home-button': false,
'general.useragent.value': null, // Set at runtime
'general.autohide-menu': true,
'general.disable-custom-titlebar': false,
'search.default-search-engine': 'Google',
'search.offer-search-suggestions': false, // false by default for privacy reasons
'tabs.switch-to-new-tabs': false,
Expand Down
1 change: 1 addition & 0 deletions js/constants/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const settings = {
DEFAULT_DOWNLOAD_SAVE_PATH: 'general.downloads.default-save-path',
AUTO_HIDE_MENU: 'general.autohide-menu',
DISABLE_TITLE_MODE: 'general.disable-title-mode',
DISABLE_CUSTOM_TITLEBAR: 'general.disable-custom-titlebar',
// Search tab
DEFAULT_SEARCH_ENGINE: 'search.default-search-engine',
OFFER_SEARCH_SUGGESTIONS: 'search.offer-search-suggestions',
Expand Down
3 changes: 2 additions & 1 deletion js/stores/appStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ const createWindow = (browserOpts, defaults, frameOpts, windowState) => {
browserOpts.height = browserOpts.height < minHeight ? minHeight : browserOpts.height

const autoHideMenuBarSetting = isDarwin || getSetting(settings.AUTO_HIDE_MENU)
const isCustomTitlebarDisabled = !isWindows || getSetting(settings.DISABLE_CUSTOM_TITLEBAR)

const windowProps = {
// smaller min size for "modal" windows
Expand All @@ -138,7 +139,7 @@ const createWindow = (browserOpts, defaults, frameOpts, windowState) => {
autoHideMenuBar: autoHideMenuBarSetting,
title: appConfig.name,
webPreferences: defaults.webPreferences,
frame: !isWindows
frame: isCustomTitlebarDisabled
}

if (process.platform === 'linux') {
Expand Down
1 change: 1 addition & 0 deletions less/navigationBar.less
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@
.menubar {
display: inline-block;
cursor: default;
-webkit-user-select: none;

.menubarItem {
color: black;
Expand Down

0 comments on commit d1d1e6c

Please sign in to comment.