diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-03-05 19:25:49 +1100 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-03-05 19:25:49 +1100 |
| commit | ab80d8f78681ac46e19ad97e152b7d5afe1bf999 (patch) | |
| tree | 8989038f53e89f80c27b80c824cb6a12c7fae10c /src/modules | |
| parent | updates: fix escaping markup (diff) | |
| download | caelestia-shell-ab80d8f78681ac46e19ad97e152b7d5afe1bf999.tar.gz caelestia-shell-ab80d8f78681ac46e19ad97e152b7d5afe1bf999.tar.bz2 caelestia-shell-ab80d8f78681ac46e19ad97e152b7d5afe1bf999.zip | |
launcher: fixes
Fix light/dark actions
Fix delay when pressing enter
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/launcher/actions.tsx | 14 | ||||
| -rw-r--r-- | src/modules/launcher/index.tsx | 2 |
2 files changed, 5 insertions, 11 deletions
diff --git a/src/modules/launcher/actions.tsx b/src/modules/launcher/actions.tsx index c45273d..ffbd4b1 100644 --- a/src/modules/launcher/actions.tsx +++ b/src/modules/launcher/actions.tsx @@ -29,12 +29,6 @@ const autocomplete = (entry: Widget.Entry, action: string) => { entry.set_position(-1); }; -const hasMode = (mode: "light" | "dark") => { - const scheme = Schemes.get_default().map[Palette.get_default().scheme]; - if (scheme.colours?.[mode]) return true; - return scheme.flavours?.[Palette.get_default().flavour ?? ""]?.colours?.[mode] !== undefined; -}; - const actions = (mode: Variable<Mode>, entry: Widget.Entry): ActionMap => ({ apps: { icon: "apps", @@ -77,20 +71,20 @@ const actions = (mode: Variable<Mode>, entry: Widget.Entry): ActionMap => ({ name: "Light", description: "Change scheme to light mode", action: () => { - execAsync(`caelestia wallpaper -T light -f ${STATE}/wallpaper/current`).catch(console.error); + Palette.get_default().switchMode("light"); close(); }, - available: () => hasMode("light"), + available: () => Palette.get_default().hasMode("light"), }, dark: { icon: "dark_mode", name: "Dark", description: "Change scheme to dark mode", action: () => { - execAsync(`caelestia wallpaper -T dark -f ${STATE}/wallpaper/current`).catch(console.error); + Palette.get_default().switchMode("dark"); close(); }, - available: () => hasMode("dark"), + available: () => Palette.get_default().hasMode("dark"), }, scheme: { icon: "palette", diff --git a/src/modules/launcher/index.tsx b/src/modules/launcher/index.tsx index 8287187..f3a1e53 100644 --- a/src/modules/launcher/index.tsx +++ b/src/modules/launcher/index.tsx @@ -123,7 +123,7 @@ export default class Launcher extends PopupWindow { ); this.hook(entry, "activate", () => { (isAction(entry.get_text()) ? actions : content[mode.get()]).handleActivate(entry.get_text()); - entry.set_text(""); // Clear search on activate + if (mode.get() === "math" && !isAction(entry.get_text())) entry.set_text(""); // Cause math mode doesn't auto clear }); // Clear search on hide if not in math mode or creating a todo |