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
2 changes: 2 additions & 0 deletions docs/docs/config.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ wsh editconfig
| term:cursorblink <VersionBadge version="v0.14" /> | bool | when enabled, terminal cursor blinks (default false) |
| term:bellsound <VersionBadge version="v0.14" /> | bool | when enabled, plays the system beep sound when the terminal bell (BEL character) is received (default false) |
| term:bellindicator <VersionBadge version="v0.14" /> | bool | when enabled, shows a visual indicator in the tab when the terminal bell is received (default false) |
| term:osc52 <VersionBadge version="v0.14" /> | string | controls OSC 52 clipboard behavior: `always` (default, allows OSC 52 at any time) or `focus` (requires focused window and focused block) |
| term:durable <VersionBadge version="v0.14" /> | bool | makes remote terminal sessions durable across network disconnects (defaults to false) |
| editor:minimapenabled | bool | set to false to disable editor minimap |
| editor:stickyscrollenabled | bool | enables monaco editor's stickyScroll feature (pinning headers of current context, e.g. class names, method names, etc.), defaults to false |
Expand Down Expand Up @@ -147,6 +148,7 @@ For reference, this is the current default configuration (v0.14.0):
"telemetry:enabled": true,
"term:bellsound": false,
"term:bellindicator": false,
"term:osc52": "always",
"term:cursor": "block",
"term:cursorblink": false,
"term:copyonselect": true,
Expand Down
21 changes: 16 additions & 5 deletions frontend/app/view/term/osc-handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@

import { RpcApi } from "@/app/store/wshclientapi";
import { TabRpcClient } from "@/app/store/wshrpcutil";
import { getApi, getBlockMetaKeyAtom, getBlockTermDurableAtom, globalStore, recordTEvent, WOS } from "@/store/global";
import {
getApi,
getBlockMetaKeyAtom,
getBlockTermDurableAtom,
getOverrideConfigAtom,
globalStore,
recordTEvent,
WOS,
} from "@/store/global";
import * as services from "@/store/services";
import { base64ToString, fireAndForget, isSshConnName, isWslConnName } from "@/util/util";
import debug from "debug";
Expand Down Expand Up @@ -114,10 +122,13 @@ export function handleOsc52Command(data: string, blockId: string, loaded: boolea
if (!loaded) {
return true;
}
const isBlockFocused = termWrap.nodeModel ? globalStore.get(termWrap.nodeModel.isFocused) : false;
if (!document.hasFocus() || !isBlockFocused) {
console.log("OSC 52: rejected, window or block not focused");
return true;
const osc52Mode = globalStore.get(getOverrideConfigAtom(blockId, "term:osc52")) ?? "always";
if (osc52Mode === "focus") {
const isBlockFocused = termWrap.nodeModel ? globalStore.get(termWrap.nodeModel.isFocused) : false;
if (!document.hasFocus() || !isBlockFocused) {
console.log("OSC 52: rejected, window or block not focused");
return true;
}
}
if (!data || data.length === 0) {
console.log("OSC 52: empty data received");
Expand Down
2 changes: 2 additions & 0 deletions frontend/types/gotypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1119,6 +1119,7 @@ declare global {
"term:conndebug"?: string;
"term:bellsound"?: boolean;
"term:bellindicator"?: boolean;
"term:osc52"?: string;
"term:durable"?: boolean;
"web:zoom"?: number;
"web:hidenav"?: boolean;
Expand Down Expand Up @@ -1313,6 +1314,7 @@ declare global {
"term:cursorblink"?: boolean;
"term:bellsound"?: boolean;
"term:bellindicator"?: boolean;
"term:osc52"?: string;
"term:durable"?: boolean;
"editor:minimapenabled"?: boolean;
"editor:stickyscrollenabled"?: boolean;
Expand Down
1 change: 1 addition & 0 deletions pkg/waveobj/metaconsts.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ const (
MetaKey_TermConnDebug = "term:conndebug"
MetaKey_TermBellSound = "term:bellsound"
MetaKey_TermBellIndicator = "term:bellindicator"
MetaKey_TermOsc52 = "term:osc52"
MetaKey_TermDurable = "term:durable"

MetaKey_WebZoom = "web:zoom"
Expand Down
1 change: 1 addition & 0 deletions pkg/waveobj/wtypemeta.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ type MetaTSType struct {
TermConnDebug string `json:"term:conndebug,omitempty"` // null, info, debug
TermBellSound *bool `json:"term:bellsound,omitempty"`
TermBellIndicator *bool `json:"term:bellindicator,omitempty"`
TermOsc52 string `json:"term:osc52,omitempty"`
TermDurable *bool `json:"term:durable,omitempty"`

WebZoom float64 `json:"web:zoom,omitempty"`
Expand Down
1 change: 1 addition & 0 deletions pkg/wconfig/defaultconfig/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"telemetry:enabled": true,
"term:bellsound": false,
"term:bellindicator": false,
"term:osc52": "always",
"term:cursor": "block",
"term:cursorblink": false,
"term:copyonselect": true,
Expand Down
1 change: 1 addition & 0 deletions pkg/wconfig/metaconsts.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const (
ConfigKey_TermCursorBlink = "term:cursorblink"
ConfigKey_TermBellSound = "term:bellsound"
ConfigKey_TermBellIndicator = "term:bellindicator"
ConfigKey_TermOsc52 = "term:osc52"
ConfigKey_TermDurable = "term:durable"

ConfigKey_EditorMinimapEnabled = "editor:minimapenabled"
Expand Down
1 change: 1 addition & 0 deletions pkg/wconfig/settingsconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ type SettingsType struct {
TermCursorBlink *bool `json:"term:cursorblink,omitempty"`
TermBellSound *bool `json:"term:bellsound,omitempty"`
TermBellIndicator *bool `json:"term:bellindicator,omitempty"`
TermOsc52 string `json:"term:osc52,omitempty" jsonschema:"enum=focus,enum=always"`
TermDurable *bool `json:"term:durable,omitempty"`

EditorMinimapEnabled bool `json:"editor:minimapenabled,omitempty"`
Expand Down
7 changes: 7 additions & 0 deletions schema/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,13 @@
"term:bellindicator": {
"type": "boolean"
},
"term:osc52": {
"type": "string",
"enum": [
"focus",
"always"
]
},
"term:durable": {
"type": "boolean"
},
Expand Down