Skip to content
Draft
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -327,6 +329,8 @@ Options:
Experimental feature (0.21.0): Set window title
--app-id <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 <ACTION_ON_ENTER>
Expand Down
4 changes: 4 additions & 0 deletions cli/src/command_line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ pub struct CommandLine {
#[arg(long)]
pub app_id: Option<String>,

/// 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.
Expand Down
2 changes: 2 additions & 0 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
12 changes: 12 additions & 0 deletions src/assets/default-adw.css
Original file line number Diff line number Diff line change
@@ -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;
}
12 changes: 0 additions & 12 deletions src/assets/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
13 changes: 13 additions & 0 deletions src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pub struct Configuration {
input_scale: Option<f32>,
title: Option<String>,
app_id: Option<String>,
skip_adwaita_vars: bool,
}

pub struct Keybinds {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -757,6 +768,7 @@ impl Default for Configuration {
input_scale: None,
title: None,
app_id: None,
skip_adwaita_vars: false,
}
}
}
Expand Down Expand Up @@ -841,6 +853,7 @@ struct ConfigurationFileGeneral {
input_scale: Option<f32>,
title: Option<String>,
app_id: Option<String>,
skip_adwaita_vars: Option<bool>,

// --- deprecated options ---
right_click_copy: Option<bool>,
Expand Down
10 changes: 9 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Loading