Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ outside the sandbox.

Preview tab downloads save to your Downloads folder. On KDE, T3 Code can store
its secrets in KWallet. With Network access on, Settings shows the host's
Tailscale HTTPS address.
Tailscale HTTPS address. A managed policy at `/etc/t3code/policy.json` applies
to both the app and its host server.

For local builds, see [Building](docs/building.md). Maintainers can find update
and release instructions in [Publishing](docs/publishing.md).
8 changes: 8 additions & 0 deletions flatpak/com.t3tools.t3code.metainfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@
<launchable type="desktop-id">com.t3tools.t3code.desktop</launchable>
<url type="homepage">https://t3.codes</url>
<releases>
<release version="0.1.7" date="2026-11-04">
<url type="details">https://github.com/pingdotgg/t3code/releases/tag/v0.1.7</url>
<description>
<p>Update to T3 Code 0.1.7.</p>
<p>The desktop now follows an organization's managed policy at
/etc/t3code/policy.json, matching the T3 server on the host.</p>
</description>
</release>
<release version="0.1.6-1" date="2026-10-31">
<url type="details">https://github.com/pingdotgg/t3code/releases/tag/v0.1.6</url>
<description>
Expand Down
2 changes: 2 additions & 0 deletions flatpak/com.t3tools.t3code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ finish-args:
- --filesystem=xdg-download
# The host server hands the sandboxed browser a /tmp path for preview downloads.
- --filesystem=/tmp
# The desktop reads the host's managed policy at /run/host/etc/t3code/policy.json.
- --filesystem=host-etc:ro
- --filesystem=~/.ssh/config:ro
- --filesystem=~/.ssh/config.d:ro
- --filesystem=~/.ssh/known_hosts:ro
Expand Down
5 changes: 3 additions & 2 deletions flatpak/modules/t3code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ test-commands:
sources:
- type: git
url: https://github.com/pingdotgg/t3code.git
tag: v0.1.6
commit: 2359643cffa6ba9ee84d6f2694b935de54a8013e
tag: v0.1.7
commit: 322f6544dfad0a3c8a0c8cbecf2c7f7874b14268
x-checker-data:
type: json
url: https://api.github.com/repos/pingdotgg/t3code/releases/latest
Expand All @@ -82,6 +82,7 @@ sources:
- ../../patches/0011-flatpak-database-maintenance.patch
- ../../patches/0012-flatpak-update-channel.patch
- ../../patches/0013-flatpak-startup-recovery.patch
- ../../patches/0014-flatpak-managed-policy.patch
use-git: true
- type: dir
path: ../package
Expand Down
35 changes: 13 additions & 22 deletions patches/0001-flatpak-desktop-integration.patch
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ index 11f975a6b8..586db466b6 100644
devServerUrl: Config.URL("VITE_DEV_SERVER_URL").pipe(Config.option),
appUserModelIdOverride: trimmedString("T3CODE_DESKTOP_APP_USER_MODEL_ID"),
diff --git a/apps/desktop/src/app/DesktopEarlyElectronStartup.ts b/apps/desktop/src/app/DesktopEarlyElectronStartup.ts
index 00a355bf49..e3d56b16c4 100644
index 3c571bcf02..4f1cf91396 100644
--- a/apps/desktop/src/app/DesktopEarlyElectronStartup.ts
+++ b/apps/desktop/src/app/DesktopEarlyElectronStartup.ts
@@ -1,3 +1,5 @@
Expand All @@ -20,16 +20,14 @@ index 00a355bf49..e3d56b16c4 100644
import { fromLenientJson } from "@t3tools/shared/schemaJson";
import * as Option from "effect/Option";
import * as Schema from "effect/Schema";
@@ -144,10 +146,11 @@ export function resolveEarlyLinuxElectronOptions(
@@ -143,9 +145,10 @@ export function resolveEarlyLinuxElectronOptions(
): EarlyLinuxElectronOptions {
const preference = resolveEarlyLinuxPasswordStorePreference(input);
const isDevelopment = isDevelopmentEnvironment(input.env);
+ const appId = flatpakAppId(input.env, "linux");
return {
isDevelopment,
- linuxWmClass: isDevelopment ? "t3code-dev" : "t3code",
- linuxDesktopEntryName: resolveLinuxDesktopEntryName(isDevelopment),
+ linuxWmClass: appId ?? (isDevelopment ? "t3code-dev" : "t3code"),
+ linuxDesktopEntryName: appId ? `${appId}.desktop` : resolveLinuxDesktopEntryName(isDevelopment),
passwordStore: resolveLinuxPasswordStoreSwitch({
preference,
Expand Down Expand Up @@ -58,10 +56,10 @@ index 200745f111..2b9aa94ef0 100644
Effect.gen(function* () {
const environment = yield* makeEnvironment({
diff --git a/apps/desktop/src/app/DesktopEnvironment.ts b/apps/desktop/src/app/DesktopEnvironment.ts
index 1066198b8f..6f42471060 100644
index d5fed4b228..05f90aedf5 100644
--- a/apps/desktop/src/app/DesktopEnvironment.ts
+++ b/apps/desktop/src/app/DesktopEnvironment.ts
@@ -168,10 +168,14 @@ const make = Effect.fn("desktop.environment.make")(function* (
@@ -167,10 +167,14 @@ const make = Effect.fn("desktop.environment.make")(function* (
input.isPackaged && input.platform === "win32"
? path.join(input.resourcesPath, "server.asar")
: appRoot;
Expand All @@ -77,21 +75,19 @@ index 1066198b8f..6f42471060 100644
const displayName = branding.displayName;
const stateDir = resolveDesktopStateDir({
baseDir,
@@ -231,8 +235,10 @@ const make = Effect.fn("desktop.environment.make")(function* (
@@ -230,7 +234,9 @@ const make = Effect.fn("desktop.environment.make")(function* (
appUserModelId: Option.getOrElse(config.appUserModelIdOverride, () =>
isDevelopment ? "com.t3tools.t3code.dev" : "com.t3tools.t3code",
),
- linuxDesktopEntryName: resolveLinuxDesktopEntryName(isDevelopment),
- linuxWmClass: isDevelopment ? "t3code-dev" : "t3code",
+ linuxDesktopEntryName: flatpakId
+ ? `${flatpakId}.desktop`
+ : resolveLinuxDesktopEntryName(isDevelopment),
+ linuxWmClass: flatpakId ?? (isDevelopment ? "t3code-dev" : "t3code"),
linuxApplicationsDir,
desktopLauncherPath: config.desktopLauncherPath,
appImagePath: config.appImagePath,
diff --git a/apps/desktop/src/app/DesktopLinuxUrlHandler.test.ts b/apps/desktop/src/app/DesktopLinuxUrlHandler.test.ts
index 9404b0ac30..c68935c3be 100644
index 16d2f8e241..df911a745a 100644
--- a/apps/desktop/src/app/DesktopLinuxUrlHandler.test.ts
+++ b/apps/desktop/src/app/DesktopLinuxUrlHandler.test.ts
@@ -1,5 +1,5 @@
Expand All @@ -101,7 +97,7 @@ index 9404b0ac30..c68935c3be 100644
import * as HostProcess from "@t3tools/shared/HostProcess";
import * as Cause from "effect/Cause";
import * as Deferred from "effect/Deferred";
@@ -166,6 +166,15 @@ const emptyRecording = (): RecordedRegistration => ({
@@ -165,6 +165,15 @@ const emptyRecording = (): RecordedRegistration => ({
});

describe("DesktopLinuxUrlHandler", () => {
Expand All @@ -118,7 +114,7 @@ index 9404b0ac30..c68935c3be 100644
const entry = DesktopLinuxUrlHandler.renderUrlHandlerDesktopEntry({
displayName: "T3 Code (Nightly)",
diff --git a/apps/desktop/src/app/DesktopLinuxUrlHandler.ts b/apps/desktop/src/app/DesktopLinuxUrlHandler.ts
index ebd7d71b25..9ba0fd1fc2 100644
index cfa8498ae6..4626a2601c 100644
--- a/apps/desktop/src/app/DesktopLinuxUrlHandler.ts
+++ b/apps/desktop/src/app/DesktopLinuxUrlHandler.ts
@@ -9,6 +9,7 @@ import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner";
Expand All @@ -129,7 +125,7 @@ index ebd7d71b25..9ba0fd1fc2 100644
import * as DesktopEnvironment from "./DesktopEnvironment.ts";
import { makeComponentLogger } from "./DesktopObservability.ts";

@@ -286,7 +287,10 @@ export const make = Effect.gen(function* () {
@@ -287,7 +288,10 @@ export const make = Effect.gen(function* () {
);

const register = Effect.gen(function* () {
Expand All @@ -142,10 +138,10 @@ index ebd7d71b25..9ba0fd1fc2 100644
}
yield* writeDesktopEntry;
diff --git a/apps/desktop/src/app/DesktopPreReadyPlatform.test.ts b/apps/desktop/src/app/DesktopPreReadyPlatform.test.ts
index f2b176ee37..72a944f961 100644
index f2b176ee37..0baac17608 100644
--- a/apps/desktop/src/app/DesktopPreReadyPlatform.test.ts
+++ b/apps/desktop/src/app/DesktopPreReadyPlatform.test.ts
@@ -60,6 +60,28 @@ vi.mock("node:child_process", () => ({
@@ -60,6 +60,23 @@ vi.mock("node:child_process", () => ({
import * as DesktopPreReadyPlatform from "./DesktopPreReadyPlatform.ts";

describe("DesktopPreReadyPlatform", () => {
Expand All @@ -154,11 +150,6 @@ index f2b176ee37..72a944f961 100644
+ return Effect.gen(function* () {
+ yield* DesktopPreReadyPlatform.DesktopPreReadyElectronOptions;
+ assert.deepEqual(setDesktopNameMock.mock.calls, [["com.t3tools.t3code.desktop"]]);
+ assert.isTrue(
+ appendSwitchMock.mock.calls.some(
+ ([name, value]) => name === "class" && value === "com.t3tools.t3code",
+ ),
+ );
+ assert.equal(mkdirSyncMock.mock.calls.length, 0);
+ assert.equal(writeFileSyncMock.mock.calls.length, 0);
+ }).pipe(
Expand All @@ -175,7 +166,7 @@ index f2b176ee37..72a944f961 100644
appendSwitchMock.mockReset();
getSwitchValueMock.mockReset();
diff --git a/apps/desktop/src/app/DesktopPreReadyPlatform.ts b/apps/desktop/src/app/DesktopPreReadyPlatform.ts
index 8bef7366e3..920599c521 100644
index d77544f54b..cbf87853eb 100644
--- a/apps/desktop/src/app/DesktopPreReadyPlatform.ts
+++ b/apps/desktop/src/app/DesktopPreReadyPlatform.ts
@@ -9,6 +9,7 @@ import * as Layer from "effect/Layer";
Expand Down Expand Up @@ -282,7 +273,7 @@ index 8bef7366e3..920599c521 100644
+ }
// Chromium caches portal identity; set it before any asynchronous initialization.
Electron.app.setDesktopName(linux.linuxDesktopEntryName);
Electron.app.commandLine.appendSwitch("class", linux.linuxWmClass);
if (linux.passwordStore !== null && linuxPasswordStoreCommandLine === null) {
diff --git a/apps/desktop/src/app/Flatpak.ts b/apps/desktop/src/app/Flatpak.ts
new file mode 100644
index 0000000000..006f94e000
Expand Down
4 changes: 2 additions & 2 deletions patches/0002-flatpak-host-backend.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/apps/desktop/src/backend/DesktopBackendConfiguration.ts b/apps/desktop/src/backend/DesktopBackendConfiguration.ts
index 4929031395..69c2ad3ded 100644
index 69a70b68a4..bcf48615be 100644
--- a/apps/desktop/src/backend/DesktopBackendConfiguration.ts
+++ b/apps/desktop/src/backend/DesktopBackendConfiguration.ts
@@ -1,5 +1,8 @@
Expand All @@ -20,7 +20,7 @@ index 4929031395..69c2ad3ded 100644
executablePath: process.execPath,
// Packaged builds have a separate cache; --require prevents cache settings leaking to provider subprocesses.
args: [
@@ -541,6 +544,15 @@ const resolvePrimaryStartConfig = Effect.fn("desktop.backendConfiguration.resolv
@@ -542,6 +545,15 @@ const resolvePrimaryStartConfig = Effect.fn("desktop.backendConfiguration.resolv
captureOutput: true,
preflightFailure: Option.none(),
} satisfies DesktopBackendManager.DesktopBackendStartConfig;
Expand Down
26 changes: 13 additions & 13 deletions patches/0003-flatpak-host-environment.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/apps/desktop/src/shell/DesktopShellEnvironment.test.ts b/apps/desktop/src/shell/DesktopShellEnvironment.test.ts
index 4804823069..609a1432bd 100644
index 124dbbeae8..3ad3a5dd3b 100644
--- a/apps/desktop/src/shell/DesktopShellEnvironment.test.ts
+++ b/apps/desktop/src/shell/DesktopShellEnvironment.test.ts
@@ -118,6 +118,21 @@ function runShellEnvironment(input: {
@@ -163,6 +163,21 @@ function runShellEnvironment(input: {
}

describe("DesktopShellEnvironment", () => {
Expand All @@ -21,22 +21,22 @@ index 4804823069..609a1432bd 100644
+ }).pipe(Effect.tap(() => Effect.sync(() => assert.equal(env.PATH, "/app/bin:/usr/bin"))));
+ });
+
it.effect("rejects PATH output from a failed shell and tries the next candidate", () =>
it.effect("does not wait for discovery when the cache is missing", () =>
Effect.gen(function* () {
const env: NodeJS.ProcessEnv = { SHELL: "/bin/failing", PATH: "/usr/bin" };
const started = yield* Deferred.make<void>();
diff --git a/apps/desktop/src/shell/DesktopShellEnvironment.ts b/apps/desktop/src/shell/DesktopShellEnvironment.ts
index 6e0fdbd380..365313b48d 100644
index 37826f8ee5..4843080432 100644
--- a/apps/desktop/src/shell/DesktopShellEnvironment.ts
+++ b/apps/desktop/src/shell/DesktopShellEnvironment.ts
@@ -14,6 +14,7 @@ import * as Stream from "effect/Stream";
@@ -22,6 +22,7 @@ import * as Stream from "effect/Stream";
import * as ChildProcess from "effect/process/ChildProcess";
import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner";

+import { flatpakAppId } from "../app/Flatpak.ts";
import * as DesktopEnvironment from "../app/DesktopEnvironment.ts";

type EnvironmentPatch = Record<string, string>;
@@ -503,6 +504,7 @@ const installShellEnvironment = (
@@ -529,6 +530,7 @@ const installShellEnvironment = (
never,
ChildProcessSpawner.ChildProcessSpawner | FileSystem.FileSystem
> => {
Expand All @@ -45,7 +45,7 @@ index 6e0fdbd380..365313b48d 100644
return installWindowsEnvironment(config);
}
diff --git a/apps/desktop/src/updates/DesktopUpdates.test.ts b/apps/desktop/src/updates/DesktopUpdates.test.ts
index c6bcd46b8c..37d6276a4a 100644
index 3b45d80bbc..cc2cc4c537 100644
--- a/apps/desktop/src/updates/DesktopUpdates.test.ts
+++ b/apps/desktop/src/updates/DesktopUpdates.test.ts
@@ -1,4 +1,4 @@
Expand All @@ -54,7 +54,7 @@ index c6bcd46b8c..37d6276a4a 100644
import { DESKTOP_UPDATE_RESTART_MARKER_FILE } from "@t3tools/contracts";
import * as Cause from "effect/Cause";
import * as Deferred from "effect/Deferred";
@@ -22,6 +22,28 @@ import * as DesktopUpdates from "./DesktopUpdates.ts";
@@ -23,6 +23,28 @@ import * as DesktopUpdates from "./DesktopUpdates.ts";
import { flushCallbacks, makeHarness } from "./updatesTestHarness.ts";

describe("DesktopUpdates", () => {
Expand Down Expand Up @@ -84,21 +84,21 @@ index c6bcd46b8c..37d6276a4a 100644
Effect.gen(function* () {
const linuxState = (packageType: string | undefined) =>
diff --git a/apps/desktop/src/updates/DesktopUpdates.ts b/apps/desktop/src/updates/DesktopUpdates.ts
index 3a0b41cd9e..f72a430e39 100644
index 6279e8b614..637b0bc113 100644
--- a/apps/desktop/src/updates/DesktopUpdates.ts
+++ b/apps/desktop/src/updates/DesktopUpdates.ts
@@ -1,3 +1,4 @@
+import { flatpakAppId } from "../app/Flatpak.ts";
import {
DESKTOP_UPDATE_RESTART_MARKER_FILE,
DesktopUpdateChannelSchema,
@@ -323,6 +324,9 @@ function getAutoUpdateDisabledReason(args: {
@@ -338,6 +339,9 @@ function getAutoUpdateDisabledReason(args: {
disabledByEnv: boolean;
hasUpdateFeedConfig: boolean;
}): string | null {
+ if (flatpakAppId(process.env, args.platform) !== null) {
+ return "Updates are managed by Flatpak.";
+ }
if (!args.hasUpdateFeedConfig) {
return "Automatic updates are not available because no update feed is configured.";
if (args.policy.mode === "off") {
return args.policy.message ?? "Updates are turned off on this machine.";
}
20 changes: 10 additions & 10 deletions patches/0006-flatpak-document-portal-paths.patch
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,15 @@ index 4f9ab12edd..30db8e3217 100644
pickFiles: Effect.fn("desktop.electron.dialog.pickFiles")(function* (input) {
const ownerWindowId = Option.match(input.owner, {
diff --git a/apps/desktop/src/ipc/DesktopIpc.ts b/apps/desktop/src/ipc/DesktopIpc.ts
index 354acc5a81..64f54412fa 100644
index 354acc5a81..e8e89d9502 100644
--- a/apps/desktop/src/ipc/DesktopIpc.ts
+++ b/apps/desktop/src/ipc/DesktopIpc.ts
@@ -17,7 +17,7 @@ export type DesktopIpcHandleListener = (
raw: unknown,
) => unknown | Promise<unknown>;

-export type DesktopIpcSyncListener = (event: DesktopIpcSyncEvent) => void;
+export type DesktopIpcSyncListener = (event: DesktopIpcSyncEvent, payload: unknown) => void;
+export type DesktopIpcSyncListener = (event: DesktopIpcSyncEvent, payload?: unknown) => void;

export interface DesktopIpcMain {
removeHandler(channel: string): void;
Expand Down Expand Up @@ -219,27 +219,27 @@ index 354acc5a81..64f54412fa 100644
Effect.annotateLogs({ channel }),
Effect.withSpan("desktop.ipc.invokeSync"),
diff --git a/apps/desktop/src/ipc/DesktopIpcHandlers.ts b/apps/desktop/src/ipc/DesktopIpcHandlers.ts
index 35333ac3d3..98001d96f3 100644
index a46dbafab0..8be9e500a7 100644
--- a/apps/desktop/src/ipc/DesktopIpcHandlers.ts
+++ b/apps/desktop/src/ipc/DesktopIpcHandlers.ts
@@ -47,6 +47,7 @@ import {
@@ -48,6 +48,7 @@ import {
revealWindow,
pickFolder,
pickProjectFavicon,
+ resolveHostPath,
pickThemeFiles,
setTheme,
showContextMenu,
@@ -93,6 +94,7 @@ export const installDesktopIpcHandlers = Effect.fn("desktop.ipc.installHandlers"
@@ -94,6 +95,7 @@ export const installDesktopIpcHandlers = Effect.fn("desktop.ipc.installHandlers"
yield* ipc.handleSync(getAppBranding);
yield* ipc.handleSync(getRelayTelemetryEnabled);
yield* installRelayTelemetryEnabled();
yield* ipc.handleSync(getSystemLocale);
+ yield* ipc.handleSync(resolveHostPath);
yield* ipc.handleSync(getWindowFullscreenState);
yield* ipc.handleSync(getLocalEnvironmentBootstraps);
yield* ipc.handleSync(getLocalEnvironmentEnabled);
diff --git a/apps/desktop/src/ipc/channels.ts b/apps/desktop/src/ipc/channels.ts
index 538dd06b0b..c2bb874846 100644
index 0f125c05de..9ca25157de 100644
--- a/apps/desktop/src/ipc/channels.ts
+++ b/apps/desktop/src/ipc/channels.ts
@@ -1,6 +1,7 @@
Expand All @@ -251,10 +251,10 @@ index 538dd06b0b..c2bb874846 100644
export const SET_THEME_CHANNEL = "desktop:set-theme";
export const CONTEXT_MENU_CHANNEL = "desktop:context-menu";
diff --git a/apps/desktop/src/ipc/methods/window.ts b/apps/desktop/src/ipc/methods/window.ts
index f0d661b58b..95a4cc779a 100644
index 63b8db03da..063a1a54a4 100644
--- a/apps/desktop/src/ipc/methods/window.ts
+++ b/apps/desktop/src/ipc/methods/window.ts
@@ -250,10 +250,24 @@ export const pickProjectFavicon = DesktopIpc.makeIpcMethod({
@@ -267,10 +267,24 @@ export const pickProjectFavicon = DesktopIpc.makeIpcMethod({
},
],
});
Expand All @@ -281,7 +281,7 @@ index f0d661b58b..95a4cc779a 100644
channel: IpcChannels.SET_THEME_CHANNEL,
payload: DesktopThemeSchema,
diff --git a/apps/desktop/src/preload.ts b/apps/desktop/src/preload.ts
index 950ed972c6..4d9e156341 100644
index da56807186..907b74c481 100644
--- a/apps/desktop/src/preload.ts
+++ b/apps/desktop/src/preload.ts
@@ -82,7 +82,13 @@ contextBridge.exposeInMainWorld("desktopBridge", {
Expand Down
Loading