2024-01-30 11:29:07 -05:00
|
|
|
const { Box, Icon, Label } = Widget;
|
|
|
|
const { lookUpIcon } = Utils;
|
2023-11-13 15:19:49 -05:00
|
|
|
|
2024-01-13 23:38:31 -05:00
|
|
|
import CursorBox from '../misc/cursorbox.ts';
|
2023-11-13 15:19:49 -05:00
|
|
|
|
2024-01-13 11:15:08 -05:00
|
|
|
// Types
|
2024-01-13 23:38:31 -05:00
|
|
|
import { Application } from 'types/service/applications.ts';
|
2023-11-13 15:19:49 -05:00
|
|
|
|
2024-01-13 11:15:08 -05:00
|
|
|
|
|
|
|
export default (app: Application) => {
|
2023-12-18 18:00:30 -05:00
|
|
|
const icon = Icon({ size: 42 });
|
|
|
|
const iconString = app.app.get_string('Icon');
|
|
|
|
|
|
|
|
if (app.icon_name) {
|
|
|
|
if (lookUpIcon(app.icon_name)) {
|
|
|
|
icon.icon = app.icon_name;
|
|
|
|
}
|
|
|
|
else if (iconString && iconString !== 'nix-snowflake') {
|
|
|
|
icon.icon = iconString;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
icon.icon = '';
|
|
|
|
}
|
|
|
|
}
|
2023-11-13 15:19:49 -05:00
|
|
|
|
2023-12-09 12:12:43 -05:00
|
|
|
const textBox = Box({
|
2023-11-13 15:19:49 -05:00
|
|
|
vertical: true,
|
2023-12-09 12:12:43 -05:00
|
|
|
vpack: 'start',
|
|
|
|
|
|
|
|
children: [
|
|
|
|
Label({
|
|
|
|
class_name: 'title',
|
|
|
|
label: app.name,
|
|
|
|
xalign: 0,
|
|
|
|
truncate: 'end',
|
|
|
|
}),
|
|
|
|
|
|
|
|
Label({
|
|
|
|
class_name: 'description',
|
|
|
|
label: app.description || '',
|
|
|
|
wrap: true,
|
|
|
|
xalign: 0,
|
|
|
|
justification: 'left',
|
|
|
|
}),
|
|
|
|
|
|
|
|
Label(),
|
|
|
|
],
|
2023-11-13 15:19:49 -05:00
|
|
|
});
|
|
|
|
|
2023-12-18 23:20:32 -05:00
|
|
|
return CursorBox({
|
2023-12-07 01:18:47 -05:00
|
|
|
hexpand: true,
|
2023-11-13 15:19:49 -05:00
|
|
|
class_name: 'app',
|
2023-11-21 01:29:46 -05:00
|
|
|
|
2023-12-18 18:00:30 -05:00
|
|
|
attribute: { app },
|
2023-11-21 01:29:46 -05:00
|
|
|
|
2023-12-20 14:28:56 -05:00
|
|
|
on_primary_click_release: () => {
|
2024-04-07 14:29:12 -04:00
|
|
|
App.closeWindow('win-applauncher');
|
2023-12-20 14:28:56 -05:00
|
|
|
app.launch();
|
2023-11-13 15:19:49 -05:00
|
|
|
},
|
2023-11-21 01:29:46 -05:00
|
|
|
|
|
|
|
child: Box({
|
|
|
|
children: [
|
|
|
|
icon,
|
|
|
|
textBox,
|
|
|
|
],
|
2023-11-13 15:19:49 -05:00
|
|
|
}),
|
|
|
|
});
|
|
|
|
};
|