mirror of
https://github.com/tuxdotrs/tpanel.git
synced 2025-10-10 21:01:54 +05:30
feat: add tray and time widget
This commit is contained in:
@@ -33,6 +33,7 @@
|
|||||||
hyprland
|
hyprland
|
||||||
apps
|
apps
|
||||||
battery
|
battery
|
||||||
|
tray
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -51,6 +52,7 @@
|
|||||||
hyprland
|
hyprland
|
||||||
apps
|
apps
|
||||||
battery
|
battery
|
||||||
|
tray
|
||||||
];
|
];
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
@@ -3,6 +3,8 @@ import { FocusedClient, WorkspaceButton } from "./workspace";
|
|||||||
import { Battery } from "./battery";
|
import { Battery } from "./battery";
|
||||||
import { Launcher } from "./launcher";
|
import { Launcher } from "./launcher";
|
||||||
import { Tailscale } from "./tailscale";
|
import { Tailscale } from "./tailscale";
|
||||||
|
import { Tray } from "./tray";
|
||||||
|
import { Time } from "./time";
|
||||||
|
|
||||||
export const WINDOW_NAME = "bar";
|
export const WINDOW_NAME = "bar";
|
||||||
|
|
||||||
@@ -46,6 +48,8 @@ const End = () => {
|
|||||||
<box spacing={15}>
|
<box spacing={15}>
|
||||||
<Tailscale />
|
<Tailscale />
|
||||||
<Battery />
|
<Battery />
|
||||||
|
<Tray />
|
||||||
|
<Time />
|
||||||
</box>
|
</box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
12
widget/bar/time.tsx
Normal file
12
widget/bar/time.tsx
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import { GLib, Variable } from "astal";
|
||||||
|
|
||||||
|
export const Time = () => {
|
||||||
|
const time = Variable("").poll(
|
||||||
|
1000,
|
||||||
|
() => GLib.DateTime.new_now_local().format("%I:%M:%S %p")!,
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<label cssClasses={["time"]} onDestroy={() => time.drop()} label={time()} />
|
||||||
|
);
|
||||||
|
};
|
18
widget/bar/tray.tsx
Normal file
18
widget/bar/tray.tsx
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import { bind } from "astal";
|
||||||
|
import AstalTray from "gi://AstalTray";
|
||||||
|
|
||||||
|
export const Tray = () => {
|
||||||
|
const tray = AstalTray.get_default();
|
||||||
|
|
||||||
|
for (const item of tray.get_items()) {
|
||||||
|
print(item.title);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<box cssClasses={["tray"]}>
|
||||||
|
{bind(tray, "items").as((items) =>
|
||||||
|
items.map((item) => <image gicon={bind(item, "gicon")} />),
|
||||||
|
)}
|
||||||
|
</box>
|
||||||
|
);
|
||||||
|
};
|
Reference in New Issue
Block a user