diff --git a/README.md b/README.md index 1fa6e77d..86834834 100644 --- a/README.md +++ b/README.md @@ -191,6 +191,8 @@ input-scale = 1.0 title = "Satty" # experimental feature (0.21.0): set app_id, note this has to match D-Bus well-known name format, otherwise GTK does not accept it. app-id = "org.satty.satty" +# experimental feature (NEXTRELEASE): skip adwaita them variables in the default css. +skip-adwaita-vars = false # Tool selection keyboard shortcuts (since 0.20.0) [keybinds] @@ -327,6 +329,8 @@ Options: Experimental feature (0.21.0): Set window title --app-id Experimental feature (0.21.0): Set toplevel app_id. Note that this has to match D-Bus well known name format, otherwise GTK does not accept it + --skip-adwaita-vars + Experimental feature (NEXTRELEASE): do not use Adwaita CSS variables --right-click-copy Right click to copy. Preferably use the `action_on_right_click` option instead --action-on-enter diff --git a/cli/src/command_line.rs b/cli/src/command_line.rs index 65de45cf..d8b90aef 100644 --- a/cli/src/command_line.rs +++ b/cli/src/command_line.rs @@ -159,6 +159,10 @@ pub struct CommandLine { #[arg(long)] pub app_id: Option, + /// Experimental feature (NEXTRELEASE): do not use Adwaita CSS variables + #[arg(long)] + pub skip_adwaita_vars: bool, + // --- deprecated options --- /// Right click to copy. /// Preferably use the `action_on_right_click` option instead. diff --git a/config.toml b/config.toml index 25360c9d..4dd3e016 100644 --- a/config.toml +++ b/config.toml @@ -76,6 +76,8 @@ input-scale = 1.0 title = "Satty" # experimental feature (0.21.0): set app_id, note this has to match D-Bus well-known name format, otherwise GTK does not accept it. app-id = "org.satty.satty" +# experimental feature (NEXTRELEASE): skip adwaita them variables in the default css. +skip-adwaita-vars = false # Tool selection keyboard shortcuts (since 0.20.0) [keybinds] diff --git a/src/assets/default-adw.css b/src/assets/default-adw.css new file mode 100644 index 00000000..58acba39 --- /dev/null +++ b/src/assets/default-adw.css @@ -0,0 +1,12 @@ +.outer_box { + background-color: @headerbar_bg_color; +} + +.toolbar { + color: @headerbar_fg_color; + background-color: @headerbar_bg_color; +} + +button.editing { + color: @accent_color; +} diff --git a/src/assets/default.css b/src/assets/default.css index 8e6fe148..7f4d5941 100644 --- a/src/assets/default.css +++ b/src/assets/default.css @@ -3,18 +3,10 @@ min-height: 10rem; } -.outer_box { - background-color: @headerbar_bg_color; -} - .inner_box { background-color: #000000; } -.toolbar { - color: @headerbar_fg_color; - background-color: @headerbar_bg_color; -} .toast { color: #f9f9f9; background-color: #00000099; @@ -29,7 +21,3 @@ .overlay .toolbar-bottom { border-radius: 6px 6px 0px 0px; } .overlay .toolbar-top { border-radius: 0px 0px 6px 6px; } - -button.editing { - color: @accent_color; -} diff --git a/src/configuration.rs b/src/configuration.rs index 2f4ba9f6..4a1131c4 100644 --- a/src/configuration.rs +++ b/src/configuration.rs @@ -72,6 +72,7 @@ pub struct Configuration { input_scale: Option, title: Option, app_id: Option, + skip_adwaita_vars: bool, } pub struct Keybinds { @@ -423,6 +424,9 @@ impl Configuration { if let Some(v) = general.app_id { self.app_id = Some(v); } + if let Some(v) = general.skip_adwaita_vars { + self.skip_adwaita_vars = v; + } // --- deprecated options --- if let Some(v) = general.right_click_copy @@ -556,6 +560,9 @@ impl Configuration { if let Some(v) = command_line.app_id { self.app_id = Some(v); } + if command_line.skip_adwaita_vars { + self.skip_adwaita_vars = true + } // --- deprecated options --- if command_line.right_click_copy @@ -718,6 +725,10 @@ impl Configuration { pub fn app_id(&self) -> Option<&String> { self.app_id.as_ref() } + + pub fn skip_adwaita_vars(&self) -> bool { + self.skip_adwaita_vars + } } impl Default for Configuration { @@ -757,6 +768,7 @@ impl Default for Configuration { input_scale: None, title: None, app_id: None, + skip_adwaita_vars: false, } } } @@ -841,6 +853,7 @@ struct ConfigurationFileGeneral { input_scale: Option, title: Option, app_id: Option, + skip_adwaita_vars: Option, // --- deprecated options --- right_click_copy: Option, diff --git a/src/main.rs b/src/main.rs index f090093f..8c540f1a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -175,8 +175,16 @@ impl App { } fn apply_style() { + let default_css = include_str!("assets/default.css"); + let default_css_adw = include_str!("assets/default-adw.css"); + let default_css_with_adw = format!("{default_css}{default_css_adw}"); + let css_provider = CssProvider::new(); - css_provider.load_from_data(include_str!("assets/default.css")); + css_provider.load_from_data(if APP_CONFIG.read().skip_adwaita_vars() { + default_css + } else { + &default_css_with_adw + }); let css_provider_override = if let Some(overrides) = read_css_overrides() { let css_provider2 = CssProvider::new();