[AGS] Save for migration to GTK4

This commit is contained in:
Janis Hutz 2025-04-21 17:26:52 +02:00
parent f4b259dd13
commit 7380c75818
4 changed files with 30 additions and 5 deletions

View File

@ -2,6 +2,7 @@ import { Astal, Gdk, Gtk } from "astal/gtk3";
import Hyprland from "./modules/Hyprland"; import Hyprland from "./modules/Hyprland";
import Calendar from "./modules/Calendar"; import Calendar from "./modules/Calendar";
import QuickView from "./modules/QuickView"; import QuickView from "./modules/QuickView";
import SystemInfo from "./modules/SystemInfo";
const Bar = (gdkmonitor: Gdk.Monitor) => { const Bar = (gdkmonitor: Gdk.Monitor) => {
const { TOP, LEFT, RIGHT } = Astal.WindowAnchor; const { TOP, LEFT, RIGHT } = Astal.WindowAnchor;
@ -14,6 +15,7 @@ const Bar = (gdkmonitor: Gdk.Monitor) => {
<box orientation={Gtk.Orientation.HORIZONTAL} spacing={10}> <box orientation={Gtk.Orientation.HORIZONTAL} spacing={10}>
<box hexpand halign={Gtk.Align.START}> <box hexpand halign={Gtk.Align.START}>
<Calendar.Time /> <Calendar.Time />
<SystemInfo.SystemInfo />
<Hyprland.Workspace /> <Hyprland.Workspace />
</box> </box>
<Hyprland.ActiveWindow /> <Hyprland.ActiveWindow />

View File

@ -11,6 +11,10 @@ const Time = ({ format = "%a, %e.%m %H:%M:%S" }) => {
/> />
} }
const Calendar = () => {
}
export default { export default {
Time Time

View File

@ -1,5 +1,5 @@
import AstalTray from "gi://AstalTray"; import AstalTray from "gi://AstalTray";
import { bind } from "astal"; import { bind, Variable } from "astal";
import AstalHyprland from "gi://AstalHyprland"; import AstalHyprland from "gi://AstalHyprland";
const SysTray = () => { const SysTray = () => {
@ -42,14 +42,25 @@ const Workspace = () => {
const ActiveWindow = () => { const ActiveWindow = () => {
const hypr = AstalHyprland.get_default(); const hypr = AstalHyprland.get_default();
const focused = bind( hypr, "focusedClient" ); const focused = bind( hypr, "focusedClient" );
let visible = Variable( false );
const toggleOverlay = () => {
visible.set( !visible.get() );
}
return <box className={"HyprlandFocusedClients"} visible={focused.as(Boolean)}> return <box className={"HyprlandFocusedClients"} visible={focused.as(Boolean)}>
{focused.as( client => ( <button onClicked={toggleOverlay}>
client && <label label={bind( client, "title" ).as( String )} /> {focused.as( client => (
))} client && <label label={bind( client, "title" ).as( String )} />
))}
</button>
<eventbox visible={bind(visible).as( v => v )} name="popover-container">
<label label="This is a test"></label>
</eventbox>
</box> </box>
} }
export default { export default {
Workspace, Workspace,
ActiveWindow, ActiveWindow,

View File

@ -17,6 +17,9 @@ const featureTest = () => {
availableFeatures.cpu = false; availableFeatures.cpu = false;
printerr( '[ SysInfo ] Feature Test for CPU info failed. mpstat from the sysstat package missing!' ); printerr( '[ SysInfo ] Feature Test for CPU info failed. mpstat from the sysstat package missing!' );
} }
// Screen brightness... CTL might be available, but no screen controllable
// Battery... acpi might be present, but potentially no bat
} }
let enabled = false; let enabled = false;
@ -52,5 +55,10 @@ const sysInfoFetcher = () => {
const SystemInfo = () => { const SystemInfo = () => {
return <box></box>
}
export default {
SystemInfo
} }