From 78206a4311dea6902d83cc174477f72cd758266e Mon Sep 17 00:00:00 2001 From: matt1432 Date: Fri, 11 Oct 2024 14:43:42 -0400 Subject: [PATCH] feat(agsV2): fix breaking changes and add bg-fade --- nixosModules/ags/v2/app.ts | 2 ++ .../ags/v2/widgets/bar/fullscreen.tsx | 7 ++++-- .../ags/v2/widgets/bar/items/workspaces.tsx | 10 ++++---- nixosModules/ags/v2/widgets/bar/wim.tsx | 1 - nixosModules/ags/v2/widgets/bg-fade/main.tsx | 24 +++++++++++++++++++ 5 files changed, 35 insertions(+), 9 deletions(-) create mode 100644 nixosModules/ags/v2/widgets/bg-fade/main.tsx diff --git a/nixosModules/ags/v2/app.ts b/nixosModules/ags/v2/app.ts index 5b914671..4723f1f8 100644 --- a/nixosModules/ags/v2/app.ts +++ b/nixosModules/ags/v2/app.ts @@ -3,6 +3,7 @@ import { App } from 'astal'; import style from './style.scss'; import Bar from './widgets/bar/wim'; +import BgFade from './widgets/bg-fade/main'; App.start({ @@ -10,5 +11,6 @@ App.start({ main: () => { Bar(); + BgFade(); }, }); diff --git a/nixosModules/ags/v2/widgets/bar/fullscreen.tsx b/nixosModules/ags/v2/widgets/bar/fullscreen.tsx index a73603ca..17e9dc10 100644 --- a/nixosModules/ags/v2/widgets/bar/fullscreen.tsx +++ b/nixosModules/ags/v2/widgets/bar/fullscreen.tsx @@ -19,11 +19,14 @@ Hyprland.connect('event', () => { m1.size === m2.size && Array.from(m1.keys()).every((key) => m1.get(key) === m2.get(key)); + const newMonitors = JSON.parse(Hyprland.message('j/monitors')) as AstalHyprland.Monitor[]; + const fs = FullscreenState.get(); const fsClients = Hyprland.get_clients().filter((c) => { - const mon = c.get_monitor(); + const mon = newMonitors.find((monitor) => monitor.id === c.get_monitor().id); - return c.fullscreen && c.workspace.id === mon?.activeWorkspace.id; + return c.fullscreenClient !== 0 && + c.workspace.id === mon?.activeWorkspace.id; }); const monitors = fsClients.map((c) => diff --git a/nixosModules/ags/v2/widgets/bar/items/workspaces.tsx b/nixosModules/ags/v2/widgets/bar/items/workspaces.tsx index 0546411b..3b866b10 100644 --- a/nixosModules/ags/v2/widgets/bar/items/workspaces.tsx +++ b/nixosModules/ags/v2/widgets/bar/items/workspaces.tsx @@ -26,21 +26,19 @@ const Workspace = ({ id = 0 }) => ( setup={(self) => idle(() => { const update = ( _: Widget.Box, - addr?: string, + client?: AstalHyprland.Client, ) => { const workspace = Hyprland.get_workspace(id); const occupied = workspace && workspace.get_clients().length > 0; self.toggleClassName('occupied', occupied); - if (!addr) { + if (!client) { return; } - // Deal with urgent windows - const client = Hyprland.get_client(addr); const isThisUrgent = client && - client.workspace.id === id; + client.get_workspace().get_id() === id; if (isThisUrgent) { self.toggleClassName('urgent', true); @@ -55,7 +53,7 @@ const Workspace = ({ id = 0 }) => ( }; self - .hook(Hyprland, 'event', update) + .hook(Hyprland, 'event', () => update(self)) // Deal with urgent windows .hook(Hyprland, 'urgent', update) diff --git a/nixosModules/ags/v2/widgets/bar/wim.tsx b/nixosModules/ags/v2/widgets/bar/wim.tsx index 2ad3c8b6..28ddf1b6 100644 --- a/nixosModules/ags/v2/widgets/bar/wim.tsx +++ b/nixosModules/ags/v2/widgets/bar/wim.tsx @@ -18,7 +18,6 @@ export default () => ( Astal.WindowAnchor.RIGHT } > - diff --git a/nixosModules/ags/v2/widgets/bg-fade/main.tsx b/nixosModules/ags/v2/widgets/bg-fade/main.tsx new file mode 100644 index 00000000..c30dc90f --- /dev/null +++ b/nixosModules/ags/v2/widgets/bg-fade/main.tsx @@ -0,0 +1,24 @@ +import { Astal } from 'astal'; + + +export default () => { + return ( + + ); +};