fix: align Linux background lifecycle

This commit is contained in:
2026-08-01 21:16:05 +09:00
parent 845dde50ad
commit 82f29f0bd2
7 changed files with 106 additions and 2 deletions
+28
View File
@@ -0,0 +1,28 @@
import { definePatch, PHASE_MAIN_BUNDLE } from "./descriptor.mjs";
import { markerStatus, replaceExactly } from "./lib.mjs";
export const CLOSE_TO_TRAY_MARKER = "/* nani-linux:linux-close-to-tray */";
export const CLOSE_TO_TRAY_ANCHOR = 'process.platform==="darwin"&&Fs(d)';
const CLOSE_TO_TRAY_REPLACEMENT =
'(process.platform==="darwin"||process.platform==="linux")&&Fs(d)' +
CLOSE_TO_TRAY_MARKER;
export default definePatch({
id: "linux-close-to-tray",
phase: PHASE_MAIN_BUNDLE,
order: 11,
required: true,
apply({ source }) {
const status = markerStatus(source, CLOSE_TO_TRAY_MARKER);
if (status) return { source, status };
return {
source: replaceExactly(
source,
CLOSE_TO_TRAY_ANCHOR,
CLOSE_TO_TRAY_REPLACEMENT,
"Linux close-to-tray",
),
status: "applied",
};
},
});