From 7f729d18d9d85f914b6cb1f4df81207caeee4b61 Mon Sep 17 00:00:00 2001 From: Jasper Ras Date: Thu, 28 Nov 2024 10:03:42 +0100 Subject: init --- widget/Bar.tsx | 162 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 widget/Bar.tsx (limited to 'widget/Bar.tsx') diff --git a/widget/Bar.tsx b/widget/Bar.tsx new file mode 100644 index 0000000..efc065a --- /dev/null +++ b/widget/Bar.tsx @@ -0,0 +1,162 @@ +import { App } from "astal/gtk3" +import { Variable, GLib, bind } from "astal" +import { Astal, Gtk, Gdk } from "astal/gtk3" +import Hyprland from "gi://AstalHyprland" +import Mpris from "gi://AstalMpris" +import Battery from "gi://AstalBattery" +import Wp from "gi://AstalWp" +import Network from "gi://AstalNetwork" +import Tray from "gi://AstalTray" + +function SysTray() { + const tray = Tray.get_default() + + return + {bind(tray, "items").as(items => items.map(item => { + if (item.iconThemePath) + App.add_icons(item.iconThemePath) + + const menu = item.create_menu() + + return + }))} + +} + +function Wifi() { + const { wifi } = Network.get_default() + + return +} + +function AudioSlider() { + const speaker = Wp.get_default()?.audio.defaultSpeaker! + + return + + speaker.volume = value} + value={bind(speaker, "volume")} + /> + +} + +function BatteryLevel() { + const bat = Battery.get_default() + + return + + +} + +function Media() { + const mpris = Mpris.get_default() + + return + {bind(mpris, "players").as(ps => ps[0] ? ( + + + `background-image: url('${cover}');` + )} + /> + + ) : ( + "Nothing Playing" + ))} + +} + +function Workspaces() { + const hypr = Hyprland.get_default() + + return + {bind(hypr, "workspaces").as(wss => wss + .sort((a, b) => a.id - b.id) + .map(ws => ( + + )) + )} + +} + +function FocusedClient() { + const hypr = Hyprland.get_default() + const focused = bind(hypr, "focusedClient") + + return + {focused.as(client => ( + client && +} + +function Time({ format = "%H:%M - %A %e." }) { + const time = Variable("").poll(1000, () => + GLib.DateTime.new_now_local().format(format)!) + + return