From 3c579d0e275cdaf6f2c9589abade94bde7905c82 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Sat, 26 Apr 2025 22:36:23 +1000 Subject: clean Remove everything --- src/modules/launcher/modes.tsx | 225 ----------------------------------------- 1 file changed, 225 deletions(-) delete mode 100644 src/modules/launcher/modes.tsx (limited to 'src/modules/launcher/modes.tsx') diff --git a/src/modules/launcher/modes.tsx b/src/modules/launcher/modes.tsx deleted file mode 100644 index e278779..0000000 --- a/src/modules/launcher/modes.tsx +++ /dev/null @@ -1,225 +0,0 @@ -import { Apps as AppsService } from "@/services/apps"; -import MathService, { type HistoryItem } from "@/services/math"; -import { getAppCategoryIcon } from "@/utils/icons"; -import { launch } from "@/utils/system"; -import { type FlowBox, setupCustomTooltip } from "@/utils/widgets"; -import { bind, execAsync, Gio, register, Variable } from "astal"; -import { Astal, Gtk, Widget } from "astal/gtk3"; -import { launcher as config } from "config"; -import type AstalApps from "gi://AstalApps"; -import { close, ContentBox, type LauncherContent, limitLength } from "./util"; - -const AppResult = ({ app }: { app: AstalApps.Application }) => ( - - - -); - -const FileResult = ({ path }: { path: string }) => ( - - - -); - -const MathResult = ({ icon, equation, result }: HistoryItem) => ( - - - -); - -@register() -class Apps extends Widget.Box implements LauncherContent { - #content: FlowBox; - - constructor() { - super({ name: "apps", className: "apps" }); - - this.#content = () as FlowBox; - - this.add( - - {this.#content} - - ); - } - - updateContent(search: string): void { - this.#content.foreach(c => c.destroy()); - for (const app of limitLength(AppsService.fuzzy_query(search), config.apps)) - this.#content.add(); - } - - handleActivate(): void { - this.#content.get_child_at_index(0)?.get_child()?.grab_focus(); - this.#content.get_child_at_index(0)?.get_child()?.activate(); - } -} - -@register() -class Files extends Widget.Box implements LauncherContent { - #content: FlowBox; - - constructor() { - super({ name: "files", className: "files" }); - - this.#content = () as FlowBox; - - this.add( - - {this.#content} - - ); - } - - updateContent(search: string): void { - execAsync(["fd", ...config.files.fdOpts.get(), search, HOME]) - .then(out => { - this.#content.foreach(c => c.destroy()); - const paths = out.split("\n").filter(path => path); - for (const path of limitLength(paths, config.files)) this.#content.add(); - }) - .catch(() => {}); // Ignore errors - } - - handleActivate(): void { - this.#content.get_child_at_index(0)?.get_child()?.grab_focus(); - this.#content.get_child_at_index(0)?.get_child()?.activate(); - } -} - -@register() -class Math extends Widget.Box implements LauncherContent { - #showResult: Variable; - #result: Variable; - #content: FlowBox; - - constructor() { - super({ name: "math", className: "math", vertical: true }); - - this.#showResult = Variable(false); - this.#result = Variable({ equation: "", result: "", icon: "" }); - this.#content = () as FlowBox; - - this.add( - - - - - s === "lines")} className="separator" /> - - - ); - this.add( - - {this.#content} - - ); - } - - updateContent(search: string): void { - this.#showResult.set(search.length > 0); - this.#result.set(MathService.get_default().evaluate(search)); - - this.#content.foreach(c => c.destroy()); - for (const item of limitLength(MathService.get_default().history, config.math)) - this.#content.add(); - } - - handleActivate(search: string): void { - if (!search) return; - MathService.get_default().commit(); - const res = this.#result.get(); - // Copy and close if not assignment, help or error - if (!["equal", "help", "error"].includes(res.icon)) { - execAsync(["wl-copy", "--", res.result]).catch(console.error); - close(); - } - } -} - -export default () => ({ - apps: new Apps(), - files: new Files(), - math: new Math(), -}); -- cgit v1.2.3-freya