diff options
Diffstat (limited to 'examples/gtk3/js/applauncher/widget/Applauncher.tsx')
-rw-r--r-- | examples/gtk3/js/applauncher/widget/Applauncher.tsx | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/examples/gtk3/js/applauncher/widget/Applauncher.tsx b/examples/gtk3/js/applauncher/widget/Applauncher.tsx index c7bac68..8206250 100644 --- a/examples/gtk3/js/applauncher/widget/Applauncher.tsx +++ b/examples/gtk3/js/applauncher/widget/Applauncher.tsx @@ -35,6 +35,7 @@ function AppButton({ app }: { app: Apps.Application }) { export default function Applauncher() { const { CENTER } = Gtk.Align const apps = new Apps.Apps() + const width = Variable(1000) const text = Variable("") const list = text(text => apps.fuzzy_query(text).slice(0, MAX_ITEMS)) @@ -49,13 +50,16 @@ export default function Applauncher() { exclusivity={Astal.Exclusivity.IGNORE} keymode={Astal.Keymode.ON_DEMAND} application={App} - onShow={() => text.set("")} + onShow={(self) => { + text.set("") + width.set(self.get_current_monitor().workarea.width) + }} onKeyPressEvent={function (self, event: Gdk.Event) { if (event.get_keyval()[1] === Gdk.KEY_Escape) self.hide() }}> <box> - <eventbox widthRequest={4000} expand onClick={hide} /> + <eventbox widthRequest={width(w => w / 2)} expand onClick={hide} /> <box hexpand={false} vertical> <eventbox heightRequest={100} onClick={hide} /> <box widthRequest={500} className="Applauncher" vertical> @@ -81,7 +85,7 @@ export default function Applauncher() { </box> <eventbox expand onClick={hide} /> </box> - <eventbox widthRequest={4000} expand onClick={hide} /> + <eventbox widthRequest={width(w => w / 2)} expand onClick={hide} /> </box> </window> } |