summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Mischka <jacob@mischka.me>2020-08-05 14:41:32 -0500
committerVille Hakulinen <ville.hakulinen@gmail.com>2020-08-12 21:08:55 +0300
commit336edb667b4235b5b7bbbf39de166c6a2e3fd0ce (patch)
tree5cac8612b3de34482d134e058814de33c1c4aa87
parent7c8108121a68ab8519e5c917a189e5db8919675d (diff)
Add flag to prefer dark theme
-rw-r--r--src/main.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index cc041e9..a233996 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -94,6 +94,10 @@ struct Options {
#[structopt(long = "disable-ext-tabline")]
disable_ext_tabline: bool,
+ /// Enables dark theme
+ #[structopt(long = "prefer-dark-theme")]
+ prefer_dark_theme: bool,
+
/// Geometry of the window in widthxheight form
#[structopt(long = "geometry", parse(try_from_str = parse_geometry), default_value = "1280x720")]
geometry: (i32, i32),
@@ -223,6 +227,14 @@ fn main() {
glib::set_application_name("GNvim");
gtk::Window::set_default_icon_name("gnvim");
+ if opts.prefer_dark_theme {
+ if let Some(settings) = gtk::Settings::get_default() {
+ if let Err(err) = settings.set_property("gtk-application-prefer-dark-theme", &true.to_value()) {
+ error!("Failed to set dark theme setting: {}", err);
+ }
+ }
+ }
+
app.connect_activate(move |app| {
let opts = &opts;
let c = glib::MainContext::default();