From dcd914dbae039560a4ad4db4edd0264845f7024b Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Wed, 15 Jan 2025 15:22:22 +1100 Subject: better popup window Not manual using css, instead use a combination of css opacity and Hyprland animations --- app.tsx | 9 +--- modules/launcher.tsx | 54 +++++++++---------- scss/launcher.scss | 8 --- scss/widgets.scss | 9 ++++ utils/widgets.tsx | 145 ++++++++++----------------------------------------- 5 files changed, 65 insertions(+), 160 deletions(-) diff --git a/app.tsx b/app.tsx index 86d98e6..e38c352 100644 --- a/app.tsx +++ b/app.tsx @@ -5,7 +5,6 @@ import Bar from "./modules/bar"; import Launcher from "./modules/launcher"; import NotifPopups from "./modules/notifpopups"; import Players from "./services/players"; -import { PopupWindow } from "./utils/widgets"; const loadStyleAsync = async () => { if (!GLib.file_test(`${SRC}/scss/scheme/_index.scss`, GLib.FileTest.EXISTS)) @@ -34,13 +33,7 @@ App.start({ else if (request === "media next") Players.get_default().lastPlayer?.next(); else if (request === "media previous") Players.get_default().lastPlayer?.previous(); else if (request === "media stop") Players.get_default().lastPlayer?.stop(); - else if (request.startsWith("toggle")) { - const window = App.get_window(request.slice(7)); - if (window instanceof PopupWindow) window.toggle(); - else App.toggle_window(request.slice(7)); - - log = false; - } else return res("Unknown command: " + request); + else return res("Unknown command: " + request); if (log) console.log(`Request handled: ${request}`); res("OK"); diff --git a/modules/launcher.tsx b/modules/launcher.tsx index 83245ca..b212b85 100644 --- a/modules/launcher.tsx +++ b/modules/launcher.tsx @@ -8,7 +8,7 @@ import { Apps } from "../services/apps"; import Math, { type HistoryItem } from "../services/math"; import { getAppCategoryIcon } from "../utils/icons"; import { launch } from "../utils/system"; -import { PopupWindow, setupCustomTooltip, TransitionType } from "../utils/widgets"; +import { convertPopupWindowProps, setupCustomTooltip } from "../utils/widgets"; type Mode = "apps" | "files" | "math"; @@ -323,11 +323,7 @@ const LauncherContent = ({ showResults: Variable; entry: Widget.Entry; }) => ( - `launcher ${m}`)} - css={bind(AstalHyprland.get_default(), "focusedMonitor").as(m => `margin-top: ${m.height / 4}px;`)} - > + `launcher ${m}`)}>