diff --git a/config/astal/components/launcher/Launcher.tsx b/config/astal/components/launcher/Launcher.tsx
index 85c5342..9b13853 100644
--- a/config/astal/components/launcher/Launcher.tsx
+++ b/config/astal/components/launcher/Launcher.tsx
@@ -1,22 +1,23 @@
import { Variable } from "astal";
-import { App, Astal, Gdk, Gtk } from "astal/gtk4";
+import { App, Astal, Gdk, Gtk, hook } from "astal/gtk4";
import AstalApps from "gi://AstalApps";
+import AppList from "./modules/Apps";
-const MAX_ITEMS = 8;
+const prefixes = ['='];
function hide() {
- App.get_window("launcher")!.hide();
+ App.get_window("launcher")!.hide();
}
const Launcher = () => {
- const { CENTER } = Gtk.Align;
const apps = new AstalApps.Apps();
const width = Variable(1000);
+ const height = Variable(1000);
const text = Variable("");
const visible = Variable(false);
- const list = text((text) => apps.fuzzy_query(text).slice(0, MAX_ITEMS));
const onEnter = () => {
+ // TODO handle custom stuff
apps.fuzzy_query(text.get())?.[0].launch();
hide();
};
@@ -29,13 +30,58 @@ const Launcher = () => {
application={App}
onShow={(self) => {
width.set(self.get_current_monitor().geometry.width);
+ height.set(self.get_current_monitor().geometry.height);
}}
onKeyPressed={(self, keyval) => {
if (keyval === Gdk.KEY_Escape) self.hide();
}}
child={
-
+
+
+
+
+
+
+ {
+ hook(self, App, 'window-toggled', (_, win) => {
+ if (win.name == 'launcher') {
+ self.set_text('');
+ self.grab_focus();
+ }
+ })
+ }}
+ onNotifyText={self => text.set(self.text)}
+ primaryIconSensitive
+ onActivate={onEnter}
+ hexpand>
+
+ {
+ return !prefixes.includes(v.slice(0, 1));
+ })}
+ >
+
+
}
>
}
+
+export default Launcher;
diff --git a/config/astal/components/launcher/launcher.scss b/config/astal/components/launcher/launcher.scss
new file mode 100644
index 0000000..8f67caf
--- /dev/null
+++ b/config/astal/components/launcher/launcher.scss
@@ -0,0 +1,16 @@
+@use '../../util/colours.scss' as *;
+
+window {
+ background: transparent;
+}
+
+box.app-launcher-wrapper {
+ background-color: $shadow-color;
+
+ >box.app-launcher {
+ background-color: $bg-color;
+ border-radius: 30px;
+ padding: 20px;
+ border: 1px solid $accent-color-2;
+ }
+}
diff --git a/config/astal/components/launcher/modules/Apps.tsx b/config/astal/components/launcher/modules/Apps.tsx
new file mode 100644
index 0000000..abae8a2
--- /dev/null
+++ b/config/astal/components/launcher/modules/Apps.tsx
@@ -0,0 +1,59 @@
+import { Binding, Variable } from "astal";
+import { Gtk } from "astal/gtk4";
+import AstalApps from "gi://AstalApps";
+import Pango from "gi://Pango?version=1.0";
+
+const MAX_ITEMS = 8;
+
+const AppList = ({ hide, query, visible }: { hide: () => void, query: Variable, visible: Binding }) => {
+ const apps = new AstalApps.Apps();
+ const list = query((text) => apps.fuzzy_query(text).slice(0, MAX_ITEMS));
+ return
+ l.length > 0)}
+ >
+ {list.as(l => l.map(app => ))}
+
+ l.length === 0)}
+ >
+
+
+
+
+}
+
+const AppButton = ({ app, hide }: { app: AstalApps.Application, hide: () => void }) => {
+ return
+}
+
+export default AppList;
diff --git a/config/astal/components/launcher/modules/Calculation.tsx b/config/astal/components/launcher/modules/Calculation.tsx
new file mode 100644
index 0000000..e69de29