From 362bc7314d6ea413a2d5f524f44f54930ab1a67f Mon Sep 17 00:00:00 2001 From: matt1432 Date: Wed, 1 Jan 2025 02:55:15 -0500 Subject: [PATCH] feat(ags4): start subclassing widgets --- modules/ags/gtk4/app.ts | 2 +- modules/ags/gtk4/widget/{Bar.tsx => bar.tsx} | 13 +- modules/ags/gtk4/widget/styled-box.ts | 34 --- .../ags/gtk4/widget/subclasses/astalify.ts | 272 ++++++++++++++++++ modules/ags/gtk4/widget/subclasses/box.ts | 25 ++ modules/ags/gtk4/widget/subclasses/button.ts | 21 ++ .../ags/gtk4/widget/subclasses/centerbox.ts | 29 ++ modules/ags/gtk4/widget/subclasses/index.ts | 3 + 8 files changed, 357 insertions(+), 42 deletions(-) rename modules/ags/gtk4/widget/{Bar.tsx => bar.tsx} (83%) delete mode 100644 modules/ags/gtk4/widget/styled-box.ts create mode 100644 modules/ags/gtk4/widget/subclasses/astalify.ts create mode 100644 modules/ags/gtk4/widget/subclasses/box.ts create mode 100644 modules/ags/gtk4/widget/subclasses/button.ts create mode 100644 modules/ags/gtk4/widget/subclasses/centerbox.ts create mode 100644 modules/ags/gtk4/widget/subclasses/index.ts diff --git a/modules/ags/gtk4/app.ts b/modules/ags/gtk4/app.ts index 85ac427c..5a499189 100644 --- a/modules/ags/gtk4/app.ts +++ b/modules/ags/gtk4/app.ts @@ -2,7 +2,7 @@ import { App } from 'astal/gtk4'; import style from './style.scss'; -import Bar from './widget/Bar'; +import Bar from './widget/bar'; App.start({ diff --git a/modules/ags/gtk4/widget/Bar.tsx b/modules/ags/gtk4/widget/bar.tsx similarity index 83% rename from modules/ags/gtk4/widget/Bar.tsx rename to modules/ags/gtk4/widget/bar.tsx index dc39b8e2..0f31673c 100644 --- a/modules/ags/gtk4/widget/Bar.tsx +++ b/modules/ags/gtk4/widget/bar.tsx @@ -1,13 +1,12 @@ import { App, Astal, Gtk } from 'astal/gtk4'; import { Variable } from 'astal'; -import { StyledBox } from './styled-box'; +import { Box, Button, CenterBox } from './subclasses'; const { EXCLUSIVE } = Astal.Exclusivity; const { TOP, LEFT, RIGHT } = Astal.WindowAnchor; const { CENTER } = Gtk.Align; - const time = Variable(0); setInterval(() => { @@ -16,10 +15,10 @@ setInterval(() => { export default () => { const styledBox = ( - `* { background: red; min-height: 10px; min-width: ${t}px; }`)} /> - ) as StyledBox; + ) as Box; return ( { anchor={TOP | LEFT | RIGHT} application={App} > - - + +