aboutsummaryrefslogtreecommitdiff
path: root/.config/ags/widget
diff options
context:
space:
mode:
authorsrdusr <trevorgray@srdusr.com>2025-02-07 17:28:53 +0200
committersrdusr <trevorgray@srdusr.com>2025-02-07 17:28:53 +0200
commit69e0b74c78f65ec94a297eacd15ca8586fcd5a66 (patch)
tree586d336262292710948573ab5652ea87b6f5c907 /.config/ags/widget
parent2b82bff1033e602f375e84f01fc7213fa73514ea (diff)
downloaddotfiles-69e0b74c78f65ec94a297eacd15ca8586fcd5a66.tar.gz
dotfiles-69e0b74c78f65ec94a297eacd15ca8586fcd5a66.zip
Auto formatting/linting
Diffstat (limited to '.config/ags/widget')
-rw-r--r--.config/ags/widget/launcher/AppLauncher.ts139
1 files changed, 67 insertions, 72 deletions
diff --git a/.config/ags/widget/launcher/AppLauncher.ts b/.config/ags/widget/launcher/AppLauncher.ts
index 4d7ca73..08258de 100644
--- a/.config/ags/widget/launcher/AppLauncher.ts
+++ b/.config/ags/widget/launcher/AppLauncher.ts
@@ -1,130 +1,125 @@
-import { type Application } from "types/service/applications"
-import { launchApp, icon } from "lib/utils"
-import options from "options"
-import icons from "lib/icons"
+import { type Application } from 'types/service/applications';
+import { launchApp, icon } from 'lib/utils';
+import options from 'options';
+import icons from 'lib/icons';
-const apps = await Service.import("applications")
-const { query } = apps
-const { iconSize } = options.launcher.apps
+const apps = await Service.import('applications');
+const { query } = apps;
+const { iconSize } = options.launcher.apps;
-const QuickAppButton = (app: Application) => Widget.Button({
- hexpand: true,
- tooltip_text: app.name,
- on_clicked: () => {
- App.closeWindow("launcher")
- launchApp(app)
- },
- child: Widget.Icon({
- size: iconSize.bind(),
- icon: icon(app.icon_name, icons.fallback.executable),
- }),
-})
+const QuickAppButton = (app: Application) =>
+ Widget.Button({
+ hexpand: true,
+ tooltip_text: app.name,
+ on_clicked: () => {
+ App.closeWindow('launcher');
+ launchApp(app);
+ },
+ child: Widget.Icon({
+ size: iconSize.bind(),
+ icon: icon(app.icon_name, icons.fallback.executable),
+ }),
+ });
const AppItem = (app: Application) => {
const title = Widget.Label({
- class_name: "title",
+ class_name: 'title',
label: app.name,
hexpand: true,
xalign: 0,
- vpack: "center",
- truncate: "end",
- })
+ vpack: 'center',
+ truncate: 'end',
+ });
const description = Widget.Label({
- class_name: "description",
- label: app.description || "",
+ class_name: 'description',
+ label: app.description || '',
hexpand: true,
wrap: true,
max_width_chars: 30,
xalign: 0,
- justification: "left",
- vpack: "center",
- })
+ justification: 'left',
+ vpack: 'center',
+ });
const appicon = Widget.Icon({
icon: icon(app.icon_name, icons.fallback.executable),
size: iconSize.bind(),
- })
+ });
const textBox = Widget.Box({
vertical: true,
- vpack: "center",
+ vpack: 'center',
children: app.description ? [title, description] : [title],
- })
+ });
return Widget.Button({
- class_name: "app-item",
+ class_name: 'app-item',
attribute: { app },
child: Widget.Box({
children: [appicon, textBox],
}),
on_clicked: () => {
- App.closeWindow("launcher")
- launchApp(app)
+ App.closeWindow('launcher');
+ launchApp(app);
},
- })
-}
+ });
+};
export function Favorites() {
- const favs = options.launcher.apps.favorites.bind()
+ const favs = options.launcher.apps.favorites.bind();
return Widget.Revealer({
visible: favs.as(f => f.length > 0),
child: Widget.Box({
vertical: true,
- children: favs.as(favs => favs.flatMap(fs => [
- Widget.Separator(),
- Widget.Box({
- class_name: "quicklaunch horizontal",
- children: fs
- .map(f => query(f)?.[0])
- .filter(f => f)
- .map(QuickAppButton),
- }),
- ])),
+ children: favs.as(favs =>
+ favs.flatMap(fs => [
+ Widget.Separator(),
+ Widget.Box({
+ class_name: 'quicklaunch horizontal',
+ children: fs
+ .map(f => query(f)?.[0])
+ .filter(f => f)
+ .map(QuickAppButton),
+ }),
+ ]),
+ ),
}),
- })
+ });
}
export function Launcher() {
- const applist = Variable(query(""))
- const max = options.launcher.apps.max
- let first = applist.value[0]
+ const applist = Variable(query(''));
+ const max = options.launcher.apps.max;
+ let first = applist.value[0];
function SeparatedAppItem(app: Application) {
- return Widget.Revealer(
- { attribute: { app } },
- Widget.Box(
- { vertical: true },
- Widget.Separator(),
- AppItem(app),
- ),
- )
+ return Widget.Revealer({ attribute: { app } }, Widget.Box({ vertical: true }, Widget.Separator(), AppItem(app)));
}
const list = Widget.Box({
vertical: true,
children: applist.bind().as(list => list.map(SeparatedAppItem)),
- setup: self => self
- .hook(apps, () => applist.value = query(""), "notify::frequents"),
- })
+ setup: self => self.hook(apps, () => (applist.value = query('')), 'notify::frequents'),
+ });
return Object.assign(list, {
filter(text: string | null) {
- first = query(text || "")[0]
+ first = query(text || '')[0];
list.children.reduce((i, item) => {
if (!text || i >= max.value) {
- item.reveal_child = false
- return i
+ item.reveal_child = false;
+ return i;
}
if (item.attribute.app.match(text)) {
- item.reveal_child = true
- return ++i
+ item.reveal_child = true;
+ return ++i;
}
- item.reveal_child = false
- return i
- }, 0)
+ item.reveal_child = false;
+ return i;
+ }, 0);
},
launchFirst() {
- launchApp(first)
+ launchApp(first);
},
- })
+ });
}