pragma Singleton // Presentation mode: the screen stays on and notifications hold, as one // switch. // // Both halves already exist -- Caffeine inhibits idle, Do Not Disturb quiets // the toasts -- but a person plugging into a projector had to remember to arm // both, every time, and the one they forgot was the one that fired a message // preview onto the big screen. Same record-and-restore idiom as FocusSession: // turning presentation off puts each half back exactly the way it was found, // so a caffeine you had on for your own reasons survives the meeting. import Quickshell import QtQuick Singleton { id: root property bool active: false property bool previousCaffeine: false property bool previousDnd: false function toggle(): void { if (root.active) root.stop(); else root.start(); } function start(): void { if (root.active) return; root.previousCaffeine = Caffeine.enabled; root.previousDnd = Notifs.doNotDisturb; Caffeine.enabled = true; Notifs.doNotDisturb = true; root.active = true; } function stop(): void { if (!root.active) return; Caffeine.enabled = root.previousCaffeine; Notifs.doNotDisturb = root.previousDnd; root.active = false; } }