nixos-configs/nixosModules/ags/config/ts/bar/items/current-window.ts
matt1432 24aa4b9842
All checks were successful
Discord / discord commits (push) Has been skipped
refactor: make modules independant and exposed in the flake for outside use
2024-08-02 22:32:29 -04:00

33 lines
835 B
TypeScript

const Applications = await Service.import('applications');
const Hyprland = await Service.import('hyprland');
const { Box, Icon, Label } = Widget;
import Separator from '../../misc/separator.ts';
const SPACING = 8;
export default () => Box({
class_name: 'current-window',
children: [
Separator(SPACING / 2),
Icon({ size: 30 })
.hook(Hyprland.active.client, (self) => {
const app = Applications
.query(Hyprland.active.client.class)[0];
self.icon = app?.icon_name || '';
}),
Separator(SPACING),
Label({
truncate: 'end',
label: Hyprland.active.client.bind('title'),
}),
],
}).hook(Hyprland.active.client, (self) => {
self.visible = Hyprland.active.client.title !== '';
});