Compare commits

..

3 commits
v0.2.4 ... main

Author SHA1 Message Date
Breadway
7ece4fd762 CI: use /tmp for ecosystem clone, avoid permissions conflict
All checks were successful
Mirror to GitHub / mirror (push) Successful in 2s
2026-06-19 08:38:38 +08:00
Breadway
a33e979e5e Bump bread-theme to v0.2.8 (live-reload fix)
Some checks failed
Mirror to GitHub / mirror (push) Successful in 2s
Build and publish package / package (push) Failing after 2m39s
2026-06-17 12:55:52 +08:00
Breadway
83b9fd908e Fix illegible text on light pywal palettes + hot-reload
Use bread-theme 0.2.7's luminance-picked ink (@on-*): a selected/hovered row set
its background to `surface` but kept the pywal foreground, so the highlighted
item went unreadable when `surface` came out light. Colour is now set per surface
(panel, search box, row states) and labels inherit it.

Switch to bread_theme::gtk::apply_app_css so breadbox picks up `bread-theme
reload` (and rebuilds from the fresh palette on each launch).
2026-06-17 12:41:30 +08:00
4 changed files with 26 additions and 35 deletions

View file

@ -9,7 +9,7 @@ permissions:
env:
DL_DIR: /srv/breadway-dl
ECOSYSTEM_DIR: /home/breadway/Projects/bread-ecosystem
ECOSYSTEM_DIR: /tmp/bread-ecosystem-ci
jobs:
build:
@ -41,12 +41,8 @@ jobs:
- name: ensure bread-ecosystem
run: |
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
rm -rf "${ECOSYSTEM_DIR}"
git clone https://github.com/Breadway/bread-ecosystem.git "${ECOSYSTEM_DIR}"
- name: regenerate index.json
run: bash "${ECOSYSTEM_DIR}/scripts/gen-index.sh"

2
Cargo.lock generated
View file

@ -29,7 +29,7 @@ checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8"
[[package]]
name = "bread-theme"
version = "0.2.3"
source = "git+https://github.com/Breadway/bread-ecosystem?tag=v0.2.6#0c8c5c00e435fedff4f81e36d603424c153519a9"
source = "git+https://github.com/Breadway/bread-ecosystem?tag=v0.2.8#77417d552130281ff787e07d52541eb25e9d533b"
dependencies = [
"dirs",
"gtk4",

View file

@ -9,7 +9,7 @@ name = "breadbox"
path = "src/main.rs"
[dependencies]
bread-theme = { git = "https://github.com/Breadway/bread-ecosystem", tag = "v0.2.6", features = ["gtk"] }
bread-theme = { git = "https://github.com/Breadway/bread-ecosystem", tag = "v0.2.8", features = ["gtk"] }
breadbox-shared = { path = "../breadbox-shared" }
gtk4 = { version = "0.11", features = ["v4_12"] }
gtk4-layer-shell = "0.8"

View file

@ -1,4 +1,4 @@
use bread_theme::{hex_to_rgba, load_palette, Palette};
use bread_theme::{hex_to_rgba, ink_on, load_palette, Palette};
use std::{
cell::RefCell,
collections::HashMap,
@ -15,7 +15,6 @@ use breadbox_shared::{
config_dir, load_all_desktop_entries, Config, DesktopEntry, IconCache, LaunchHistory,
};
use gtk4::{
gdk::Display,
glib,
pango::EllipsizeMode,
prelude::*,
@ -135,25 +134,30 @@ fn build_css(p: &Palette) -> String {
let bg_panel = hex_to_rgba(&p.background, 0.60);
// breadbox-specific rules only — fonts, palette, and generic widgets come
// from the shared ecosystem stylesheet (applied first in connect_activate).
// Colour is set on each surface (panel, search box, hovered/selected row) so
// child labels inherit the legible ink for that background. `on_*` are
// luminance-picked black/white — the pywal hues are untouched. Without this a
// light `surface` slot makes the selected row's text vanish.
format!(
"window {{ background-color: transparent; }}\
.launcher-bg {{ background-color: {bg_panel}; border-radius: 8px;\
.launcher-bg {{ background-color: {bg_panel}; color: {on_bg}; border-radius: 8px;\
box-shadow: 0 8px 32px rgba(0,0,0,0.6); }}\
searchentry {{ background-color: {surface}; color: {fg}; caret-color: {accent};\
searchentry {{ background-color: {surface}; color: {on_surface}; caret-color: {accent};\
border: none; outline: none; box-shadow: none;\
padding: 12px 16px; border-radius: 6px 6px 0 0; }}\
listbox {{ background-color: transparent; padding: 4px; }}\
row {{ padding: 8px 12px; color: {fg}; background-color: transparent;\
row {{ padding: 8px 12px; color: {on_bg}; background-color: transparent;\
border-radius: 6px; }}\
row:hover {{ background-color: {surface}; }}\
row:selected {{ background-color: {surface}; }}\
row:hover {{ background-color: {surface}; color: {on_surface}; }}\
row:selected {{ background-color: {surface}; color: {on_surface}; }}\
.app-name {{ font-size: 14px; }}\
.app-muted {{ color: {fg}; opacity: 0.6; font-size: 12px; }}\
.app-muted {{ opacity: 0.6; font-size: 12px; }}\
image {{ margin-right: 8px; }}",
bg_panel = bg_panel,
surface = p.color0,
fg = p.foreground,
accent = p.color4,
bg_panel = bg_panel,
surface = p.color0,
accent = p.color4,
on_bg = ink_on(&p.background),
on_surface = ink_on(&p.color0),
)
}
@ -291,7 +295,7 @@ fn get_row_entry(row: &gtk4::ListBoxRow) -> Option<DesktopEntry> {
}
}
fn run_ui(entries: Vec<DesktopEntry>, css: String, history: LaunchHistory) {
fn run_ui(entries: Vec<DesktopEntry>, history: LaunchHistory) {
let app = Application::builder()
.application_id("com.breadway.breadbox")
.build();
@ -301,16 +305,10 @@ fn run_ui(entries: Vec<DesktopEntry>, css: String, history: LaunchHistory) {
app.connect_activate(move |app| {
// Shared ecosystem base (fonts, palette, generic widgets) first, then
// breadbox-specific CSS layered on top at APPLICATION priority.
// breadbox-specific CSS layered on top — both hot-reload on
// `bread-theme reload` (the closure re-reads the pywal palette).
bread_theme::gtk::apply_shared();
let provider = CssProvider::new();
provider.load_from_string(&css);
gtk4::style_context_add_provider_for_display(
&Display::default().expect("no display"),
&provider,
gtk4::STYLE_PROVIDER_PRIORITY_APPLICATION,
);
bread_theme::gtk::apply_app_css(|| build_css(&load_palette()));
// User CSS override
{
@ -566,8 +564,5 @@ fn main() {
let manifest = load_manifest();
let entries = load_sorted_entries(&manifest, &priority, &history);
let palette = load_palette();
let css = build_css(&palette);
run_ui(entries, css, history);
run_ui(entries, history);
}