From 2276acc97ff832d6e91756731658f1f33b005506 Mon Sep 17 00:00:00 2001 From: retrozinndev Date: Wed, 30 Jul 2025 16:13:49 -0300 Subject: [PATCH] :zap: chore: use floating numbers instead of integers on levelbar, simplify widget structure on apps-window --- ags/window/AppsWindow.tsx | 87 +++++++++++++++++++++------------------ ags/window/Bar.tsx | 1 - ags/window/OSD.tsx | 5 +-- 3 files changed, 50 insertions(+), 43 deletions(-) diff --git a/ags/window/AppsWindow.tsx b/ags/window/AppsWindow.tsx index 4fa7a9e..694edc9 100644 --- a/ags/window/AppsWindow.tsx +++ b/ags/window/AppsWindow.tsx @@ -1,10 +1,11 @@ import { Astal, Gdk, Gtk } from "ags/gtk4"; import { execApp, getAppIcon, getApps, getAstalApps } from "../scripts/apps"; -import { PopupWindow } from "../widget/PopupWindow"; +import { getPopupWindowContainer, PopupWindow } from "../widget/PopupWindow"; import AstalApps from "gi://AstalApps"; import Pango from "gi://Pango?version=1.0"; import { createState, For } from "ags"; +import { escapeUnintendedMarkup } from "../scripts/utils"; const ignoredKeys = [ @@ -24,53 +25,61 @@ export const AppsWindow = (mon: number) => { return { - const entry = self.get_first_child()!.get_first_child()! - .get_first_child()!.get_first_child() as Gtk.SearchEntry; + const entry = getPopupWindowContainer(self).get_first_child()! + .get_first_child()!.get_first_child()! as Gtk.SearchEntry; for(const ignoredKey of ignoredKeys) if(key === ignoredKey) return entry.grab_focus(); }}> - - - { + + { setResults(getAstalApps().fuzzy_query(self.text.trim())); - }} /> - - - - - - - {(app) => - ${app.description}` - : ""}`.replace(/\&/g, "&") - } onActivate={() => { - execApp(app); - window.close(); - }} onClicked={() => { - execApp(app); - window.close(); - }}> - - - - - - } - - - - + }} onStopSearch={(self) => (self.get_root() as Astal.Window)?.close()} /> + + + + + + child.get_child()!.activate() // pass activation to button + }> + + + {(app) => + ${ + escapeUnintendedMarkup(app.description) + }` + : ""}` + } onActivate={(self) => { + execApp(app); + (self.get_root() as Astal.Window)?.close(); + }} onClicked={(self) => { + execApp(app); + (self.get_root() as Astal.Window)?.close(); + }}> + + + + + + + } + + + + } diff --git a/ags/window/Bar.tsx b/ags/window/Bar.tsx index 2d6d1c5..eadaaac 100644 --- a/ags/window/Bar.tsx +++ b/ags/window/Bar.tsx @@ -1,5 +1,4 @@ import { Astal, Gtk } from "ags/gtk4"; - import { Tray } from "../widget/bar/Tray"; import { Workspaces } from "../widget/bar/Workspaces"; import { FocusedClient } from "../widget/bar/FocusedClient"; diff --git a/ags/window/OSD.tsx b/ags/window/OSD.tsx index 99e1a0c..b0d7954 100644 --- a/ags/window/OSD.tsx +++ b/ags/window/OSD.tsx @@ -30,9 +30,8 @@ export const OSD = (mon: number) => { ellipsize={Pango.EllipsizeMode.END} /> - Math.floor(volume * 100))} - maxValue={Wireplumber.getDefault().getMaxSinkVolume()} + Wireplumber.getDefault().getDefaultSink(), "volume")} + maxValue={Wireplumber.getDefault().getMaxSinkVolume() / 100} />