mirror of
https://github.com/Theaninova/TheaninovOS.git
synced 2026-01-22 09:32:38 +00:00
feat: update ags
This commit is contained in:
63
home/desktops/hyprland/ags/js/misc/IconBrowser.js
Normal file
63
home/desktops/hyprland/ags/js/misc/IconBrowser.js
Normal file
@@ -0,0 +1,63 @@
|
||||
import Widget from "resource:///com/github/Aylur/ags/widget.js";
|
||||
import RegularWindow from "./RegularWindow.js";
|
||||
import Gtk from "gi://Gtk";
|
||||
|
||||
export default () => {
|
||||
const selected = Widget.Label({
|
||||
css: "font-size: 1.2em;",
|
||||
});
|
||||
|
||||
const flowbox = Widget.FlowBox({
|
||||
min_children_per_line: 10,
|
||||
setup: (self) => {
|
||||
self.connect("child-activated", (_, child) => {
|
||||
selected.label = child.get_child().iconName;
|
||||
});
|
||||
|
||||
Gtk.IconTheme.get_default()
|
||||
.list_icons(null)
|
||||
.sort()
|
||||
.map((icon) => {
|
||||
!icon.endsWith(".symbolic") &&
|
||||
self.insert(
|
||||
Widget.Icon({
|
||||
icon,
|
||||
size: 38,
|
||||
}),
|
||||
-1,
|
||||
);
|
||||
});
|
||||
|
||||
self.show_all();
|
||||
},
|
||||
});
|
||||
|
||||
const entry = Widget.Entry({
|
||||
on_change: ({ text }) =>
|
||||
flowbox.get_children().forEach((child) => {
|
||||
child.visible = child.get_child().iconName.includes(text);
|
||||
}),
|
||||
});
|
||||
|
||||
return RegularWindow({
|
||||
name: "icons",
|
||||
visible: true,
|
||||
child: Widget.Box({
|
||||
css: "padding: 30px;",
|
||||
spacing: 20,
|
||||
vertical: true,
|
||||
children: [
|
||||
entry,
|
||||
Widget.Scrollable({
|
||||
hscroll: "never",
|
||||
vscroll: "always",
|
||||
hexpand: true,
|
||||
vexpand: true,
|
||||
css: "min-width: 500px;" + "min-height: 500px;",
|
||||
child: flowbox,
|
||||
}),
|
||||
selected,
|
||||
],
|
||||
}),
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user