import { bind, idle, timeout, Variable } from 'astal'; import { App, Astal, Gdk, Gtk, Widget } from 'astal/gtk3'; import { register } from 'astal/gobject'; import AstalAuth from 'gi://AstalAuth'; import Lock from 'gi://GtkSessionLock'; import Separator from '../misc/separator'; import { get_hyprland_monitor_desc } from '../../lib'; // This file is generated by Nix import Vars from './vars'; /* Types */ declare global { function authFinger(): void; } @register() class BlurredBox extends Widget.Box { geometry = {} as { w: number, h: number }; } export default () => { const windows = new Map(); const blurBGs: BlurredBox[] = []; const transition_duration = 1000; const WINDOW_MARGINS = -2; const ENTRY_SPACING = 20; const CLOCK_SPACING = 60; const bgCSS = ({ w = 1, h = 1 } = {}) => ` border: 2px solid rgba(189, 147, 249, 0.8); background: rgba(0, 0, 0, 0.2); min-height: ${h}px; min-width: ${w}px; transition: min-height ${transition_duration / 2}ms, min-width ${transition_duration / 2}ms; `; const lock = Lock.prepare_lock(); const unlock = () => { blurBGs.forEach((b) => { b.css = bgCSS({ w: b.geometry.w, h: 1, }); timeout(transition_duration / 2, () => { b.css = bgCSS({ w: 1, h: 1, }); }); }); timeout(transition_duration, () => { lock.unlock_and_destroy(); Gdk.Display.get_default()?.sync(); App.quit(); }); }; const Clock = () => { const time = Variable('').poll(1000, () => { return (new Date().toLocaleString([], { hour: 'numeric', minute: 'numeric', hour12: true, }) ?? '') .replace('a.m.', 'AM') .replace('p.m.', 'PM'); }); return (