From cb617cbb919964630d16a1fe085a6358bfd465b6 Mon Sep 17 00:00:00 2001 From: matt1432 Date: Fri, 27 Sep 2024 21:14:58 -0400 Subject: [PATCH] feat(agsV2): add workspaces and fix types --- lib/mk-types/default.nix | 5 +- lib/mk-types/package-lock.json | Bin 51200 -> 66736 bytes lib/mk-types/package.json | 2 +- .../ags/v2/widgets/bar/fullscreen.tsx | 6 +- .../ags/v2/widgets/bar/items/battery.tsx | 7 +- .../v2/widgets/bar/items/current-client.tsx | 14 +- .../ags/v2/widgets/bar/items/workspaces.tsx | 167 ++++++++++++++++++ nixosModules/ags/v2/widgets/bar/style.scss | 29 ++- nixosModules/ags/v2/widgets/bar/wim.tsx | 5 + 9 files changed, 215 insertions(+), 20 deletions(-) create mode 100644 nixosModules/ags/v2/widgets/bar/items/workspaces.tsx diff --git a/lib/mk-types/default.nix b/lib/mk-types/default.nix index abd74e61..fc397453 100644 --- a/lib/mk-types/default.nix +++ b/lib/mk-types/default.nix @@ -12,7 +12,7 @@ in pname = "${pname}-types"; version = "0.0.0"; - npmDepsHash = "sha256-8De8tRUKzRhD1jyx0anYNPMhxZyIr2nI45HdK6nb8jI="; + npmDepsHash = "sha256-3ll4Xd5F8ZH/7q/gOF0jgerM6QRk71d93XIwtDssfxU="; src = ./.; dontNpmBuild = true; @@ -22,8 +22,7 @@ in ${concatMapStringsSep "\n" (p: "-g ${p.package.dev}/share/gir-1.0 \\") withGirNames} -g ${ts-for-gir-src}/girs \ --ignoreVersionConflicts \ - --package \ - -e gjs -o ./types + -o ./types ''; installPhase = '' diff --git a/lib/mk-types/package-lock.json b/lib/mk-types/package-lock.json index 47c396a27bdef11fbfda9bd4a6204701b2e270db..50c538187628906896b4afe6fb22b0a4db7b4fb6 100644 GIT binary patch delta 7146 zcmai3YmDR8b;fuf-lx6m%{~+F&aRErwpJsOB1LNbT8X42N~E5oB&w}#lA`#MNQ$JM ziC=A6Bu?Piz6~1GZ60WgwrOpzF-6lNh~qTPpY%uK{40v4b$|jz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eH^lih(`5sKcl!6Zcvj5 z9b&>xlgyPXd`?dGU`4gjTwPAjQ>?Ue^H;Vq12?{W3|y?9JGedH7BT-aSCDw;Eboyu zRSNR;fGH1AgLd3pwM#Q9oSDHzO|ewHCP5S;PsbTK$Xe;DpU)e0NWfrC@k0y=8p*cf zCQZ*Ra{^mY5gFE<*)8Y5Z}xr`{9xk(SlxFhe)r;UcWq(w$7hdjW7F=mimj=i&ru?m zHLY$TZ4{X`&gU}&ub&#Ry(vmH!g0tB7>2L*0}HBAuHW-YHAb8by&5G-1)=4^%7BcN zlt2U}VcOaX@#{r6e(S66FM-sH4}-rJF!1#k_k(5OG@pefcfgX2Nt+HUyR@1|m7&$_ zPR#Zg@}~hxO4S@$mno`i`8L&pC7MDC4ZUXK>Yyz)(n{co2H&n1&>j)yvJ_u!r*9pY zIQUjR5kIx@&0X=UuY5lNj@K8#p9~B<_uAq3q056ryyNxvm*VzMezq9z{>3AS`1v=# zv@U7ng3O_@OB#8fYZpkangc<53Sqr){~?A3*g|%0Qf< zVzXM%b=PoA@{`)2GbBj2RZ|O{TBPW91YZ78d*2;|H?NgB#r1>W$s>2)yUo}3T?4Oz zJeQ8Y{lQ-ncV$<>&p*Jyn;-65$j*a*E{~fr{;Wo@{J7hwjChZin`*w+pjfsxteDl1 z3ft@;h4(bdQDwdZAw)XzgT5dulZnw%8%1>x8t}xUNhF=lhWVUBlxyJ0myX5GpZ~QO QKl`^ccf~jV`O}^M0nG^u9{>OV diff --git a/lib/mk-types/package.json b/lib/mk-types/package.json index 3aaa4533..5027ded4 100644 --- a/lib/mk-types/package.json +++ b/lib/mk-types/package.json @@ -1,5 +1,5 @@ { "dependencies": { - "@ts-for-gir/cli": "^3.3.0" + "@ts-for-gir/cli": "4.0.0-beta.16" } } diff --git a/nixosModules/ags/v2/widgets/bar/fullscreen.tsx b/nixosModules/ags/v2/widgets/bar/fullscreen.tsx index 9ae89b65..a73603ca 100644 --- a/nixosModules/ags/v2/widgets/bar/fullscreen.tsx +++ b/nixosModules/ags/v2/widgets/bar/fullscreen.tsx @@ -51,7 +51,10 @@ export default ({ gdkmonitor = Gdk.Display.get_default()?.get_monitor(0) as Gdk.Monitor, child, ...rest -}: Widget.WindowProps) => { +}: { + anchor: Astal.WindowAnchor + gdkmonitor?: Gdk.Monitor +} & Widget.WindowProps) => { const monitor = get_hyprland_monitor_desc(gdkmonitor); const BarVisible = Variable(true); @@ -143,7 +146,6 @@ export default ({ name={`bar-${monitor}`} layer={Astal.Layer.OVERLAY} gdkmonitor={gdkmonitor} - margins={[-1, -1, -1, -1]} anchor={anchor} {...rest} > diff --git a/nixosModules/ags/v2/widgets/bar/items/battery.tsx b/nixosModules/ags/v2/widgets/bar/items/battery.tsx index 2b8c84c8..883ca22d 100644 --- a/nixosModules/ags/v2/widgets/bar/items/battery.tsx +++ b/nixosModules/ags/v2/widgets/bar/items/battery.tsx @@ -1,4 +1,4 @@ -import { bind, Widget } from 'astal'; +import { bind } from 'astal'; import AstalBattery from 'gi://AstalBattery'; const Battery = AstalBattery.get_default(); @@ -7,12 +7,11 @@ import Separator from '../../misc/separator'; const LOW_BATT = 20; -const SPACING = 8; export default () => ( { + setup={(self) => { const update = () => { const percent = Math.round(Battery.get_percentage() * 100); const level = Math.floor(percent / 10) * 10; @@ -37,7 +36,7 @@ export default () => ( }} /> - + diff --git a/nixosModules/ags/v2/widgets/bar/items/current-client.tsx b/nixosModules/ags/v2/widgets/bar/items/current-client.tsx index e355bee0..b25b6f45 100644 --- a/nixosModules/ags/v2/widgets/bar/items/current-client.tsx +++ b/nixosModules/ags/v2/widgets/bar/items/current-client.tsx @@ -1,6 +1,4 @@ -import { bind, Widget } from 'astal'; - -import Pango from 'gi://Pango?version=1.0'; +import { bind } from 'astal'; import AstalApps from 'gi://AstalApps?version=0.1'; const Applications = AstalApps.Apps.new(); @@ -11,8 +9,6 @@ const Hyprland = AstalHyprland.get_default(); import Separator from '../../misc/separator'; -const SPACING = 8; - export default () => { const focused = bind(Hyprland, 'focusedClient'); @@ -23,10 +19,10 @@ export default () => { > { + setup={(self) => { self.hook(Hyprland, 'notify::focused-client', () => { const app = Applications.query( - Hyprland.get_focused_client().get_class(), + Hyprland.get_focused_client()?.get_class() ?? '', false, )[0]; @@ -35,12 +31,12 @@ export default () => { }} /> - + {focused.as((client) => (client && (