2023-11-13 15:19:49 -05:00
|
|
|
import App from 'resource:///com/github/Aylur/ags/app.js';
|
2023-11-21 01:29:46 -05:00
|
|
|
import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js';
|
|
|
|
|
2023-12-09 12:12:43 -05:00
|
|
|
import { Box, Icon, Label } from 'resource:///com/github/Aylur/ags/widget.js';
|
2023-11-13 15:19:49 -05:00
|
|
|
import { lookUpIcon } from 'resource:///com/github/Aylur/ags/utils.js';
|
|
|
|
|
2023-12-09 12:12:43 -05:00
|
|
|
import EventBox from '../misc/cursorbox.js';
|
2023-11-13 15:19:49 -05:00
|
|
|
|
|
|
|
|
2023-11-21 01:29:46 -05:00
|
|
|
export default (app) => {
|
|
|
|
const icon = Icon({
|
|
|
|
icon: lookUpIcon(app.icon_name) ?
|
|
|
|
app.icon_name :
|
|
|
|
app.app.get_string('Icon') === 'nix-snowflake' ?
|
|
|
|
'' :
|
|
|
|
app.app.get_string('Icon'),
|
2023-11-13 15:19:49 -05:00
|
|
|
size: 42,
|
|
|
|
});
|
|
|
|
|
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-11-21 01:29:46 -05:00
|
|
|
|
2023-12-09 12:12:43 -05:00
|
|
|
return EventBox({
|
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
|
|
|
|
|
|
|
setup: (self) => {
|
|
|
|
self.app = app;
|
|
|
|
},
|
|
|
|
|
2023-12-07 01:18:47 -05:00
|
|
|
onPrimaryClickRelease: () => {
|
2023-11-13 15:19:49 -05:00
|
|
|
App.closeWindow('applauncher');
|
|
|
|
Hyprland.sendMessage(`dispatch exec sh -c ${app.executable}`);
|
|
|
|
++app.frequency;
|
|
|
|
},
|
2023-11-21 01:29:46 -05:00
|
|
|
|
|
|
|
child: Box({
|
|
|
|
children: [
|
|
|
|
icon,
|
|
|
|
textBox,
|
|
|
|
],
|
2023-11-13 15:19:49 -05:00
|
|
|
}),
|
|
|
|
});
|
|
|
|
};
|