2024-09-27 21:14:58 -04:00
|
|
|
import { bind } from 'astal';
|
2024-09-27 16:35:32 -04:00
|
|
|
|
|
|
|
import AstalApps from 'gi://AstalApps?version=0.1';
|
|
|
|
const Applications = AstalApps.Apps.new();
|
|
|
|
|
|
|
|
import AstalHyprland from 'gi://AstalHyprland?version=0.1';
|
|
|
|
const Hyprland = AstalHyprland.get_default();
|
|
|
|
|
|
|
|
import Separator from '../../misc/separator';
|
|
|
|
|
|
|
|
|
|
|
|
export default () => {
|
|
|
|
const focused = bind(Hyprland, 'focusedClient');
|
|
|
|
|
|
|
|
return (
|
|
|
|
<box
|
|
|
|
className="bar-item current-window"
|
|
|
|
visible={focused.as(Boolean)}
|
|
|
|
>
|
|
|
|
<icon
|
|
|
|
css="font-size: 32px;"
|
2024-09-27 21:14:58 -04:00
|
|
|
setup={(self) => {
|
2024-09-27 16:35:32 -04:00
|
|
|
self.hook(Hyprland, 'notify::focused-client', () => {
|
|
|
|
const app = Applications.query(
|
2024-09-27 21:14:58 -04:00
|
|
|
Hyprland.get_focused_client()?.get_class() ?? '',
|
2024-09-27 16:35:32 -04:00
|
|
|
false,
|
|
|
|
)[0];
|
|
|
|
|
|
|
|
self.set_icon(app.iconName ?? '');
|
|
|
|
});
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
|
2024-09-27 21:14:58 -04:00
|
|
|
<Separator size={8} />
|
2024-09-27 16:35:32 -04:00
|
|
|
|
|
|
|
{focused.as((client) => (client && (
|
|
|
|
<label
|
|
|
|
label={bind(client, 'title').as(String)}
|
2024-09-27 21:14:58 -04:00
|
|
|
truncate
|
2024-09-27 16:35:32 -04:00
|
|
|
/>
|
|
|
|
)))}
|
|
|
|
</box>
|
|
|
|
);
|
|
|
|
};
|