import Gtk from "gi://Gtk?version=3.0" import GLib from "gi://GLib" import AstalWp from "gi://AstalWp" import { execAsync, Variable, bind } from "astal" import Dropdown from "./Dropdown" import { wifiIcon, WifiSection } from "./Wifi" import { bluetoothIndicator, BluetoothSection } from "./Bluetooth" import { BrightnessRow } from "./Brightness" import { MediaSection } from "./Media" import { batteryIcon, batteryPercent, BatterySection } from "./Battery" import { clearNotifications, dndIcon, DndToggle, history, notifCount, NotificationCard, } from "./Notifications" const speaker = AstalWp.get_default().audio.default_speaker! const mic = AstalWp.get_default().audio.default_microphone const speakerIcon = Variable.derive( [bind(speaker, "volume"), bind(speaker, "mute")], (volume, mute) => { if (mute || volume <= 0.01) return "audio-volume-muted-symbolic" if (volume < 0.20) return "audio-volume-low-symbolic" if (volume < 0.66) return "audio-volume-medium-symbolic" return "audio-volume-high-symbolic" }, ) const micIcon = mic ? Variable.derive([bind(mic, "volume"), bind(mic, "mute")], (volume, mute) => mute || volume <= 0.01 ? "microphone-sensitivity-muted-symbolic" : "microphone-sensitivity-high-symbolic", ) : null const user = GLib.get_user_name() const actions: { icon: string; cmd?: string[] }[] = [ { icon: "emblem-system-symbolic" }, { icon: "system-lock-screen-symbolic", cmd: ["hyprlock"] }, { icon: "weather-clear-night-symbolic", cmd: ["systemctl", "suspend"] }, { icon: "system-reboot-symbolic", cmd: ["systemctl", "reboot"] }, { icon: "system-log-out-symbolic", cmd: ["hyprctl", "dispatch", "exit"] }, { icon: "system-shutdown-symbolic", cmd: ["systemctl", "poweroff"] }, ] function Header() { return (