fix(linux): fix KWin script startup crash and embed type-2 ELF runtime in AppImage
This commit is contained in:
@@ -115,16 +115,14 @@ fn main() -> ExitCode {
|
|||||||
// costs — on a Wayland session, XWayland clients only.
|
// costs — on a Wayland session, XWayland clients only.
|
||||||
let (tx, rx) = std::sync::mpsc::channel();
|
let (tx, rx) = std::sync::mpsc::channel();
|
||||||
|
|
||||||
|
let watcher_conn = blocker_platform_linux::watcher::serve(tx.clone()).ok();
|
||||||
|
if watcher_conn.is_some() {
|
||||||
|
println!("owning the D-Bus name {BUS_NAME}");
|
||||||
|
}
|
||||||
|
|
||||||
if let Ok(backend) = blocker_platform_linux::kwin::KwinBackend::connect() {
|
if let Ok(backend) = blocker_platform_linux::kwin::KwinBackend::connect() {
|
||||||
println!("backend: kwin — native Wayland windows are visible");
|
println!("backend: kwin — native Wayland windows are visible");
|
||||||
let _keep_connection = match blocker_platform_linux::watcher::serve(tx) {
|
let _keep_connection = watcher_conn;
|
||||||
Ok(c) => c,
|
|
||||||
Err(e) => {
|
|
||||||
eprintln!("blocker-daemon: cannot own {BUS_NAME}: {e}");
|
|
||||||
return ExitCode::FAILURE;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
println!("owning the D-Bus name; entering the event loop");
|
|
||||||
run_loop(&rx, &schedules, &usage, &context, blocker_platform_linux::Enforcement::Freeze);
|
run_loop(&rx, &schedules, &usage, &context, blocker_platform_linux::Enforcement::Freeze);
|
||||||
backend.shutdown();
|
backend.shutdown();
|
||||||
return ExitCode::SUCCESS;
|
return ExitCode::SUCCESS;
|
||||||
|
|||||||
@@ -126,9 +126,8 @@ workspace.windowActivated.connect(reportFocus);
|
|||||||
|
|
||||||
// Report whatever is already focused, so the daemon starts with a correct state
|
// Report whatever is already focused, so the daemon starts with a correct state
|
||||||
// instead of waiting for the user to alt-tab.
|
// instead of waiting for the user to alt-tab.
|
||||||
for (var i = 0; i < workspace.windowList().length; i++) {
|
if (workspace.activeWindow) {
|
||||||
var w = workspace.windowList()[i];
|
reportFocus(workspace.activeWindow);
|
||||||
if (w.active) { reportFocus(w); break; }
|
|
||||||
}
|
}
|
||||||
"#;
|
"#;
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -26,11 +26,24 @@ cp "$PKG_DIR/blocker.svg" "$APPDIR/blocker.svg"
|
|||||||
cp "$PKG_DIR/blocker.svg" "$APPDIR/usr/share/icons/hicolor/scalable/apps/"
|
cp "$PKG_DIR/blocker.svg" "$APPDIR/usr/share/icons/hicolor/scalable/apps/"
|
||||||
chmod +x "$APPDIR/AppRun"
|
chmod +x "$APPDIR/AppRun"
|
||||||
|
|
||||||
|
SQUASHFS_IMG="$DIST_DIR/appdir.squashfs"
|
||||||
OUTPUT_APPIMAGE="$DIST_DIR/Blocker-x86_64.AppImage"
|
OUTPUT_APPIMAGE="$DIST_DIR/Blocker-x86_64.AppImage"
|
||||||
rm -f "$OUTPUT_APPIMAGE"
|
RUNTIME_BIN="$PKG_DIR/bin/runtime-x86_64"
|
||||||
|
|
||||||
|
rm -f "$OUTPUT_APPIMAGE" "$SQUASHFS_IMG"
|
||||||
|
|
||||||
echo "Creating AppImage with mksquashfs..."
|
echo "Creating AppImage with mksquashfs..."
|
||||||
mksquashfs "$APPDIR" "$OUTPUT_APPIMAGE" -root-owned -noappend -comp xz
|
mksquashfs "$APPDIR" "$SQUASHFS_IMG" -root-owned -noappend -comp xz
|
||||||
|
|
||||||
|
if [ -f "$RUNTIME_BIN" ]; then
|
||||||
|
echo "Embedding AppImage Type 2 ELF runtime..."
|
||||||
|
cat "$RUNTIME_BIN" "$SQUASHFS_IMG" > "$OUTPUT_APPIMAGE"
|
||||||
|
printf '\x41\x49\x02' | dd of="$OUTPUT_APPIMAGE" bs=1 seek=8 count=3 conv=notrunc 2>/dev/null
|
||||||
|
rm -f "$SQUASHFS_IMG"
|
||||||
|
else
|
||||||
|
mv "$SQUASHFS_IMG" "$OUTPUT_APPIMAGE"
|
||||||
|
fi
|
||||||
|
chmod +x "$OUTPUT_APPIMAGE"
|
||||||
|
|
||||||
echo "Built AppImage: $OUTPUT_APPIMAGE"
|
echo "Built AppImage: $OUTPUT_APPIMAGE"
|
||||||
ls -lh "$OUTPUT_APPIMAGE"
|
ls -lh "$OUTPUT_APPIMAGE"
|
||||||
|
|||||||
Reference in New Issue
Block a user