feat: add command center launcher

This commit is contained in:
tux
2025-09-25 19:31:12 +05:30
parent 056afad5ac
commit 978f15c305
4 changed files with 25 additions and 7 deletions

View File

@@ -29,7 +29,7 @@ export const Bar = (gdkmonitor: Gdk.Monitor) => {
>
<centerbox>
<box spacing={10} $type="start">
<Launcher />
<Launcher windowName="launcher" icon="nix-symbolic" />
<WorkspaceButton />
</box>
@@ -47,6 +47,7 @@ export const Bar = (gdkmonitor: Gdk.Monitor) => {
<Battery />
<Tray />
<Time />
<Launcher windowName="control-center" icon="fa-ghost-symbolic" />
</box>
</centerbox>
</window>

View File

@@ -1,15 +1,23 @@
import { Gdk } from "ags/gtk4";
import app from "ags/gtk4/app";
import { WINDOW_NAME } from "../launcher";
import { WINDOW_NAME as APP_LAUNCHER_WINDOW_NAME } from "../launcher";
import { WINDOW_NAME as CONTROL_CENTER_WINDOW_NAME } from "../control-center";
export const Launcher = () => {
type Props = {
icon: string;
windowName:
| typeof APP_LAUNCHER_WINDOW_NAME
| typeof CONTROL_CENTER_WINDOW_NAME;
};
export const Launcher = ({ icon, windowName }: Props) => {
return (
<button
cssClasses={["pill", "launcher"]}
onClicked={() => app.toggle_window(WINDOW_NAME)}
cssClasses={["launcher"]}
onClicked={() => app.toggle_window(windowName)}
cursor={Gdk.Cursor.new_from_name("pointer", null)}
>
<image iconName="nix-symbolic" />
<image iconName={icon} />
</button>
);
};