diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-03-01 16:35:18 +1100 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-03-01 16:35:18 +1100 |
| commit | 62602465ced5f65d4626f3cdf54b5fa30ba7c9dd (patch) | |
| tree | 50223190f6d9c5e6dfc72f6d6492e26290521a16 /src/modules/launcher/util.tsx | |
| parent | launcher: better files (diff) | |
| download | caelestia-shell-62602465ced5f65d4626f3cdf54b5fa30ba7c9dd.tar.gz caelestia-shell-62602465ced5f65d4626f3cdf54b5fa30ba7c9dd.tar.bz2 caelestia-shell-62602465ced5f65d4626f3cdf54b5fa30ba7c9dd.zip | |
launcher: actions + refactor into multi file
Action prefix is configurable
Diffstat (limited to 'src/modules/launcher/util.tsx')
| -rw-r--r-- | src/modules/launcher/util.tsx | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/modules/launcher/util.tsx b/src/modules/launcher/util.tsx new file mode 100644 index 0000000..3c4e8bf --- /dev/null +++ b/src/modules/launcher/util.tsx @@ -0,0 +1,19 @@ +import { FlowBox } from "@/utils/widgets"; +import type { Variable } from "astal"; +import { App, Gtk } from "astal/gtk3"; + +export type Mode = "apps" | "files" | "math" | "windows"; + +export interface LauncherContent { + updateContent(search: string): void; + handleActivate(search: string): void; +} + +export const close = () => App.get_window("launcher")?.hide(); + +export const limitLength = <T,>(arr: T[], cfg: { maxResults: Variable<number> }) => + cfg.maxResults.get() > 0 && arr.length > cfg.maxResults.get() ? arr.slice(0, cfg.maxResults.get()) : arr; + +export const ContentBox = () => ( + <FlowBox homogeneous valign={Gtk.Align.START} minChildrenPerLine={2} maxChildrenPerLine={2} /> +); |