From a2428b6453dd7f4df78ba6641add74c07623bc33 Mon Sep 17 00:00:00 2001 From: lolostheman Date: Thu, 8 May 2025 16:29:47 -0400 Subject: [PATCH 1/5] typed_ipc: Add duration param to toggle-dnd RendererMessage as well as add new toggle-dnd-request RenderMessage. Introduces an optional duration parameter to the toggle-dnd-request message, enabling the renderer to specify a time value for automatically reverting Do Not Disturb (DND) mode. The toggle-dnd-request event is now used to send this duration from the client to the main process. The toggle-dnd response has been updated to include the duration, allowing the renderer to reflect the timeout state accurately. --- app/common/typed-ipc.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/common/typed-ipc.ts b/app/common/typed-ipc.ts index 269f42984..0700b8eec 100644 --- a/app/common/typed-ipc.ts +++ b/app/common/typed-ipc.ts @@ -69,7 +69,12 @@ export type RendererMessage = { autoHideMenubar: boolean, updateMenu: boolean, ) => void; - "toggle-dnd": (state: boolean, newSettings: Partial) => void; + "toggle-dnd-request": (duration?: number) => void; + "toggle-dnd": ( + state: boolean, + newSettings: Partial, + duration?: number, + ) => void; "toggle-sidebar": (show: boolean) => void; "toggle-silent": (state: boolean) => void; "toggle-tray": (state: boolean) => void; From 65cc1c350dc9045716f247219dcf00fd1fb9b4de Mon Sep 17 00:00:00 2001 From: lolostheman Date: Thu, 8 May 2025 16:41:24 -0400 Subject: [PATCH 2/5] tooltips: Add HTML structure and CSS for DND duration dropdown. Introduces a hidden dropdown menu with preset duration options and accompanying styles. This prepares the UI for timed DND selection. --- app/renderer/css/main.css | 25 +++++++++++++++++++++++++ app/renderer/js/main.ts | 17 +++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/app/renderer/css/main.css b/app/renderer/css/main.css index a796921f8..a117dcebb 100644 --- a/app/renderer/css/main.css +++ b/app/renderer/css/main.css @@ -386,6 +386,31 @@ webview.focus { font-size: 14px; } +.dnd-dropdown { + position: absolute; + left: 60px; + background-color: rgb(32 33 36 / 100%); /* closer to Zulip's sidebars */ + border: 1px solid rgb(60 60 60 / 100%); + border-radius: 8px; + color: rgb(240 240 240 / 100%); + z-index: 1000; + padding: 4px 0; + font-size: 13px; + font-family: arial, sans-serif; + min-width: 150px; + box-shadow: 0 4px 12px rgb(0 0 0 / 40%); +} + +.dnd-dropdown-item { + padding: 8px 16px; + cursor: pointer; + transition: background-color 0.15s ease; +} + +.dnd-dropdown-item:hover { + background-color: rgb(60 60 60 / 100%); +} + #loading-tooltip::after, #dnd-tooltip::after, #back-tooltip::after, diff --git a/app/renderer/js/main.ts b/app/renderer/js/main.ts index 861074738..200db88aa 100644 --- a/app/renderer/js/main.ts +++ b/app/renderer/js/main.ts @@ -1215,6 +1215,23 @@ window.addEventListener("load", async () => { >${t.__("Do Not Disturb")} +