Skip to content

Commit bc9c53b

Browse files
authored
Merge pull request #26 from xlab/xlab/linux-support
Add Linux support and UI scaling
2 parents dc30b9e + 23ff3f6 commit bc9c53b

16 files changed

Lines changed: 579 additions & 142 deletions

RELEASING.linux.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Releasing CodexMonitor (Linux/AppImage)
2+
3+
This is a copy/paste friendly script-style guide. It must be run on Linux and
4+
produces an AppImage for the current machine architecture (x86_64 or
5+
arm64/aarch64).
6+
7+
Prerequisites (examples):
8+
9+
- Ubuntu/Debian: `sudo apt-get install -y libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev patchelf libfuse2`
10+
- Arch: `sudo pacman -S --needed webkit2gtk gtk3 libayatana-appindicator librsvg patchelf fuse2`
11+
12+
Notes:
13+
14+
- AppImage bundling uses the current OS and arch (no cross-compile in this flow).
15+
- On Arch, AppImage bundling can fail while stripping; `npm run build:appimage`
16+
already sets `NO_STRIP=1`.
17+
- If AppImage tooling fails to execute because of FUSE, try:
18+
`APPIMAGE_EXTRACT_AND_RUN=1 npm run build:appimage`.
19+
20+
```bash
21+
set -euo pipefail
22+
23+
# --- Set versions ---
24+
# Update these two values each release.
25+
RELEASE_VERSION="0.5.1"
26+
PREV_VERSION="0.5.0"
27+
28+
# --- Update version fields (manual check afterwards) ---
29+
perl -pi -e "s/\"version\": \"[^\"]+\"/\"version\": \"${RELEASE_VERSION}\"/" package.json
30+
perl -pi -e "s/\"version\": \"[^\"]+\"/\"version\": \"${RELEASE_VERSION}\"/" src-tauri/tauri.conf.json
31+
npm install
32+
33+
# --- Commit + push version bump ---
34+
git add package.json package-lock.json src-tauri/tauri.conf.json
35+
git commit -m "chore: bump version to ${RELEASE_VERSION}"
36+
git push origin main
37+
38+
# --- Build AppImage ---
39+
npm run build:appimage
40+
41+
# --- Collect artifact ---
42+
ARCH="$(uname -m)"
43+
APPIMAGE_DIR="src-tauri/target/release/bundle/appimage"
44+
APPIMAGE_FILE="$(ls "${APPIMAGE_DIR}"/*.AppImage | head -n 1)"
45+
mkdir -p release-artifacts
46+
cp "${APPIMAGE_FILE}" "release-artifacts/CodexMonitor_${RELEASE_VERSION}_${ARCH}.AppImage"
47+
48+
# Optional: checksum
49+
sha256sum "release-artifacts/CodexMonitor_${RELEASE_VERSION}_${ARCH}.AppImage" \
50+
> "release-artifacts/CodexMonitor_${RELEASE_VERSION}_${ARCH}.AppImage.sha256"
51+
52+
# --- Changelog (for release notes) ---
53+
git log --name-only --pretty=format:"%h %s" v${PREV_VERSION}..v${RELEASE_VERSION}
54+
55+
# --- Tag ---
56+
git tag v${RELEASE_VERSION}
57+
git push origin v${RELEASE_VERSION}
58+
59+
# --- Create GitHub release with artifact ---
60+
gh release create v${RELEASE_VERSION} \
61+
--title "v${RELEASE_VERSION}" \
62+
--notes "- Short update notes" \
63+
"release-artifacts/CodexMonitor_${RELEASE_VERSION}_${ARCH}.AppImage" \
64+
"release-artifacts/CodexMonitor_${RELEASE_VERSION}_${ARCH}.AppImage.sha256"
65+
66+
# --- If you need to update assets later ---
67+
gh release upload v${RELEASE_VERSION} \
68+
"release-artifacts/CodexMonitor_${RELEASE_VERSION}_${ARCH}.AppImage" \
69+
"release-artifacts/CodexMonitor_${RELEASE_VERSION}_${ARCH}.AppImage.sha256" \
70+
--clobber
71+
```

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"scripts": {
77
"dev": "vite",
88
"build": "tsc && vite build",
9+
"build:appimage": "NO_STRIP=1 tauri build --bundles appimage",
910
"typecheck": "tsc --noEmit",
1011
"preview": "vite preview",
1112
"tauri": "tauri"

src-tauri/Cargo.lock

Lines changed: 38 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ tokio = { version = "1", features = ["io-util", "process", "rt", "sync", "time"]
2727
uuid = { version = "1", features = ["v4"] }
2828
tauri-plugin-dialog = "2"
2929
git2 = "0.20.3"
30+
fix-path-env = { git = "https://github.com/tauri-apps/fix-path-env-rs" }
3031

3132
[target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies]
3233
tauri-plugin-updater = "2"

src-tauri/src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ mod workspaces;
1313

1414
#[cfg_attr(mobile, tauri::mobile_entry_point)]
1515
pub fn run() {
16+
#[cfg(target_os = "linux")]
17+
{
18+
// Avoid WebKit compositing issues on some Linux setups (GBM buffer errors).
19+
if std::env::var_os("WEBKIT_DISABLE_COMPOSITING_MODE").is_none() {
20+
std::env::set_var("WEBKIT_DISABLE_COMPOSITING_MODE", "1");
21+
}
22+
}
23+
1624
tauri::Builder::default()
1725
.enable_macos_default_menu(false)
1826
.menu(|handle| {

src-tauri/src/main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@
22
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
33

44
fn main() {
5+
if let Err(err) = fix_path_env::fix() {
6+
eprintln!("Failed to sync PATH from shell: {err}");
7+
}
58
codex_monitor_lib::run()
69
}

src-tauri/src/types.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,17 +130,24 @@ pub(crate) struct AppSettings {
130130
pub(crate) codex_bin: Option<String>,
131131
#[serde(default = "default_access_mode", rename = "defaultAccessMode")]
132132
pub(crate) default_access_mode: String,
133+
#[serde(default = "default_ui_scale", rename = "uiScale")]
134+
pub(crate) ui_scale: f64,
133135
}
134136

135137
fn default_access_mode() -> String {
136138
"current".to_string()
137139
}
138140

141+
fn default_ui_scale() -> f64 {
142+
1.0
143+
}
144+
139145
impl Default for AppSettings {
140146
fn default() -> Self {
141147
Self {
142148
codex_bin: None,
143149
default_access_mode: "current".to_string(),
150+
ui_scale: 1.0,
144151
}
145152
}
146153
}
@@ -154,6 +161,7 @@ mod tests {
154161
let settings: AppSettings = serde_json::from_str("{}").expect("settings deserialize");
155162
assert!(settings.codex_bin.is_none());
156163
assert_eq!(settings.default_access_mode, "current");
164+
assert!((settings.ui_scale - 1.0).abs() < f64::EPSILON);
157165
}
158166

159167
#[test]

src-tauri/tauri.linux.conf.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"app": {
3+
"windows": [
4+
{
5+
"title": "CodexMonitor",
6+
"width": 1200,
7+
"height": 700,
8+
"minWidth": 360,
9+
"minHeight": 600,
10+
"titleBarStyle": "Visible",
11+
"hiddenTitle": false,
12+
"transparent": false,
13+
"devtools": true,
14+
"windowEffects": null
15+
}
16+
]
17+
}
18+
}

0 commit comments

Comments
 (0)