Compare commits

..

No commits in common. "main" and "v0.3.4" have entirely different histories.
main ... v0.3.4

6 changed files with 46 additions and 30 deletions

View file

@ -9,7 +9,7 @@ permissions:
env:
DL_DIR: /srv/breadway-dl
ECOSYSTEM_DIR: /tmp/bread-ecosystem-ci
ECOSYSTEM_DIR: /home/breadway/Projects/bread-ecosystem
jobs:
build:
@ -40,8 +40,12 @@ jobs:
- name: ensure bread-ecosystem
run: |
rm -rf "${ECOSYSTEM_DIR}"
git clone https://github.com/Breadway/bread-ecosystem.git "${ECOSYSTEM_DIR}"
if [[ -d "${ECOSYSTEM_DIR}/.git" ]]; then
git -C "${ECOSYSTEM_DIR}" pull --ff-only
else
mkdir -p "$(dirname "${ECOSYSTEM_DIR}")"
git clone https://github.com/Breadway/bread-ecosystem.git "${ECOSYSTEM_DIR}"
fi
- name: regenerate index.json
run: bash "${ECOSYSTEM_DIR}/scripts/gen-index.sh"

3
Cargo.lock generated
View file

@ -305,10 +305,9 @@ dependencies = [
[[package]]
name = "bread-theme"
version = "0.2.3"
source = "git+https://github.com/Breadway/bread-ecosystem?tag=v0.2.8#77417d552130281ff787e07d52541eb25e9d533b"
source = "git+https://github.com/Breadway/bread-ecosystem?tag=v0.2.6#0c8c5c00e435fedff4f81e36d603424c153519a9"
dependencies = [
"dirs 5.0.1",
"gtk4",
"serde",
"serde_json",
]

View file

@ -4,6 +4,7 @@ use breadpad_shared::{
parser::parse_rule_based,
scheduler::Scheduler,
store::Store,
theme::{build_css, load_palette},
types::{Note, NoteType, RecurrenceRule},
};
use chrono::Local;
@ -923,7 +924,19 @@ fn show_add_note_window(parent: &gtk4::ApplicationWindow, state: AppState) {
// ── CSS ───────────────────────────────────────────────────────────────────────
fn apply_css(_cfg: &Config) {
// Hot-reloads on `bread-theme reload` (recolours to the new pywal palette
// and re-reads the user's style.css). See breadpad_shared::theme::apply_live.
breadpad_shared::theme::apply_live();
let palette = load_palette();
let user_css = std::fs::read_to_string(breadpad_shared::config::style_css_path()).ok();
let css = build_css(&palette, user_css.as_deref());
let provider = gtk4::CssProvider::new();
provider.load_from_string(&css);
let Some(display) = gtk4::gdk::Display::default() else {
tracing::warn!("no default display; skipping CSS provider");
return;
};
gtk4::style_context_add_provider_for_display(
&display,
&provider,
gtk4::STYLE_PROVIDER_PRIORITY_APPLICATION,
);
}

View file

@ -7,7 +7,7 @@ authors.workspace = true
[dependencies]
bread-theme = { git = "https://github.com/Breadway/bread-ecosystem", tag = "v0.2.8", features = ["gtk"] }
bread-theme = { git = "https://github.com/Breadway/bread-ecosystem", tag = "v0.2.6" }
anyhow.workspace = true
tracing.workspace = true
serde.workspace = true

View file

@ -1,18 +1,5 @@
pub use bread_theme::{load_palette, Palette};
/// Apply breadpad/breadman's stylesheet and keep it live across palette changes.
/// [`build_css`] bundles the shared component sheet with the app's own rules from
/// the current pywal palette; `bread_theme::gtk::apply_app_css` re-runs this
/// whenever `bread-theme reload` rewrites the shared theme file, so the UI
/// recolours in place (and re-reads the user's `style.css` override too).
pub fn apply_live() {
bread_theme::gtk::apply_app_css(|| {
let palette = load_palette();
let user_css = std::fs::read_to_string(crate::config::style_css_path()).ok();
build_css(&palette, user_css.as_deref())
});
}
/// Generate the full breadpad/breadman CSS string. The base — `@define-color`
/// palette, fonts, and generic widget styling — comes from the shared
/// `bread_theme::stylesheet`, so breadpad and breadman look identical to the
@ -45,7 +32,7 @@ window { border-radius: 8px; }
.type-chip {
background: @overlay;
color: @on-overlay;
color: @fg;
border-radius: 999px;
padding: 4px 12px;
font-size: 12px;
@ -54,12 +41,12 @@ window { border-radius: 8px; }
.type-chip.active {
background: @blue;
color: @on-accent;
color: @bg;
}
.confirm-button {
background: @blue;
color: @on-accent;
color: @bg;
border: none;
border-radius: 8px;
padding: 8px 16px;
@ -103,7 +90,7 @@ window { border-radius: 8px; }
.sidebar-row:selected {
background: @blue;
color: @on-accent;
color: @bg;
font-weight: 500;
}

View file

@ -2,9 +2,10 @@ use anyhow::Result;
use breadpad_shared::{
calendar::CalDavClient,
classifier::Classifier,
config::Config,
config::{style_css_path, Config},
scheduler::Scheduler,
store::Store,
theme::{build_css, load_palette},
types::{Note, NoteType},
};
use gtk4::{glib, prelude::*};
@ -764,7 +765,19 @@ fn save_note_classified(
}
fn apply_css(_cfg: &Config) {
// Hot-reloads on `bread-theme reload` (recolours to the new pywal palette
// and re-reads the user's style.css). See breadpad_shared::theme::apply_live.
breadpad_shared::theme::apply_live();
let palette = load_palette();
let user_css = std::fs::read_to_string(style_css_path()).ok();
let css = build_css(&palette, user_css.as_deref());
let provider = gtk4::CssProvider::new();
provider.load_from_string(&css);
let Some(display) = gtk4::gdk::Display::default() else {
tracing::warn!("no default display; skipping CSS provider");
return;
};
gtk4::style_context_add_provider_for_display(
&display,
&provider,
gtk4::STYLE_PROVIDER_PRIORITY_APPLICATION,
);
}