Compare commits
3 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eaf3fdc93f | ||
|
|
6385a080f1 | ||
|
|
7ece4fd762 |
9 changed files with 123 additions and 91 deletions
|
|
@ -14,8 +14,6 @@ jobs:
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
git clone --mirror "https://git.breadway.dev/${GITHUB_REPOSITORY}.git" repo.git
|
git clone --mirror "https://git.breadway.dev/${GITHUB_REPOSITORY}.git" repo.git
|
||||||
cd repo.git
|
cd repo.git
|
||||||
# Mirror only branches and tags (not refs/pull/*, which GitHub rejects);
|
|
||||||
# --prune deletes GitHub refs that no longer exist on Forgejo.
|
|
||||||
git push --prune \
|
git push --prune \
|
||||||
"https://x-access-token:${{ secrets.MIRROR_TOKEN }}@github.com/Breadway/breadbox.git" \
|
"https://x-access-token:${{ secrets.MIRROR_TOKEN }}@github.com/Breadway/breadbox.git" \
|
||||||
'+refs/heads/*:refs/heads/*' '+refs/tags/*:refs/tags/*'
|
'+refs/heads/*:refs/heads/*' '+refs/tags/*:refs/tags/*'
|
||||||
|
|
|
||||||
59
.forgejo/workflows/release.yml
Normal file
59
.forgejo/workflows/release.yml
Normal file
|
|
@ -0,0 +1,59 @@
|
||||||
|
name: release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags: ["v*"]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: [self-hosted, hestia]
|
||||||
|
steps:
|
||||||
|
- name: checkout
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
rm -rf src && mkdir src
|
||||||
|
git clone --branch "${GITHUB_REF_NAME}" --depth 1 \
|
||||||
|
"https://git.breadway.dev/${GITHUB_REPOSITORY}.git" src
|
||||||
|
|
||||||
|
- name: build
|
||||||
|
run: cd src && cargo build --release --locked
|
||||||
|
|
||||||
|
- name: prepare artifacts
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
VERSION="${GITHUB_REF_NAME#v}"
|
||||||
|
PKG_DIR="/srv/breadway-dl/breadbox/${VERSION}"
|
||||||
|
mkdir -p "${PKG_DIR}"
|
||||||
|
for bin in breadbox breadbox-sync; do
|
||||||
|
cp "src/target/release/${bin}" "${PKG_DIR}/${bin}-x86_64"
|
||||||
|
strip "${PKG_DIR}/${bin}-x86_64"
|
||||||
|
sha256sum "${PKG_DIR}/${bin}-x86_64" | awk '{print $1}' \
|
||||||
|
> "${PKG_DIR}/${bin}-x86_64.sha256"
|
||||||
|
done
|
||||||
|
cp src/packaging/breadbox-sync.service "${PKG_DIR}/"
|
||||||
|
cp src/config.example.toml "${PKG_DIR}/"
|
||||||
|
cp src/bakery.toml "${PKG_DIR}/bakery.toml"
|
||||||
|
ln -sfn "${VERSION}" "/srv/breadway-dl/breadbox/latest"
|
||||||
|
|
||||||
|
- name: regenerate index.json
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
rm -rf /tmp/bread-ecosystem-ci
|
||||||
|
git clone https://git.breadway.dev/Breadway/bread-ecosystem.git /tmp/bread-ecosystem-ci
|
||||||
|
bash /tmp/bread-ecosystem-ci/scripts/gen-index.sh
|
||||||
|
|
||||||
|
- name: upload to GitHub Release
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
VERSION="${GITHUB_REF_NAME#v}"
|
||||||
|
PKG_DIR="/srv/breadway-dl/breadbox/${VERSION}"
|
||||||
|
gh release create "${GITHUB_REF_NAME}" --repo Breadway/breadbox \
|
||||||
|
--title "breadbox v${VERSION}" --generate-notes 2>/dev/null || true
|
||||||
|
gh release upload "${GITHUB_REF_NAME}" --repo Breadway/breadbox \
|
||||||
|
"${PKG_DIR}/breadbox-x86_64" \
|
||||||
|
"${PKG_DIR}/breadbox-sync-x86_64" \
|
||||||
|
"${PKG_DIR}/breadbox-x86_64.sha256" \
|
||||||
|
"${PKG_DIR}/breadbox-sync-x86_64.sha256" \
|
||||||
|
--clobber
|
||||||
67
.github/workflows/release.yml
vendored
67
.github/workflows/release.yml
vendored
|
|
@ -1,67 +0,0 @@
|
||||||
name: release
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags: ["v*"]
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
env:
|
|
||||||
DL_DIR: /srv/breadway-dl
|
|
||||||
ECOSYSTEM_DIR: /home/breadway/Projects/bread-ecosystem
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: [self-hosted, hestia]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: install build deps
|
|
||||||
run: sudo apt-get install -y libgtk-4-dev librsvg2-dev libdbus-1-dev pkg-config 2>/dev/null || true
|
|
||||||
|
|
||||||
- name: build
|
|
||||||
run: cargo build --release --locked
|
|
||||||
|
|
||||||
- name: prepare artifacts
|
|
||||||
run: |
|
|
||||||
VERSION="${GITHUB_REF_NAME#v}"
|
|
||||||
PKG_DIR="${DL_DIR}/breadbox/${VERSION}"
|
|
||||||
mkdir -p "${PKG_DIR}"
|
|
||||||
for bin in breadbox breadbox-sync; do
|
|
||||||
cp "target/release/${bin}" "${PKG_DIR}/${bin}-x86_64"
|
|
||||||
strip "${PKG_DIR}/${bin}-x86_64"
|
|
||||||
sha256sum "${PKG_DIR}/${bin}-x86_64" | awk '{print $1}' \
|
|
||||||
> "${PKG_DIR}/${bin}-x86_64.sha256"
|
|
||||||
done
|
|
||||||
cp packaging/breadbox-sync.service "${PKG_DIR}/"
|
|
||||||
cp config.example.toml "${PKG_DIR}/"
|
|
||||||
cp bakery.toml "${PKG_DIR}/bakery.toml"
|
|
||||||
ln -sfn "${VERSION}" "${DL_DIR}/breadbox/latest"
|
|
||||||
|
|
||||||
- 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
|
|
||||||
|
|
||||||
- name: regenerate index.json
|
|
||||||
run: bash "${ECOSYSTEM_DIR}/scripts/gen-index.sh"
|
|
||||||
|
|
||||||
- name: upload to GitHub Release
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run: |
|
|
||||||
VERSION="${GITHUB_REF_NAME#v}"
|
|
||||||
PKG_DIR="${DL_DIR}/breadbox/${VERSION}"
|
|
||||||
gh release create "${GITHUB_REF_NAME}" \
|
|
||||||
--title "breadbox v${VERSION}" --generate-notes 2>/dev/null || true
|
|
||||||
gh release upload "${GITHUB_REF_NAME}" \
|
|
||||||
"${PKG_DIR}/breadbox-x86_64" \
|
|
||||||
"${PKG_DIR}/breadbox-sync-x86_64" \
|
|
||||||
"${PKG_DIR}/breadbox-x86_64.sha256" \
|
|
||||||
"${PKG_DIR}/breadbox-sync-x86_64.sha256" \
|
|
||||||
--clobber
|
|
||||||
6
Cargo.lock
generated
6
Cargo.lock
generated
|
|
@ -39,7 +39,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "breadbox"
|
name = "breadbox"
|
||||||
version = "0.2.4"
|
version = "0.2.6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bread-theme",
|
"bread-theme",
|
||||||
"breadbox-shared",
|
"breadbox-shared",
|
||||||
|
|
@ -50,7 +50,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "breadbox-shared"
|
name = "breadbox-shared"
|
||||||
version = "0.2.4"
|
version = "0.2.6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
|
@ -59,7 +59,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "breadbox-sync"
|
name = "breadbox-sync"
|
||||||
version = "0.2.4"
|
version = "0.2.6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"breadbox-shared",
|
"breadbox-shared",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
|
|
||||||
10
README.md
10
README.md
|
|
@ -12,7 +12,8 @@ breadbox GTK4 layer-shell launcher
|
||||||
|
|
||||||
- Layer-shell window, centered 600 px wide, keyboard-exclusive
|
- Layer-shell window, centered 600 px wide, keyboard-exclusive
|
||||||
- Reads the active Hyprland workspace and sorts apps by context priority
|
- Reads the active Hyprland workspace and sorts apps by context priority
|
||||||
- Fuzzy filtering as you type; Enter launches, Escape closes
|
- Launch history: non-priority apps sort by most-launched first, then alphabetically
|
||||||
|
- Fuzzy filtering as you type; Enter or click to launch, Escape or click outside to close
|
||||||
- App icons loaded from the resolved icon cache (see `breadbox-sync`)
|
- App icons loaded from the resolved icon cache (see `breadbox-sync`)
|
||||||
- pywal palette auto-detected from `~/.cache/wal/colors.json`, falls back to Catppuccin Mocha
|
- pywal palette auto-detected from `~/.cache/wal/colors.json`, falls back to Catppuccin Mocha
|
||||||
- User CSS override at `~/.config/breadbox/style.css`
|
- User CSS override at `~/.config/breadbox/style.css`
|
||||||
|
|
@ -88,10 +89,9 @@ breadbox-sync
|
||||||
```
|
```
|
||||||
|
|
||||||
Icon resolution order:
|
Icon resolution order:
|
||||||
1. System icon theme (`~/.local/share/icons`, `/usr/share/icons`, `/usr/share/pixmaps`) — 64 px > 48 px PNG, then SVG
|
1. System icon theme (`~/.local/share/icons`, `/usr/share/icons`, `/usr/share/pixmaps`) — 64 px > 48 px > 128 px > 32 px > 256 px PNG, then SVG
|
||||||
2. Flathub media server — for reverse-DNS app IDs (e.g. `org.gnome.Gedit`)
|
2. Flathub appstream CDN — for reverse-DNS app IDs (e.g. `org.gnome.Gedit`)
|
||||||
3. icon.horse — downloaded and cached
|
3. `application-x-executable` fallback from system theme
|
||||||
4. `application-x-executable` fallback from system theme
|
|
||||||
|
|
||||||
### Systemd service (run on login)
|
### Systemd service (run on login)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "breadbox-shared"
|
name = "breadbox-shared"
|
||||||
version = "0.2.4"
|
version = "0.2.6"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "breadbox-sync"
|
name = "breadbox-sync"
|
||||||
version = "0.2.4"
|
version = "0.2.6"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "breadbox"
|
name = "breadbox"
|
||||||
version = "0.2.4"
|
version = "0.2.6"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -252,6 +252,42 @@ fn fuzzy_score(query: &str, entry: &DesktopEntry) -> u32 {
|
||||||
4 // subsequence match
|
4 // subsequence match
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Same tiers as `fuzzy_score`, but `None` when nothing matches at all
|
||||||
|
/// (rather than falling through to a bare-subsequence score), and folds in
|
||||||
|
/// `exec` as a tier-4 (weakest) match too — used for filtering, not sorting.
|
||||||
|
/// Tier 4 is loose enough that e.g. querying "zen" matches "Avahi Zeroconf
|
||||||
|
/// Browser" (z…e…n as a subsequence) alongside the real "Zen Browser" hit;
|
||||||
|
/// the filter hides tier-4-only rows whenever a tier ≤2 (name-based) match
|
||||||
|
/// exists elsewhere in the list, so that kind of noise only shows up when
|
||||||
|
/// it's the best any entry can do.
|
||||||
|
fn match_tier(query: &str, entry: &DesktopEntry) -> Option<u32> {
|
||||||
|
if query.is_empty() {
|
||||||
|
return Some(0);
|
||||||
|
}
|
||||||
|
let q = query.to_lowercase();
|
||||||
|
let name = entry.name.to_lowercase();
|
||||||
|
let wm = entry.wm_class.as_deref().unwrap_or("").to_lowercase();
|
||||||
|
if name == q || wm == q {
|
||||||
|
return Some(0);
|
||||||
|
}
|
||||||
|
if name.starts_with(&q) {
|
||||||
|
return Some(1);
|
||||||
|
}
|
||||||
|
if name.contains(&q) {
|
||||||
|
return Some(2);
|
||||||
|
}
|
||||||
|
if wm.starts_with(&q) || wm.contains(&q) {
|
||||||
|
return Some(3);
|
||||||
|
}
|
||||||
|
if fuzzy_matches(query, &entry.name)
|
||||||
|
|| entry.wm_class.as_deref().is_some_and(|w| fuzzy_matches(query, w))
|
||||||
|
|| fuzzy_matches(query, &entry.exec)
|
||||||
|
{
|
||||||
|
return Some(4);
|
||||||
|
}
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
// ---- PID file toggle --------------------------------------------------------
|
// ---- PID file toggle --------------------------------------------------------
|
||||||
|
|
||||||
fn pid_file() -> PathBuf {
|
fn pid_file() -> PathBuf {
|
||||||
|
|
@ -344,7 +380,7 @@ fn run_ui(entries: Vec<DesktopEntry>, history: LaunchHistory) {
|
||||||
vbox.set_size_request(600, -1);
|
vbox.set_size_request(600, -1);
|
||||||
|
|
||||||
let search = SearchEntry::new();
|
let search = SearchEntry::new();
|
||||||
search.set_placeholder_text(Some("breadbox"));
|
search.set_placeholder_text(Some("Search apps…"));
|
||||||
vbox.append(&search);
|
vbox.append(&search);
|
||||||
|
|
||||||
let scroll = ScrolledWindow::new();
|
let scroll = ScrolledWindow::new();
|
||||||
|
|
@ -425,20 +461,26 @@ fn run_ui(entries: Vec<DesktopEntry>, history: LaunchHistory) {
|
||||||
let text = entry.text();
|
let text = entry.text();
|
||||||
let query = text.as_str();
|
let query = text.as_str();
|
||||||
*filter_query.borrow_mut() = query.to_string();
|
*filter_query.borrow_mut() = query.to_string();
|
||||||
|
|
||||||
|
// Two passes: first collect each row's match tier, then decide
|
||||||
|
// visibility — a tier-4 (bare subsequence) row only gets hidden
|
||||||
|
// once we know whether some *other* row has a real tier ≤2 hit.
|
||||||
|
let mut rows = Vec::new();
|
||||||
let mut i = 0i32;
|
let mut i = 0i32;
|
||||||
while let Some(row) = list_f.row_at_index(i) {
|
while let Some(row) = list_f.row_at_index(i) {
|
||||||
let vis = get_row_entry(&row)
|
let tier = get_row_entry(&row).and_then(|e| match_tier(query, &e));
|
||||||
.map(|e| {
|
rows.push((row, tier));
|
||||||
fuzzy_matches(query, &e.name)
|
|
||||||
|| e.wm_class
|
|
||||||
.as_deref()
|
|
||||||
.is_some_and(|w| fuzzy_matches(query, w))
|
|
||||||
|| fuzzy_matches(query, &e.exec)
|
|
||||||
})
|
|
||||||
.unwrap_or(false);
|
|
||||||
row.set_visible(vis);
|
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
|
let has_direct_hit = rows.iter().any(|(_, t)| matches!(t, Some(0..=2)));
|
||||||
|
for (row, tier) in &rows {
|
||||||
|
let vis = match tier {
|
||||||
|
None => false,
|
||||||
|
Some(4) if has_direct_hit => false,
|
||||||
|
Some(_) => true,
|
||||||
|
};
|
||||||
|
row.set_visible(vis);
|
||||||
|
}
|
||||||
list_f.invalidate_sort();
|
list_f.invalidate_sort();
|
||||||
let first_vis = (0i32..).find_map(|j| {
|
let first_vis = (0i32..).find_map(|j| {
|
||||||
list_f.row_at_index(j).filter(|r| r.is_visible())
|
list_f.row_at_index(j).filter(|r| r.is_visible())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue