From 2293da9789c0bddecd230b1b5794a6e790bd8588 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Fri, 24 Jan 2025 19:38:16 +1100 Subject: launcher: windows mode Also files mode icons --- src/modules/launcher.tsx | 238 +++++++++++++++++++++++++++++++++++++++++++---- src/utils/types.ts | 32 +++++++ 2 files changed, 254 insertions(+), 16 deletions(-) create mode 100644 src/utils/types.ts (limited to 'src') diff --git a/src/modules/launcher.tsx b/src/modules/launcher.tsx index 0e72224..b588e3a 100644 --- a/src/modules/launcher.tsx +++ b/src/modules/launcher.tsx @@ -1,17 +1,18 @@ import { bind, execAsync, Gio, GLib, register, timeout, Variable } from "astal"; -import { Astal, Gtk, Widget } from "astal/gtk3"; +import { App, Astal, Gtk, Widget } from "astal/gtk3"; import fuzzysort from "fuzzysort"; import type AstalApps from "gi://AstalApps"; import AstalHyprland from "gi://AstalHyprland"; import { launcher as config } from "../../config"; import { Apps } from "../services/apps"; -import Math, { type HistoryItem } from "../services/math"; +import MathService, { type HistoryItem } from "../services/math"; import { getAppCategoryIcon } from "../utils/icons"; import { launch } from "../utils/system"; +import type { Client } from "../utils/types"; import { MenuItem, setupCustomTooltip } from "../utils/widgets"; import PopupWindow from "../widgets/popupwindow"; -type Mode = "apps" | "files" | "math"; +type Mode = "apps" | "files" | "math" | "windows"; interface Subcommand { icon: string; @@ -28,6 +29,8 @@ const getIconFromMode = (mode: Mode) => { return "folder"; case "math": return "calculate"; + case "windows": + return "select_window_2"; } }; @@ -39,6 +42,8 @@ const getEmptyTextFromMode = (mode: Mode) => { return GLib.find_program_in_path("fd") === null ? "File search requires `fd`" : "No files found"; case "math": return "Type an expression"; + case "windows": + return "No windows found"; } }; @@ -133,14 +138,16 @@ const Result = ({ materialIcon, label, sublabel, + tooltip, onClicked, onSecondaryClick, onDestroy, }: { - icon?: string; + icon?: string | Gio.Icon | null; materialIcon?: string; label: string; sublabel?: string; + tooltip?: string; onClicked: (self: Widget.Button) => void; onSecondaryClick?: (self: Widget.Button) => void; onDestroy?: () => void; @@ -148,16 +155,19 @@ const Result = ({