linux: Add "dark-theme" option for BrowserWindow, fixes #352.
This commit is contained in:
parent
a32669ac0d
commit
058d0bbe19
4 changed files with 19 additions and 0 deletions
|
@ -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());
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue