Skip to content

feat: WorkBuddy 5.5.3 build support + configurable Maintainer/Homepage - #2

Open
LeisureLinux wants to merge 6 commits into
YB-YB:mainfrom
LeisureLinux:fix/linux-build-issues
Open

feat: WorkBuddy 5.5.3 build support + configurable Maintainer/Homepage#2
LeisureLinux wants to merge 6 commits into
YB-YB:mainfrom
LeisureLinux:fix/linux-build-issues

Conversation

@LeisureLinux

Copy link
Copy Markdown

Verified WorkBuddy 5.5.3 (DMG WorkBuddy-darwin-x64-5.5.3.37748631-104760a2.dmg,
sha256 b8289a198a871ea2f3a4acefd71a0f9e41f11aae75161def471a72c3861d3cae)
end-to-end against this branch, then stacked four focused commits on top of
fix/linux-build-issues:

fix(patcher): adapt tray contextMenu patch for WorkBuddy >=5.5.x

Upstream 5.5.x WindowManager.initialize() now attaches a tray context menu
on Linux directly inside the same else branch that constructs the Tray:

if (process.platform === "linux") {
    this.tray.setContextMenu(this.buildFallbackMenu());
}

The legacy anchor the patcher was matching —
const contextMenu = electron.Menu.buildFromTemplate([...]) — no longer
exists in main/index.js, so the build hard-fails with
"contextMenu declaration not found after tray" (exit 5).

Detect the modern layout by scanning the post-Tray window for both
process.platform === 'linux' and setContextMenu( within ~1.2KB of the Tray
construction. When matched, skip the legacy anchor patch entirely; upstream is
already correct for libayatana-appindicator, so no fallback injection is
needed. Still mark trayContextMenu=true so assertRequiredPatches() does
not flag it.

updateMenuDisabled / updateRpcDisabled / networkDiagnosticsTimeouts
remain false on 5.5.x (same as on 5.4.7) and are still tolerated via
WB_SKIP_REQUIRED_PATCHES=1.

refactor: rename artifact binary electron -> workbuddy

The extracted Electron runtime binary in /opt/workbuddy/ is the framework
we ship, not part of the upstream application. Renaming to /opt/workbuddy/workbuddy
makes the install tree uniformly named after the application. start.sh and
the AppImage AppRun call the new path. Kept electron as a compat symlink
to workbuddy so any internal argv[0] / process-title logic still resolves.
The /usr/bin/workbuddy wrapper and .desktop Exec= are unchanged.

feat(packaging): make Maintainer / Homepage configurable via env vars

packaging/linux/control had hard-coded
Maintainer: Community Maintainers <noreply@example.invalid> and no Homepage
field. Now both are populated from env vars at build time, with the
project's preferred defaults baked in:

MAINTAINER="LeisureLinux <AlbertXu@FreeLAMP.com>" make deb
HOMEPAGE="https://workbuddy.cn/"                       make deb
  • deb: MAINTAINER + HOMEPAGE env vars, default values committed.
  • rpm: MAINTAINER_NAME + HOMEPAGE, with --define "packager $MAINTAINER_NAME"
    passed to rpmbuild and URL: $HOMEPAGE in the spec.
  • pacman: MAINTAINER + HOMEPAGE, written into .PKGINFO.
  • README: documented in both 常用自定义配置 and Useful Custom Configurations sections.

The template's Download the official WorkBuddy macOS DMG from: line in the
long description also tracks HOMEPAGE.

chore: bump package.json version to 5.5.3

Side effect of install.sh's write_package_version() reading
CFBundleShortVersionString from the DMG's Info.plist on every build.

Verification

  • dist/workbuddy_5.5.3_amd64.deb built cleanly from a clean state with
    make build-app DMG=… + make deb (defaults produce Maintainer: LeisureLinux <AlbertXu@FreeLAMP.com>, Homepage: https://workbuddy.cn/).
  • Env-var override path tested manually:
    MAINTAINER="Test Person <test@example.com>" HOMEPAGE="https://example.com/wb" make deb
    produces the expected values in dpkg-deb -f.
  • bash -n passes on every modified shell script.
  • The 5.4.7 .deb on disk is unchanged; new defaults reproduce the
    previously committed template values.

Out of scope

  • CHANGELOG.md still ends at 5.0.3+wb3 (2026-06-13). Worth a follow-up
    that adds [5.4.7+wb1] / [5.5.3+wb1] entries rather than retroactively
    rewriting the existing 5.0.3 history.

Upstream 5.5.x WindowManager.initialize() now attaches a tray context
menu on Linux directly:

    if (process.platform === "linux") {
        this.tray.setContextMenu(this.buildFallbackMenu());
    }

inside the same else-branch that constructs the Tray. The legacy
anchor the patcher was matching —

    const contextMenu = electron.Menu.buildFromTemplate([...]);

— no longer exists in main/index.js, so the patcher hard-fails with
"contextMenu declaration not found after tray" and exits 5.

Detect the modern layout by scanning the post-Tray window for both
"process.platform === 'linux'" and "setContextMenu(" within ~1.2KB
of the Tray construction. When matched, skip the legacy anchor patch
entirely; upstream is already correct for libayatana-appindicator, so
no fallback injection is needed. Still mark trayContextMenu=true so
assertRequiredPatches() does not flag it.

This unblocks building WorkBuddy 5.5.x. Required-patch misses for
updateMenuDisabled / updateRpcDisabled / networkDiagnosticsTimeouts
remain (same as on 5.4.7) and are still tolerated via
WB_SKIP_REQUIRED_PATCHES=1.
The extracted Electron runtime binary in /opt/workbuddy/ is the actual
artifact of this port — it is the framework we ship, not part of the
upstream application. Naming it after the framework makes the install
tree confusingly framework-centric, and means a casual reader sees
"/opt/workbuddy/electron" and wonders whether WorkBuddy is just a
rebranded Electron app.

Rename to /opt/workbuddy/workbuddy. start.sh and AppRun's AppRun now
call $APP_DIR/workbuddy / $APPDIR/opt/workbuddy/workbuddy. Keep
electron as a compat symlink to workbuddy so any internal argv[0] /
process-title logic that hard-codes the framework name still resolves
to the same executable.

The /usr/bin/workbuddy wrapper and the .desktop file's Exec= field
already used the application name and are unchanged.
The deb control template had hard-coded:

    Maintainer: Community Maintainers <noreply@example.invalid>

with no Homepage field at all. Update it to read both from env vars
sourced at build time, with the project's preferred defaults baked
in:

    MAINTAINER="LeisureLinux <AlbertXu@FreeLAMP.com>" make deb
    HOMEPAGE="https://workbuddy.cn/"                       make deb

- packaging/linux/control: introduce __MAINTAINER__ / __HOMEPAGE__ /
  __DOWNLOAD_HOMEPAGE__ placeholders. Replace the description's
  hard-coded download URL with __DOWNLOAD_HOMEPAGE__ so it tracks
  HOMEPAGE.

- scripts/build-deb.sh: accept MAINTAINER and HOMEPAGE env vars
  (defaults to the values above); substitute into control via sed.

- scripts/build-rpm.sh: accept MAINTAINER_NAME and HOMEPAGE; emit
  URL: $HOMEPAGE in the spec and pass --define "packager
  $MAINTAINER_NAME" to rpmbuild.

- scripts/build-pacman.sh: accept MAINTAINER and HOMEPAGE; emit
  url = $HOMEPAGE and packager = $MAINTAINER in .PKGINFO.

- README.md: document the three new env vars in both zh and en
  "Useful Custom Configurations" sections.

Defaults match the previously committed template values, so existing
build artifacts (including the 5.4.7 .deb on disk) reproduce
byte-for-byte modulo the version string.
install.sh's write_package_version() reads CFBundleShortVersionString
from the DMG's Info.plist and writes it into package.json + the
workbuddy-app/.workbuddy-linux/version file on every build. After
building WorkBuddy 5.5.3, package.json now reflects the verified
upstream version.

The previous committed version (5.1.4) was already stale relative
to the verified 5.4.7 DMG.
- scripts/slim-deb.sh: convert official linux deb to slim version
  (strip win32/darwin payload, non-linux prebuilds, locales, node
  headers; strip-debug with malformed-ELF safety fallback; built-in
  node/python smoke tests before packaging; ~-25% installed size)
- Makefile: add slim-deb target (accepts local path or URL)
- CI: check-upstream.yml polls official update API daily (02:00 CST),
  builds and publishes slim deb to GitHub Releases on new version
- README: reposition repo as unofficial slim variant of WorkBuddy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant