Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix(overlay): keep screenpipe mark in expanded toolbar (#6354)

Louis Beaumont95f84e987ea7
diff --git a/apps/screenpipe-app-tauri/app/shortcut-reminder/page.test.tsx b/apps/screenpipe-app-tauri/app/shortcut-reminder/page.test.tsx
index b22305528..770e8be5f 100644
--- a/apps/screenpipe-app-tauri/app/shortcut-reminder/page.test.tsx
+++ b/apps/screenpipe-app-tauri/app/shortcut-reminder/page.test.tsx
@@ -310,14 +310,17 @@ describe("recording health hover detail", () => {
expect(meetingDot.className).toContain("pointer-events-none");
});
- it("offers Wispr-style one-hour hiding and a path to Display settings", async () => {
+ it("keeps the brand mark expanded and opens its options on right-click", async () => {
mocks.getRecordingHealthState.mockResolvedValue("normal");
mocks.storeGet.mockResolvedValue({});
render(<ShortcutReminderPage />);
fireEvent.mouseEnter(await screen.findByTestId("shortcut-reminder-root"));
- fireEvent.click(await screen.findByTitle("Overlay settings"));
+ const brand = await screen.findByTitle("screenpipe — right-click for options");
+ expect(brand).toBeVisible();
+ expect(brand.parentElement?.lastElementChild).toBe(brand);
+ fireEvent.contextMenu(brand);
expect(screen.getByRole("menu", { name: "Shortcut reminder options" })).toBeVisible();
fireEvent.click(screen.getByTitle("Hide for 1 hour"));
@@ -327,9 +330,11 @@ describe("recording health hover detail", () => {
);
fireEvent.mouseEnter(screen.getByTestId("shortcut-reminder-root"));
- fireEvent.click(screen.getByTitle("Overlay settings"));
+ fireEvent.contextMenu(screen.getByTitle("screenpipe — right-click for options"));
fireEvent.click(screen.getByTitle("Open overlay settings"));
expect(mocks.showWindow).toHaveBeenCalledWith({ Home: { page: "display" } });
+ expect(screen.queryByRole("menu", { name: "Shortcut reminder options" })).toBeNull();
+ expect(screen.queryByTitle("Overlay settings")).toBeNull();
});
it("keeps a pinned transcript open after the pointer leaves", async () => {
diff --git a/apps/screenpipe-app-tauri/app/shortcut-reminder/page.tsx b/apps/screenpipe-app-tauri/app/shortcut-reminder/page.tsx
index c1be3bc07..cffc762ac 100644
--- a/apps/screenpipe-app-tauri/app/shortcut-reminder/page.tsx
+++ b/apps/screenpipe-app-tauri/app/shortcut-reminder/page.tsx
@@ -21,7 +21,6 @@ import {
PinOff,
RotateCw,
Search,
- Settings,
Square,
X,
} from "lucide-react";
@@ -689,6 +688,8 @@ export default function ShortcutReminderPage() {
const disclosure = hoveredControl === "search"
? ["search", searchShortcut]
+ : hoveredControl === "brand"
+ ? ["screenpipe", "right-click"]
: hoveredControl === "chat"
? ["ask chat", chatShortcut]
: hoveredControl === "timeline"
@@ -853,18 +854,29 @@ export default function ShortcutReminderPage() {
</div>
<div className="my-1 bg-white/25" style={{ width: "1px" }} />
<button
- title="Overlay settings"
+ title="screenpipe — right-click for options"
+ aria-label="screenpipe — open timeline; right-click for options"
className={dockButtonClass}
style={dockButtonStyle}
- onMouseEnter={() => setHoveredControl("settings")}
+ onMouseEnter={() => setHoveredControl("brand")}
onMouseDown={(e) => e.stopPropagation()}
onPointerDown={(e) => e.stopPropagation()}
- onClick={(e) => {
+ onClick={openTimeline}
+ onContextMenu={(e) => {
+ e.preventDefault();
e.stopPropagation();
- setSettingsOpen((open) => !open);
+ setSettingsOpen(true);
}}
>
- <Settings style={{ width: `${12 * overlayScale}px`, height: `${12 * overlayScale}px` }} />
+ <span
+ aria-hidden="true"
+ className="bg-contain bg-center bg-no-repeat"
+ style={{
+ width: `${12 * overlayScale}px`,
+ height: `${12 * overlayScale}px`,
+ backgroundImage: "url('/32x32.png')",
+ }}
+ />
</button>
</div>
diff --git a/apps/screenpipe-app-tauri/src-tauri/swift/shortcut_reminder.swift b/apps/screenpipe-app-tauri/src-tauri/swift/shortcut_reminder.swift
index 3756da306..22a091fc7 100644
--- a/apps/screenpipe-app-tauri/src-tauri/swift/shortcut_reminder.swift
+++ b/apps/screenpipe-app-tauri/src-tauri/swift/shortcut_reminder.swift
@@ -461,7 +461,7 @@ private let kBaseNotificationW: CGFloat = 340
private let kBaseNotificationH: CGFloat = 34
private let kRestingOpacity: Double = 0.50
private let kAnimDur: Double = 0.2
-private let kDockControls = ["search", "chat", "timeline", "audio", "settings"]
+private let kDockControls = ["search", "chat", "timeline", "audio", "brand"]
/// Convert configured shortcuts to one stable, readable macOS order.
/// Settings historically stored both `Super+Control+…` and
@@ -781,6 +781,31 @@ func overlayHoverRect(
)
}
+func dockControl(
+ at point: NSPoint,
+ in bounds: NSRect,
+ expanded: Bool,
+ disclosureDown: Bool,
+ horizontal: OverlayHorizontal,
+ scale: CGFloat
+) -> (String, Int)? {
+ guard expanded else { return nil }
+ let dock = overlayHoverRect(
+ in: bounds,
+ expanded: true,
+ disclosureDown: disclosureDown,
+ horizontal: horizontal,
+ scale: scale
+ )
+ guard dock.contains(point) else { return nil }
+ let cellWidth = dock.width / CGFloat(kDockControls.count)
+ let index = min(
+ kDockControls.count - 1,
+ max(0, Int((point.x - dock.minX) / cellWidth))
+ )
+ return (kDockControls[index], index)
+}
+
func disclosureContent(
for control: String?,
overlayShortcut: String,
@@ -789,6 +814,7 @@ func disclosureContent(
metrics: OverlayMetrics
) -> (String, String?)? {
switch control {
+ case "brand": return ("screenpipe", "right-click")
case "timeline": return ("timeline", overlayShortcut)
case "chat": return ("ask chat", chatShortcut)
case "search": return ("search", searchShortcut)
@@ -1137,8 +1163,12 @@ struct ShortcutReminderView: View {
Rectangle().fill(.white.opacity(0.28)).frame(width: 1).padding(.vertical, s(4))
- DockIconButton(icon: "gearshape", active: metrics.hoveredControl == "settings", scale: scale) {
- onAction("show_settings_menu")
+ DockAppIconButton(
+ active: metrics.hoveredControl == "brand",
+ meetingActive: metrics.meetingActive,
+ scale: scale
+ ) {
+ onAction("open_timeline")
}
}
.frame(width: kBaseExpandedW * scale, height: kBaseDockH * scale)
@@ -1329,6 +1359,38 @@ private struct DockIconButton: View {
}
}
+@available(macOS 13.0, *)
+private struct DockAppIconButton: View {
+ let active: Bool
+ let meetingActive: Bool
+ let scale: CGFloat
+ let action: () -> Void
+
+ var body: some View {
+ Button(action: action) {
+ ZStack(alignment: .topTrailing) {
+ if let appIcon = NSApp.applicationIconImage {
+ Image(nsImage: appIcon)
+ .resizable()
+ .frame(width: 12 * scale, height: 12 * scale)
+ }
+ if meetingActive {
+ Circle()
+ .fill(Color.red)
+ .frame(width: 4 * scale, height: 4 * scale)
+ .offset(x: 2 * scale, y: -2 * scale)
+ }
+ }
+ .opacity(active ? 1 : 0.78)
+ .frame(maxWidth: .infinity, maxHeight: .infinity)
+ .background(active ? Color.white.opacity(0.14) : Color.clear)
+ .contentShape(Rectangle())
+ }
+ .buttonStyle(.plain)
+ .help("screenpipe — right-click for options")
+ }
+}
+
@available(macOS 13.0, *)
private struct DockStatusCell<Content: View>: View {
let active: Bool
@@ -2114,25 +2176,41 @@ class ShortcutReminderController: NSObject, NSWindowDelegate {
metrics.hoveredControl = nil
return
}
- guard metrics.isHovering, let point = point else {
+ guard metrics.isHovering,
+ let point = point,
+ let bounds = trackingView?.bounds else {
metrics.hoveredControl = nil
return
}
- let cellWidth = (kBaseExpandedW * gOverlayScale) / CGFloat(kDockControls.count)
- let dockHeight = kBaseDockH * gOverlayScale
- let panelHeight = kBaseExpandedH * gOverlayScale
- let pointerIsInDock = metrics.disclosureDown
- ? point.y >= panelHeight - dockHeight
- : point.y <= dockHeight
- guard pointerIsInDock else { return }
- let index = min(kDockControls.count - 1, max(0, Int(point.x / cellWidth)))
- let control = kDockControls[index]
+ guard let (control, index) = dockControl(
+ at: point,
+ in: bounds,
+ expanded: metrics.isHovering || metrics.forceExpanded,
+ disclosureDown: metrics.disclosureDown,
+ horizontal: metrics.horizontal,
+ scale: gOverlayScale
+ ) else { return }
if metrics.hoveredControl != control {
metrics.hoveredControl = control
showDisclosurePanel(for: control, index: index)
}
}
+ private func showShortcutContextMenuIfNeeded(at point: NSPoint) -> Bool {
+ guard let bounds = trackingView?.bounds,
+ let (control, _) = dockControl(
+ at: point,
+ in: bounds,
+ expanded: metrics.isHovering || metrics.forceExpanded,
+ disclosureDown: metrics.disclosureDown,
+ horizontal: metrics.horizontal,
+ scale: gOverlayScale
+ ),
+ control == "brand" else { return false }
+ showShortcutContextMenu(at: point)
+ return true
+ }
+
private func refreshActiveDisclosure() {
guard disclosurePanel?.isVisible == true,
let control = metrics.hoveredControl,
@@ -2795,11 +2873,7 @@ class ShortcutReminderController: NSObject, NSWindowDelegate {
metrics: metrics,
scale: gOverlayScale,
onAction: { [weak self] action in
- if action == "show_settings_menu" {
- self?.showShortcutSettingsMenu()
- } else {
- self?.sendAction(action)
- }
+ self?.sendAction(action)
}
)
let contentView = panel.contentView!
@@ -2840,6 +2914,9 @@ class ShortcutReminderController: NSObject, NSWindowDelegate {
// and rides it in on the settle.
self?.endPillDrag()
}
+ hosting.onRightClick = { [weak self] point in
+ self?.showShortcutContextMenuIfNeeded(at: point) ?? false
+ }
hosting.frame = contentView.bounds
hosting.autoresizingMask = [.width, .height]
contentView.addSubview(hosting)
@@ -3047,7 +3124,7 @@ class ShortcutReminderController: NSObject, NSWindowDelegate {
/// with the durable choice kept in Settings. Using AppKit's menu avoids a
/// second floating panel and inherits keyboard, screen-edge and VoiceOver
/// behavior from macOS.
- private func showShortcutSettingsMenu() {
+ private func showShortcutContextMenu(at point: NSPoint) {
guard let contentView = panel?.contentView else { return }
let menu = NSMenu(title: "shortcut reminder")
menu.autoenablesItems = false
@@ -3073,7 +3150,7 @@ class ShortcutReminderController: NSObject, NSWindowDelegate {
menu.popUp(
positioning: nil,
- at: NSPoint(x: contentView.bounds.maxX - 4, y: contentView.bounds.minY + 4),
+ at: point,
in: contentView
)
}
@@ -3374,6 +3451,9 @@ private class DraggableHostingView<Content: View>: NSHostingView<Content> {
var onDragStarted: (() -> Void)?
/// Called once the user releases, so the controller can snap and persist.
var onDragEnded: (() -> Void)?
+ /// Returns true when the click belonged to the expanded brand control and
+ /// the controller presented its native context menu.
+ var onRightClick: ((NSPoint) -> Bool)?
/// Centre of the visible chip relative to the panel origin. Supplied by the
/// controller because only it knows the current metrics; used to clamp the
/// chip rather than the whole panel, most of which is empty space for the
@@ -3495,6 +3575,11 @@ private class DraggableHostingView<Content: View>: NSHostingView<Content> {
}
}
+ override func rightMouseDown(with event: NSEvent) {
+ if onRightClick?(event.locationInWindow) == true { return }
+ super.rightMouseDown(with: event)
+ }
+
/// Keep the grabbed point of the panel pinned under the cursor, but never
/// let the chip itself leave the desktop. Screen coordinates throughout, so
/// crossing onto another display just works.
diff --git a/apps/screenpipe-app-tauri/src-tauri/swift/shortcut_reminder_tests.swift b/apps/screenpipe-app-tauri/src-tauri/swift/shortcut_reminder_tests.swift
index 94a25eaaa..76616f469 100644
--- a/apps/screenpipe-app-tauri/src-tauri/swift/shortcut_reminder_tests.swift
+++ b/apps/screenpipe-app-tauri/src-tauri/swift/shortcut_reminder_tests.swift
@@ -128,6 +128,65 @@ private func testMarginScales() {
expectClose(top.y, visible.maxY - 8 - 16, "scaled top y")
}
+/// The brand mark stays in the rightmost expanded cell at either screen edge. The
+/// native context-menu handler uses this exact hit test, so a right-click on a
+/// neighboring audio cell must never open the brand menu.
+private func testExpandedBrandCellAtRight() {
+ let bounds = NSRect(x: 0, y: 0, width: 160, height: 62)
+ let topBrand = dockControl(
+ at: NSPoint(x: 145, y: 47),
+ in: bounds,
+ expanded: true,
+ disclosureDown: true,
+ horizontal: .center,
+ scale: 1
+ )
+ expect(topBrand?.0 == "brand" && topBrand?.1 == 4, "brand should be last in top dock")
+
+ let search = dockControl(
+ at: NSPoint(x: 15, y: 47),
+ in: bounds,
+ expanded: true,
+ disclosureDown: true,
+ horizontal: .center,
+ scale: 1
+ )
+ expect(search?.0 == "search" && search?.1 == 0, "search should be first")
+
+ let bottomBrand = dockControl(
+ at: NSPoint(x: 145, y: 15),
+ in: bounds,
+ expanded: true,
+ disclosureDown: false,
+ horizontal: .center,
+ scale: 1
+ )
+ expect(bottomBrand?.0 == "brand", "brand should stay last in bottom dock")
+
+ expect(
+ dockControl(
+ at: NSPoint(x: 145, y: 10),
+ in: bounds,
+ expanded: true,
+ disclosureDown: true,
+ horizontal: .center,
+ scale: 1
+ ) == nil,
+ "disclosure row must not count as the brand cell"
+ )
+ expect(
+ dockControl(
+ at: NSPoint(x: 145, y: 47),
+ in: bounds,
+ expanded: false,
+ disclosureDown: true,
+ horizontal: .center,
+ scale: 1
+ ) == nil,
+ "collapsed pill must not expose the expanded brand menu"
+ )
+}
+
/// Every landing target has to stay inside the visible frame, stay square so
/// it draws as a circle, and stay wide enough to swallow the pill dropped into
/// it. Half the 40pt circle always reaches past the margin plus half the pill,
@@ -446,6 +505,7 @@ struct ShortcutReminderTests {
static func main() {
testAnchorPlacement()
testMarginScales()
+ testExpandedBrandCellAtRight()
testPadStaysOnScreen()
testEdgeCentreSet()
testLegacyCornersMigrate()
diff --git a/crates/screenpipe-overlay-win/src/actions.rs b/crates/screenpipe-overlay-win/src/actions.rs
index 0d43385c9..4a528ed64 100644
--- a/crates/screenpipe-overlay-win/src/actions.rs
+++ b/crates/screenpipe-overlay-win/src/actions.rs
@@ -16,8 +16,8 @@ use crate::state::{Anchor, Control, OverlayState};
pub const NOTIFICATION_ACTION_PREFIX: &str = "notification_action:";
pub const ANCHOR_PREFIX: &str = "set_overlay_anchor:";
pub const MEETING_NOTE_PREFIX: &str = "open_meeting_note:";
-pub const SETTINGS_MENU_HIDE_HOUR: usize = 1;
-pub const SETTINGS_MENU_OPEN_SETTINGS: usize = 2;
+pub const BRAND_CONTEXT_MENU_HIDE_HOUR: usize = 1;
+pub const BRAND_CONTEXT_MENU_OPEN_SETTINGS: usize = 2;
/// The action string for a control, or `None` when the control has nothing to
/// report — either because it is a status cell rather than a button, or because
@@ -26,11 +26,9 @@ pub fn action_for(state: &OverlayState, control: Control) -> Option<String> {
let fixed = match control {
// Clicking the resting chip opens the timeline: the dock owns the other
// destinations, but at rest the pill needs one obvious thing to do.
- Control::Pill | Control::Timeline => "open_timeline",
+ Control::Pill | Control::Brand | Control::Timeline => "open_timeline",
Control::Search => "open_search",
Control::Chat => "open_chat",
- // The native window owns the compact settings menu. Its selected item
- // is translated by `settings_menu_action` below.
Control::Settings => return None,
Control::RestartRecording => "restart_recording",
Control::DismissIncident => "dismiss_incident",
@@ -69,10 +67,10 @@ pub fn action_for(state: &OverlayState, control: Control) -> Option<String> {
/// Translate the native settings-menu command id into the same app actions
/// used by the macOS panel and web fallback.
-pub fn settings_menu_action(command: usize) -> Option<String> {
+pub fn brand_context_menu_action(command: usize) -> Option<String> {
match command {
- SETTINGS_MENU_HIDE_HOUR => Some("dismiss_hour".to_string()),
- SETTINGS_MENU_OPEN_SETTINGS => Some("open_overlay_settings".to_string()),
+ BRAND_CONTEXT_MENU_HIDE_HOUR => Some("dismiss_hour".to_string()),
+ BRAND_CONTEXT_MENU_OPEN_SETTINGS => Some("open_overlay_settings".to_string()),
_ => None,
}
}
@@ -116,6 +114,7 @@ mod tests {
assert_eq!(action_for(&s, Control::Chat).unwrap(), "open_chat");
assert_eq!(action_for(&s, Control::Timeline).unwrap(), "open_timeline");
assert_eq!(action_for(&s, Control::Pill).unwrap(), "open_timeline");
+ assert_eq!(action_for(&s, Control::Brand).unwrap(), "open_timeline");
assert_eq!(action_for(&s, Control::Settings), None);
assert_eq!(
action_for(&s, Control::RestartRecording).unwrap(),
@@ -124,16 +123,16 @@ mod tests {
}
#[test]
- fn settings_menu_matches_the_other_native_overlay() {
+ fn brand_context_menu_matches_the_other_native_overlay() {
assert_eq!(
- settings_menu_action(SETTINGS_MENU_HIDE_HOUR).unwrap(),
+ brand_context_menu_action(BRAND_CONTEXT_MENU_HIDE_HOUR).unwrap(),
"dismiss_hour"
);
assert_eq!(
- settings_menu_action(SETTINGS_MENU_OPEN_SETTINGS).unwrap(),
+ brand_context_menu_action(BRAND_CONTEXT_MENU_OPEN_SETTINGS).unwrap(),
"open_overlay_settings"
);
- assert_eq!(settings_menu_action(99), None);
+ assert_eq!(brand_context_menu_action(99), None);
}
#[test]
diff --git a/crates/screenpipe-overlay-win/src/layout.rs b/crates/screenpipe-overlay-win/src/layout.rs
index 8dc633b54..4cb46f7ea 100644
--- a/crates/screenpipe-overlay-win/src/layout.rs
+++ b/crates/screenpipe-overlay-win/src/layout.rs
@@ -317,14 +317,14 @@ enum Block {
Notification,
}
-/// Three icon buttons, a divider, the audio meter, a divider, settings — the
+/// Three icon buttons, the audio meter, and the rightmost brand control — the
/// dock from `dockView` in shortcut_reminder.swift.
fn dock_cells(dock: Rect, s: f32) -> (Vec<(Control, Rect)>, Vec<Rect>) {
let divider_w = 1.0f32.max(s.round());
let icon_controls = [Control::Search, Control::Chat, Control::Timeline];
// Audio is a status cell, not a button, but it still highlights on hover.
let usable = dock.w - divider_w * 2.0;
- // Five cells: three icons, the meter, settings. The meter gets the same
+ // Five cells: three icons, the meter, and brand. The meter gets the same
// share as an icon so the row reads as evenly spaced.
let cell_w = usable / 5.0;
@@ -342,7 +342,7 @@ fn dock_cells(dock: Rect, s: f32) -> (Vec<(Control, Rect)>, Vec<Rect>) {
dividers.push(Rect::new(x, dock.y + 4.0 * s, divider_w, dock.h - 8.0 * s));
x += divider_w;
cells.push((
- Control::Settings,
+ Control::Brand,
Rect::new(x, dock.y, dock.right() - x, dock.h),
));
(cells, dividers)
@@ -459,6 +459,14 @@ mod tests {
fn every_dock_cell_is_clickable_and_they_tile_the_dock() {
let l = compute(&hovered());
assert_eq!(l.dock_cells.len(), 5);
+ assert_eq!(
+ l.dock_cells.first().map(|(control, _)| *control),
+ Some(Control::Search)
+ );
+ assert_eq!(
+ l.dock_cells.last().map(|(control, _)| *control),
+ Some(Control::Brand)
+ );
let dock = l.primary;
for (_, c) in &l.dock_cells {
assert!(c.y == dock.y && c.h == dock.h);
diff --git a/crates/screenpipe-overlay-win/src/render.rs b/crates/screenpipe-overlay-win/src/render.rs
index 7c001d294..c851ad8e1 100644
--- a/crates/screenpipe-overlay-win/src/render.rs
+++ b/crates/screenpipe-overlay-win/src/render.rs
@@ -431,6 +431,29 @@ impl Renderer {
}
let alpha = if hovered { 1.0 } else { 0.68 };
match control {
+ Control::Brand => {
+ let side = 12.0 * s;
+ let icon_rect = Rect::new(
+ cell.x + (cell.w - side) / 2.0,
+ cell.y + (cell.h - side) / 2.0,
+ side,
+ side,
+ );
+ if let Some(bmp) = self.app_icon(rt) {
+ unsafe {
+ rt.DrawBitmap(
+ &bmp,
+ Some(&d2d_rect(icon_rect)),
+ alpha,
+ D2D1_BITMAP_INTERPOLATION_MODE_LINEAR,
+ None,
+ );
+ }
+ }
+ if state.meeting_active {
+ self.dot(rt, icon_rect.right(), icon_rect.y, 2.0 * s, red(1.0));
+ }
+ }
Control::Search => self.icon(rt, ICON_SEARCH, 10.0 * s, *cell, white(alpha)),
Control::Chat => self.icon(rt, ICON_CHAT, 10.0 * s, *cell, white(alpha)),
Control::Timeline => self.icon(rt, ICON_TIMELINE, 10.0 * s, *cell, white(alpha)),
diff --git a/crates/screenpipe-overlay-win/src/state.rs b/crates/screenpipe-overlay-win/src/state.rs
index 650ad1751..55d6e3346 100644
--- a/crates/screenpipe-overlay-win/src/state.rs
+++ b/crates/screenpipe-overlay-win/src/state.rs
@@ -204,6 +204,7 @@ pub struct OverlayState {
#[serde(rename_all = "snake_case")]
pub enum Control {
Pill,
+ Brand,
Search,
Chat,
Timeline,
diff --git a/crates/screenpipe-overlay-win/src/text.rs b/crates/screenpipe-overlay-win/src/text.rs
index 6e83e7b4b..60c6735fc 100644
--- a/crates/screenpipe-overlay-win/src/text.rs
+++ b/crates/screenpipe-overlay-win/src/text.rs
@@ -63,6 +63,7 @@ pub const MAX_HINT_CHARS: usize = 30;
/// modifier — and a hint that clips teaches the wrong shortcut.
pub fn disclosure_hint(state: &OverlayState) -> String {
let hint = match state.hovered_control {
+ Some(Control::Brand) => "screenpipe · right-click".into(),
Some(Control::Search) => labelled("search", &state.shortcut_search),
Some(Control::Chat) => labelled("chat", &state.shortcut_chat),
Some(Control::Timeline) => labelled("timeline", &state.shortcut_timeline),
@@ -177,6 +178,9 @@ mod tests {
}
s.hovered_control = None;
assert_eq!(disclosure_hint(&s), "hide · alt+O");
+
+ s.hovered_control = Some(Control::Brand);
+ assert_eq!(disclosure_hint(&s), "screenpipe · right-click");
}
#[test]
@@ -207,6 +211,7 @@ mod tests {
let mut s = state();
for control in [
None,
+ Some(Control::Brand),
Some(Control::Search),
Some(Control::Chat),
Some(Control::Timeline),
diff --git a/crates/screenpipe-overlay-win/src/window.rs b/crates/screenpipe-overlay-win/src/window.rs
index b5d0bfbac..e598f8869 100644
--- a/crates/screenpipe-overlay-win/src/window.rs
+++ b/crates/screenpipe-overlay-win/src/window.rs
@@ -50,14 +50,14 @@ use windows::Win32::UI::WindowsAndMessaging::{
CS_VREDRAW, GWLP_USERDATA, HWND_TOPMOST, IDC_ARROW, MF_SEPARATOR, MF_STRING, MSG,
SWP_NOACTIVATE, SWP_NOMOVE, SWP_NOSIZE, SW_HIDE, SW_SHOWNOACTIVATE, TPM_RETURNCMD,
TPM_RIGHTALIGN, TPM_TOPALIGN, ULW_ALPHA, WINDOWPOS, WM_APP, WM_DESTROY, WM_DISPLAYCHANGE,
- WM_DPICHANGED, WM_LBUTTONDOWN, WM_LBUTTONUP, WM_MOUSEMOVE, WM_SETTINGCHANGE, WM_TIMER,
- WM_WINDOWPOSCHANGING, WNDCLASSEXW, WS_EX_LAYERED, WS_EX_NOACTIVATE, WS_EX_TOOLWINDOW,
- WS_EX_TOPMOST, WS_EX_TRANSPARENT, WS_POPUP,
+ WM_DPICHANGED, WM_LBUTTONDOWN, WM_LBUTTONUP, WM_MOUSEMOVE, WM_RBUTTONDOWN, WM_RBUTTONUP,
+ WM_SETTINGCHANGE, WM_TIMER, WM_WINDOWPOSCHANGING, WNDCLASSEXW, WS_EX_LAYERED, WS_EX_NOACTIVATE,
+ WS_EX_TOOLWINDOW, WS_EX_TOPMOST, WS_EX_TRANSPARENT, WS_POPUP,
};
use crate::actions::{
- action_for, anchor_action, settings_menu_action, SETTINGS_MENU_HIDE_HOUR,
- SETTINGS_MENU_OPEN_SETTINGS,
+ action_for, anchor_action, brand_context_menu_action, BRAND_CONTEXT_MENU_HIDE_HOUR,
+ BRAND_CONTEXT_MENU_OPEN_SETTINGS,
};
use crate::anim::Equalizer;
use crate::drag_stage;
@@ -87,16 +87,16 @@ const HOVER_POLL_MS: u32 = 90;
/// Pointer travel before a press on the pill becomes a drag rather than a click.
const DRAG_THRESHOLD: f32 = 4.0;
-/// Show the same two-choice native menu as the macOS overlay. Returning the
-/// selected app action keeps menu presentation inside the Win32 window while
+/// Show the same two-choice brand context menu as the macOS overlay. Returning
+/// the selected app action keeps presentation inside the Win32 window while
/// preserving the cross-platform callback contract.
-unsafe fn show_settings_menu(hwnd: HWND) -> Option<String> {
+unsafe fn show_brand_context_menu(hwnd: HWND) -> Option<String> {
let menu = CreatePopupMenu().ok()?;
let result = (|| {
AppendMenuW(
menu,
MF_STRING,
- SETTINGS_MENU_HIDE_HOUR,
+ BRAND_CONTEXT_MENU_HIDE_HOUR,
w!("Hide for 1 hour"),
)
.ok()?;
@@ -104,7 +104,7 @@ unsafe fn show_settings_menu(hwnd: HWND) -> Option<String> {
AppendMenuW(
menu,
MF_STRING,
- SETTINGS_MENU_OPEN_SETTINGS,
+ BRAND_CONTEXT_MENU_OPEN_SETTINGS,
w!("Settings..."),
)
.ok()?;
@@ -120,7 +120,7 @@ unsafe fn show_settings_menu(hwnd: HWND) -> Option<String> {
hwnd,
None,
);
- settings_menu_action(command.0 as usize)
+ brand_context_menu_action(command.0 as usize)
})();
let _ = DestroyMenu(menu);
result
@@ -1323,11 +1323,7 @@ extern "system" fn wndproc(hwnd: HWND, msg: u32, wparam: WPARAM, lparam: LPARAM)
// Only fire when the release lands on the same control
// the press did — dragging off a button cancels it.
if ctx.layout.hit_test(x, y) == Some(pressed) {
- action = if pressed == Control::Settings {
- show_settings_menu(hwnd)
- } else {
- action_for(&ctx.state, pressed)
- };
+ action = action_for(&ctx.state, pressed);
// Pinning is the overlay's own state, so it is applied
// here rather than reported and echoed back.
if pressed == Control::TranscriptPin {
@@ -1355,6 +1351,22 @@ extern "system" fn wndproc(hwnd: HWND, msg: u32, wparam: WPARAM, lparam: LPARAM)
LRESULT(0)
}
+ WM_RBUTTONDOWN => LRESULT(0),
+
+ WM_RBUTTONUP => {
+ let (x, y) = mouse_dip(hwnd, lparam);
+ let is_brand = ctx_of(hwnd)
+ .is_some_and(|ctx| ctx.layout.hit_test(x, y) == Some(Control::Brand));
+ let action = if is_brand {
+ show_brand_context_menu(hwnd)
+ } else {
+ None
+ };
+ arm_dismiss_timer(hwnd);
+ fire(hwnd, action);
+ LRESULT(0)
+ }
+
WM_TIMER => {
match wparam.0 {
ANIM_TIMER => {
diff --git a/docs/assets/pr/shortcut-overlay-brand-context-menu-linux-web.png b/docs/assets/pr/shortcut-overlay-brand-context-menu-linux-web.png
new file mode 100644
index 000000000..81b20742d
Binary files /dev/null and b/docs/assets/pr/shortcut-overlay-brand-context-menu-linux-web.png differ
diff --git a/docs/assets/pr/shortcut-overlay-brand-context-menu-macos.png b/docs/assets/pr/shortcut-overlay-brand-context-menu-macos.png
new file mode 100644
index 000000000..310202c3a
Binary files /dev/null and b/docs/assets/pr/shortcut-overlay-brand-context-menu-macos.png differ
diff --git a/docs/assets/pr/shortcut-overlay-brand-context-menu-windows-rust.png b/docs/assets/pr/shortcut-overlay-brand-context-menu-windows-rust.png
new file mode 100644
index 000000000..d517a0333
Binary files /dev/null and b/docs/assets/pr/shortcut-overlay-brand-context-menu-windows-rust.png differ