Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use the app menu bar for Linux instead of the default chrome #139

Merged
merged 1 commit into from
Apr 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/src/main-process/app-window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export class AppWindow {
} else if (__WIN32__) {
windowOptions.frame = false
} else if (__LINUX__) {
windowOptions.frame = false
windowOptions.icon = path.join(__dirname, 'static', 'icon-logo.png')
}

Expand Down
11 changes: 7 additions & 4 deletions app/src/ui/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -986,8 +986,8 @@ export class App extends React.Component<IAppProps, IAppState> {
* on Windows.
*/
private renderAppMenuBar() {
// We only render the app menu bar on Windows
if (!__WIN32__) {
// We render the app menu bar on Windows and Linux
if (__DARWIN__) {
return null
}

Expand Down Expand Up @@ -1046,13 +1046,16 @@ export class App extends React.Component<IAppProps, IAppState> {
// When we're in full-screen mode on Windows we only need to render
// the title bar when the menu bar is active. On other platforms we
// never render the title bar while in full-screen mode.

const appMenuPlatform = __WIN32__ || __LINUX__

if (inFullScreen) {
if (!__WIN32__ || !menuBarActive) {
if (!appMenuPlatform || !menuBarActive) {
return null
}
}

const showAppIcon = __WIN32__ && !this.state.showWelcomeFlow
const showAppIcon = appMenuPlatform && !this.state.showWelcomeFlow

return (
<TitleBar
Expand Down
5 changes: 4 additions & 1 deletion app/src/ui/window/title-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,11 @@ export class TitleBar extends React.Component<ITitleBarProps, ITitleBarState> {
const inFullScreen = this.props.windowState === 'full-screen'
const isMaximized = this.props.windowState === 'maximized'

const appMenuPlatform = __WIN32__ || __LINUX__

// No Windows controls when we're in full-screen mode.
const winControls = __WIN32__ && !inFullScreen ? <WindowControls /> : null
const winControls =
appMenuPlatform && !inFullScreen ? <WindowControls /> : null

// On Windows it's not possible to resize a frameless window if the
// element that sits flush along the window edge has -webkit-app-region: drag.
Expand Down
4 changes: 2 additions & 2 deletions app/src/ui/window/window-controls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ export class WindowControls extends React.Component<{}, IWindowControlState> {
}

public render() {
// We only know how to render fake Windows-y controls
if (!__WIN32__) {
// render the faux window controls for Windows and Linux builds
if (!__DARWIN__) {
return <span />
}

Expand Down
22 changes: 22 additions & 0 deletions app/styles/mixins/_platform.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,25 @@
@content;
}
}

// A mixin which takes a content block that should only
// be applied when the current (real or emulated) operating
// system is Linux.
//
// This helper mixin is useful in so far that it allows us
// to keep platform specific styles next to cross-platform
// styles instead of splitting them out and possibly forgetting
// about them.
@mixin linux {
body.platform-linux & {
@content;
}
}

// An exact copy of the linux mixin except that it allows for
// writing base-level rules
@mixin linux-context {
body.platform-linux {
@content;
}
}
12 changes: 12 additions & 0 deletions app/styles/ui/window/_title-bar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@
}
}

@include linux {
height: var(--win32-title-bar-height);
background: var(--win32-title-bar-background-color);
border-bottom: 1px solid #000;

.app-icon {
color: var(--toolbar-button-secondary-color);
margin: 0 var(--spacing);
align-self: center;
}
}

.resize-handle {
position: absolute;
top: 0px;
Expand Down