Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
43587bb
fix(linux): write gnome-copied-files with LF-only lines
t8y2 Nov 30, 2026
1d06437
fix(tooltip): show a control's tooltip while it is disabled
t8y2 Nov 30, 2026
0232cfc
feat(clipboard): add sensitive clipboard write with guarded clear
Ezreal-byte Nov 30, 2026
51ed458
feat(base): page a scrollbar by holding its track
xiaou61 Nov 30, 2026
253b195
fix(toast): align icon and close with the title, round error icon, 16…
t8y2 Nov 30, 2026
688fd44
fix(darwin): tag the Metal layer with the sRGB color space
t8y2 Nov 30, 2026
b7bebfc
feat(app): list monitors and make a window fullscreen across all of them
t8y2 Nov 30, 2026
1a3ccc2
fix(windows): build transparent AND mask for 32bpp status icons
imjakey Nov 30, 2026
58a6fc6
fix(ui): keep icon room on menu rows without an icon
xiaoyumuxi Nov 30, 2026
08dc2ed
feat(app): route status item primary click to OnClick, secondary to menu
imjakey Nov 30, 2026
0061936
fix(darwin): end the composition when the input method empties its mark
t8y2 Nov 30, 2026
0800564
fix(theme): draw keyboard focus rings 2px wide from one metric
t8y2 Nov 30, 2026
450e38c
docs(release): v0.6.11 notes
t8y2 Nov 30, 2026
91ca1be
feat(ui): show initial button focus and navigate dialog footers with …
ken0912 Nov 30, 2026
c8c7509
feat(components): divide a window between docked panels and its content
t8y2 Nov 30, 2026
60db7ee
fix(components): keep a focused text caret blinking in the active window
t8y2 Nov 30, 2026
c192baf
feat(dialog): give footer buttons a 64pt minimum width
t8y2 Nov 30, 2026
5b13774
fix(components): draw a focused text field's border in the ring color
t8y2 Nov 30, 2026
db30ada
fix(gfx): act on a double click only on every second press
t8y2 Dec 1, 2026
ebbda71
fix(ui): install the scrollbar painter for Tree
t8y2 Dec 1, 2026
dd0526b
fix(ui): open a popover's controls above its panel
t8y2 Dec 1, 2026
8b61ae9
fix(darwin): preserve transparent window opacity through rendering
t8y2 Dec 1, 2026
64f7bde
feat(markdown): align wrapped heading lines
caichangqing1120 Dec 1, 2026
f5f6eeb
fix(linux): replace invalid UTF-8 in text labels instead of failing t…
t8y2 Dec 1, 2026
e50587b
Merge remote-tracking branch 'origin/main' into sync/upstream-f5f6eebd
xiaoyumuxi Dec 1, 2026
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
37 changes: 28 additions & 9 deletions app/application_native.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ type resultWindow struct {
// always-on-top, or shortcut capture support.
var _ platform.WindowSizer = resultWindow{}
var _ fullscreenControl = resultWindow{}
var _ monitorControl = resultWindow{}
var _ alwaysOnTopControl = resultWindow{}
var _ shortcutCapturer = resultWindow{}
var _ titleControl = resultWindow{}
Expand Down Expand Up @@ -136,6 +137,22 @@ func (window resultWindow) Fullscreen() bool {
return ok && control.Fullscreen()
}

func (window resultWindow) Monitors() ([]platform.Monitor, error) {
control, ok := window.WindowControl.(monitorControl)
if !ok {
return nil, platform.ErrFullscreenAllMonitorsUnsupported
}
return control.Monitors()
}

func (window resultWindow) SetFullscreenAllMonitors(fullscreen bool) error {
control, ok := window.WindowControl.(monitorControl)
if !ok {
return platform.ErrFullscreenAllMonitorsUnsupported
}
return control.SetFullscreenAllMonitors(fullscreen)
}

func (window resultWindow) SetTitle(title string) error {
control, ok := window.WindowControl.(titleControl)
if !ok {
Expand Down Expand Up @@ -242,19 +259,21 @@ func (host nativeHost) AddStatusItem(config StatusItemConfig) (StatusItemControl
if config.Menu != nil {
menu = func() []platform.MenuItem { return platformMenu(config.Menu()) }
}
var onClick func(platform.StatusClick)
if config.OnClick != nil {
onClick = func(click platform.StatusClick) {
config.OnClick(StatusClick{
Button: click.Button,
Anchor: StatusAnchor{rect: click.Anchor, set: true},
PanelDismissed: click.PanelDismissed,
})
}
}
item, err := host.native.AddStatusItem(platform.StatusItemConfig{
Tooltip: config.Tooltip,
Icon: config.Icon.platform(),
Menu: menu,
OnClick: func(click platform.StatusClick) {
if config.OnClick != nil {
config.OnClick(StatusClick{
Button: click.Button,
Anchor: StatusAnchor{rect: click.Anchor, set: true},
PanelDismissed: click.PanelDismissed,
})
}
},
OnClick: onClick,
})
if err != nil {
return nil, err
Expand Down
5 changes: 5 additions & 0 deletions app/capabilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ const (
// program with administrator rights after the system's consent prompt.
// Only Windows has one.
CapabilityElevatedLaunch
// CapabilityClipboardSensitive means SetSensitiveClipboardText can mark
// copied text for exclusion from clipboard history, cloud sync and clipboard
// managers, and clear it again by clipboard sequence or ownership without
// reading the plaintext back.
CapabilityClipboardSensitive
)

// Capabilities is a set of platform integrations.
Expand Down
1 change: 1 addition & 0 deletions app/capabilities_native.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,6 @@ func nativeCapabilities() Capabilities {
capabilities |= CapabilityWindowMaximize
}
capabilities |= capabilityTransparentWindow | capabilityNotificationActivation | capabilityWindowWatermark | capabilityElevatedLaunch
capabilities |= clipboardSensitiveCapability()
return Capabilities(capabilities)
}
3 changes: 3 additions & 0 deletions app/capabilities_native_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ func TestDesktopCapabilitiesKeepSynchronousIntegrations(t *testing.T) {
if !Supports(CapabilityClipboardText) {
t.Fatal("desktop reports no synchronous clipboard text")
}
if !Supports(CapabilityClipboardSensitive) {
t.Fatal("desktop reports no sensitive clipboard support")
}
if Supports(CapabilityNotificationPermission) {
t.Fatal("desktop reports a browser-style notification permission request")
}
Expand Down
3 changes: 3 additions & 0 deletions app/capabilities_web_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ func TestWebCapabilitiesExposeAsyncNotSynchronousSystemAPIs(t *testing.T) {
if Supports(CapabilityClipboardText) {
t.Fatal("the browser reports synchronous clipboard text support")
}
if Supports(CapabilityClipboardSensitive) {
t.Fatal("the browser reports sensitive clipboard support")
}
if !Supports(CapabilityClipboardTextAsync) {
t.Fatal("the browser reports no asynchronous clipboard text support")
}
Expand Down
15 changes: 15 additions & 0 deletions app/capability_clipboard_sensitive_linux.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//go:build linux && !android

package app

import linuxplatform "github.com/vivaui/viva/internal/platform/linux"

// clipboardSensitiveCapability follows what the running Linux shell can do: the
// GTK shell without gtk_clipboard_set_with_data cannot advertise the password
// manager hint, so SetSensitiveClipboardText would only return ErrUnsupported.
func clipboardSensitiveCapability() Capability {
if linuxplatform.SupportsSensitiveClipboard() {
return CapabilityClipboardSensitive
}
return 0
}
7 changes: 7 additions & 0 deletions app/capability_clipboard_sensitive_native.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//go:build (darwin && !ios) || windows

package app

// clipboardSensitiveCapability reports that SetSensitiveClipboardText can mark
// its copy on this desktop.
func clipboardSensitiveCapability() Capability { return CapabilityClipboardSensitive }
5 changes: 5 additions & 0 deletions app/capability_clipboard_sensitive_other.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//go:build (!darwin || ios) && !windows && (!linux || android)

package app

func clipboardSensitiveCapability() Capability { return 0 }
81 changes: 81 additions & 0 deletions app/clipboard_sensitive.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package app

import (
"errors"
"fmt"
"strings"
"sync"
)

// SetSensitiveClipboardText puts secret text on the system clipboard marked so
// clipboard history, cloud clipboard sync and clipboard managers do not record
// it, and returns clear, which empties the clipboard if and only if nothing has
// changed it since this write.
//
// Each desktop marks the copy with the conventions its clipboard managers and
// operating system honour:
// - macOS prepares NSPasteboard with NSPasteboardContentsCurrentHostOnly (kept
// off Universal Clipboard) and adds org.nspasteboard.ConcealedType and
// org.nspasteboard.TransientType beside NSPasteboardTypeString; clear checks
// NSPasteboard.changeCount.
// - Windows writes ExcludeClipboardContentFromMonitorProcessing,
// CanIncludeInClipboardHistory (DWORD 0) and CanUploadToCloudClipboard
// (DWORD 0) in the same clipboard transaction as CF_UNICODETEXT; clear
// checks GetClipboardSequenceNumber while holding the open clipboard.
// - Linux advertises x-kde-passwordManagerHint ("secret") beside UTF8_STRING,
// skips CLIPBOARD_MANAGER hand-off when the owning window closes, and checks
// selection ownership and write generation in clear (or GTK's clipboard
// clear callback under the GTK shell).
//
// Neither SetSensitiveClipboardText nor clear reads clipboard plaintext back.
// Calling clear more than once is harmless: once a call has settled the outcome
// (the clipboard was emptied, or was found changed) later calls report
// (false, nil). A call that fails with an error settles nothing, so clear may be
// called again to retry and the secret is not stranded by a transient failure
// such as a busy clipboard.
//
// Empty strings and strings containing NUL are rejected before touching the
// clipboard. Targets that cannot attach concealment metadata or verify clipboard
// identity without reading the text back (including browsers) return an error
// wrapping ErrUnsupported.
func SetSensitiveClipboardText(value string) (clear func() (cleared bool, err error), err error) {
if value == "" {
return nil, errors.New("app: sensitive clipboard text is empty")
}
if strings.IndexByte(value, 0) >= 0 {
return nil, fmt.Errorf("app: clipboard text contains NUL")
}
if clearFn, err, handled := driverSetSensitiveClipboardText(value); handled {
if err != nil {
return nil, err
}
return onceClear(clearFn), nil
}
clearFn, err := nativeSetSensitiveClipboardText(value)
if err != nil {
return nil, err
}
return onceClear(clearFn), nil
}

// onceClear makes clearFn idempotent once it reaches a terminal result: it
// emptied the clipboard, or it found the clipboard already changed. An error is
// not terminal, so the next call runs clearFn again. Calls are serialized.
func onceClear(clearFn func() (bool, error)) func() (bool, error) {
var (
mu sync.Mutex
done bool
)
return func() (bool, error) {
mu.Lock()
defer mu.Unlock()
if done || clearFn == nil {
return false, nil
}
cleared, err := clearFn()
if err == nil || cleared {
done = true
}
return cleared, err
}
}
9 changes: 9 additions & 0 deletions app/clipboard_sensitive_darwin.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//go:build darwin && !ios

package app

import darwinplatform "github.com/vivaui/viva/internal/platform/darwin"

func nativeSetSensitiveClipboardText(value string) (func() (bool, error), error) {
return darwinplatform.SetSensitiveClipboardText(value)
}
16 changes: 16 additions & 0 deletions app/clipboard_sensitive_linux.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//go:build linux && !android

package app

import linuxplatform "github.com/vivaui/viva/internal/platform/linux"

func nativeSetSensitiveClipboardText(value string) (func() (bool, error), error) {
clearFn, err := linuxplatform.SetSensitiveClipboardText(value)
if err != nil {
return nil, linuxSystemError(err)
}
return func() (bool, error) {
cleared, clearErr := clearFn()
return cleared, linuxSystemError(clearErr)
}, nil
}
51 changes: 51 additions & 0 deletions app/clipboard_sensitive_once_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package app

import (
"errors"
"testing"
)

// A clear that fails must stay retryable so the secret is not stranded on the
// clipboard; once it reaches a terminal result it must not run again.
func TestOnceClearRetriesAfterErrorThenIsIdempotent(t *testing.T) {
busy := errors.New("clipboard busy")
results := []struct {
cleared bool
err error
}{{false, busy}, {false, busy}, {true, nil}}
calls := 0
clear := onceClear(func() (bool, error) {
result := results[calls]
calls++
return result.cleared, result.err
})

for attempt := 0; attempt < 2; attempt++ {
if cleared, err := clear(); cleared || !errors.Is(err, busy) {
t.Fatalf("attempt %d: cleared=%v err=%v, want false, busy", attempt, cleared, err)
}
}
if cleared, err := clear(); !cleared || err != nil {
t.Fatalf("retry: cleared=%v err=%v, want true, nil", cleared, err)
}
if cleared, err := clear(); cleared || err != nil {
t.Fatalf("after success: cleared=%v err=%v, want false, nil", cleared, err)
}
if calls != 3 {
t.Fatalf("underlying clear ran %d times, want 3", calls)
}
}

// Finding the clipboard already changed is terminal too.
func TestOnceClearSettlesWhenClipboardChanged(t *testing.T) {
calls := 0
clear := onceClear(func() (bool, error) { calls++; return false, nil })
for range 3 {
if cleared, err := clear(); cleared || err != nil {
t.Fatalf("cleared=%v err=%v, want false, nil", cleared, err)
}
}
if calls != 1 {
t.Fatalf("underlying clear ran %d times, want 1", calls)
}
}
7 changes: 7 additions & 0 deletions app/clipboard_sensitive_other.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//go:build (!darwin || ios) && !windows && (!linux || android)

package app

func nativeSetSensitiveClipboardText(string) (func() (bool, error), error) {
return nil, ErrUnsupported
}
Loading
Loading