diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-01-14 18:29:55 +1100 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-01-14 18:29:55 +1100 |
| commit | 9c8d9aa97578725a19831709d32f597c8e5bb5d9 (patch) | |
| tree | 2640d3c0de8035ca77e708d4ccce750793e0a4b5 | |
| parent | use GLib instead of external which (diff) | |
| download | caelestia-shell-9c8d9aa97578725a19831709d32f597c8e5bb5d9.tar.gz caelestia-shell-9c8d9aa97578725a19831709d32f597c8e5bb5d9.tar.bz2 caelestia-shell-9c8d9aa97578725a19831709d32f597c8e5bb5d9.zip | |
launcher: better empty text
| -rw-r--r-- | modules/launcher.tsx | 21 | ||||
| -rw-r--r-- | scss/launcher.scss | 6 |
2 files changed, 24 insertions, 3 deletions
diff --git a/modules/launcher.tsx b/modules/launcher.tsx index 4b42328..5015b5b 100644 --- a/modules/launcher.tsx +++ b/modules/launcher.tsx @@ -1,4 +1,4 @@ -import { bind, execAsync, Gio, register, timeout, Variable } from "astal"; +import { bind, execAsync, Gio, GLib, register, timeout, Variable } from "astal"; import { Astal, Gtk, Widget } from "astal/gtk3"; import fuzzysort from "fuzzysort"; import type AstalApps from "gi://AstalApps"; @@ -45,6 +45,17 @@ const getIconFromMode = (mode: Mode) => { } }; +const getEmptyTextFromMode = (mode: Mode) => { + switch (mode) { + case "apps": + return "No apps found"; + case "files": + return GLib.find_program_in_path("fd") === null ? "File search requires `fd`" : "No files found"; + case "math": + return "Type an expression"; + } +}; + const launchAndClose = (self: JSX.Element, astalApp: AstalApps.Application) => { const toplevel = self.get_toplevel(); if (toplevel instanceof Widget.Window) toplevel.hide(); @@ -196,8 +207,12 @@ const Results = ({ entry, mode }: { entry: Widget.Entry; mode: Variable<Mode> }) shown={bind(empty).as(t => (t ? "empty" : "list"))} > <box name="empty" className="empty" halign={Gtk.Align.CENTER} valign={Gtk.Align.CENTER}> - <label className="icon" label="apps_outage" /> - <label label="No results" /> + <label className="icon" label="bug_report" /> + <label + label={bind(entry, "text").as(t => + t.startsWith(">") ? "No matching subcommands" : getEmptyTextFromMode(mode.get()) + )} + /> </box> <box vertical diff --git a/scss/launcher.scss b/scss/launcher.scss index a72389a..543d799 100644 --- a/scss/launcher.scss +++ b/scss/launcher.scss @@ -81,8 +81,14 @@ .empty { color: scheme.$subtext0; + font-size: lib.s(18); + padding: lib.s(10) 0; @include lib.spacing; + + .icon { + color: scheme.$subtext0; + } } .result { |