diff --git a/src/vs/platform/contextkey/common/contextkey.ts b/src/vs/platform/contextkey/common/contextkey.ts index a461dfe4fe7..2216aef90ad 100644 --- a/src/vs/platform/contextkey/common/contextkey.ts +++ b/src/vs/platform/contextkey/common/contextkey.ts @@ -25,6 +25,9 @@ CONSTANT_VALUES.set('isEdge', isEdge); CONSTANT_VALUES.set('isFirefox', isFirefox); CONSTANT_VALUES.set('isChrome', isChrome); CONSTANT_VALUES.set('isSafari', isSafari); +// --- Start Positron --- +CONSTANT_VALUES.set('isPositron', true); +// --- End Positron --- /** allow register constant context keys that are known only after startup; requires running `substituteConstants` on the context key - https://github.com/microsoft/vscode/issues/174218#issuecomment-1437972127 */ export function setConstant(key: string, value: boolean) { diff --git a/src/vs/platform/contextkey/common/contextkeys.ts b/src/vs/platform/contextkey/common/contextkeys.ts index 296245b4608..204c7a38182 100644 --- a/src/vs/platform/contextkey/common/contextkeys.ts +++ b/src/vs/platform/contextkey/common/contextkeys.ts @@ -21,3 +21,7 @@ export const ProductQualityContext = new RawContextKey('productQualityTy export const InputFocusedContextKey = 'inputFocus'; export const InputFocusedContext = new RawContextKey(InputFocusedContextKey, false, localize('inputFocus', "Whether keyboard focus is inside an input box")); + +// --- Start Positron --- +export const IsPositronContext = new RawContextKey('isPositron', true, localize('isPositron', "Whether the application is Positron")); +// --- End Positron --- diff --git a/src/vs/platform/contextkey/test/common/contextkey.test.ts b/src/vs/platform/contextkey/test/common/contextkey.test.ts index 2555701c1d8..74310a52a7b 100644 --- a/src/vs/platform/contextkey/test/common/contextkey.test.ts +++ b/src/vs/platform/contextkey/test/common/contextkey.test.ts @@ -376,4 +376,10 @@ suite('ContextKeyExpr', () => { )! )); }); + + // --- Start Positron --- + test('Positron Context Key', () => { + assert.ok(ContextKeyExpr.has('isPositron').equals(ContextKeyExpr.true())); + }); + // --- End Positron --- }); diff --git a/src/vs/workbench/browser/contextkeys.ts b/src/vs/workbench/browser/contextkeys.ts index 6f845cf7a1a..9446e90cf8b 100644 --- a/src/vs/workbench/browser/contextkeys.ts +++ b/src/vs/workbench/browser/contextkeys.ts @@ -36,6 +36,8 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic // eslint-disable-next-line no-duplicate-imports import { PositronTopActionBarVisibleContext } from 'vs/workbench/common/contextkeys'; // eslint-disable-next-line no-duplicate-imports +import { IsPositronContext } from 'vs/platform/contextkey/common/contextkeys'; +// eslint-disable-next-line no-duplicate-imports import { isTemporaryWorkspace } from 'vs/platform/workspace/common/workspace'; // --- End Positron --- @@ -116,6 +118,7 @@ export class WorkbenchContextKeysHandler extends Disposable { this.virtualWorkspaceContext = VirtualWorkspaceContext.bindTo(this.contextKeyService); // --- Start Positron --- this.temporaryWorkspaceContext = TemporaryWorkspaceContext.bindTo(this.contextKeyService); + IsPositronContext.bindTo(this.contextKeyService); // --- End Positron --- this.updateWorkspaceContextKeys();