import type { Monitor } from "@/services/monitors"; import Players from "@/services/players"; import Updates from "@/services/updates"; import { getAppCategoryIcon } from "@/utils/icons"; import { ellipsize } from "@/utils/strings"; import { bindCurrentTime, osIcon } from "@/utils/system"; import { setupCustomTooltip } from "@/utils/widgets"; import type PopupWindow from "@/widgets/popupwindow"; import { execAsync, register, Variable } from "astal"; import { bind, kebabify } from "astal/binding"; import { App, Astal, astalify, Gdk, Gtk, type ConstructProps } from "astal/gtk3"; import { bar as config } from "config"; import AstalBluetooth from "gi://AstalBluetooth"; import AstalHyprland from "gi://AstalHyprland"; import AstalNetwork from "gi://AstalNetwork"; import AstalNotifd from "gi://AstalNotifd"; import AstalTray from "gi://AstalTray"; import AstalWp01 from "gi://AstalWp"; const hyprland = AstalHyprland.get_default(); const hookFocusedClientProp = ( self: any, // Ugh why is there no base Widget type prop: keyof AstalHyprland.Client, callback: (c: AstalHyprland.Client | null) => void ) => { let id: number | null = null; let lastClient: AstalHyprland.Client | null = null; self.hook(hyprland, "notify::focused-client", () => { if (id) lastClient?.disconnect(id); lastClient = hyprland.focusedClient; // Can be null id = lastClient?.connect(`notify::${kebabify(prop)}`, () => callback(lastClient)); callback(lastClient); }); self.connect("destroy", () => id && lastClient?.disconnect(id)); callback(lastClient); }; const togglePopup = (self: JSX.Element, event: Astal.ClickEvent, name: string) => { const popup = App.get_window(name) as PopupWindow | null; if (popup) { if (popup.visible) popup.hide(); else popup.popup_at_widget(self, event); } }; const OSIcon = () => ( ); }; const Workspace = ({ idx }: { idx: number }) => { let wsId = hyprland.focusedWorkspace ? Math.floor((hyprland.focusedWorkspace.id - 1) / config.wsPerGroup) * config.wsPerGroup + idx : idx; return ( ); }; const Tray = () => ( i.length > 0)}> {bind(AstalTray.get_default(), "items").as(i => i.map(TrayItem))} ); const Network = () => ( ); const BluetoothDevice = (device: AstalBluetooth.Device) => ( ); const Bluetooth = () => ( {bind(AstalBluetooth.get_default(), "devices").as(d => d.map(BluetoothDevice))} ); const StatusIcons = () => ( ); const PkgUpdates = () => ( ); const NotifCount = () => ( ); const DateTime = () => ( ); const Power = () => (