linux: Add "dark-theme" option for BrowserWindow, fixes #352.

This commit is contained in:
Cheng Zhao 2014-08-21 12:24:55 +08:00
parent a32669ac0d
commit 058d0bbe19
4 changed files with 19 additions and 0 deletions

View file

@ -150,6 +150,19 @@ NativeWindowViews::NativeWindowViews(content::WebContents* web_contents,
window_->Init(params);
#if defined(USE_X11)
bool use_dark_theme = false;
if (options.Get(switches::kDarkTheme, &use_dark_theme) && use_dark_theme) {
XDisplay* xdisplay = gfx::GetXDisplay();
XChangeProperty(xdisplay, GetAcceleratedWidget(),
XInternAtom(xdisplay, "_GTK_THEME_VARIANT", False),
XInternAtom(xdisplay, "UTF8_STRING", False),
8, PropModeReplace,
reinterpret_cast<const unsigned char*>("dark"),
4);
}
#endif
// Add web view.
SetLayoutManager(new MenuLayout(kMenuBarHeight));
set_background(views::Background::CreateStandardPanelBackground());

View file

@ -54,6 +54,9 @@ const char kAutoHideMenuBar[] = "auto-hide-menu-bar";
// Enable window to be resized larger than screen.
const char kEnableLargerThanScreen[] = "enable-larger-than-screen";
// Forces to use dark theme on Linux.
const char kDarkTheme[] = "dark-theme";
} // namespace switches
} // namespace atom

View file

@ -34,6 +34,7 @@ extern const char kWebPreferences[];
extern const char kZoomFactor[];
extern const char kAutoHideMenuBar[];
extern const char kEnableLargerThanScreen[];
extern const char kDarkTheme[];
} // namespace switches

View file

@ -63,6 +63,8 @@ normal browsers, see [Web Security](web-security.md) for more.
key is pressed.
* `enable-larger-than-screen` Boolean - Enable the window to be resized larger
than screen.
* `dark-theme` Boolean - Forces using dark theme for the window, only works on
some GTK+3 desktop environments.
* `web-preferences` Object - Settings of web page's features
* `javascript` Boolean
* `web-security` Boolean