feat(ags): add hyprland current window on bar

This commit is contained in:
matt1432 2023-08-28 00:23:13 -04:00
parent a7a888f6c5
commit ac55202563
2 changed files with 18 additions and 4 deletions

View file

@ -0,0 +1,16 @@
// https://github.com/Aylur/ags/wiki/Widgets
const { Hyprland } = ags.Service;
const { Label } = ags.Widget;
const { Gtk } = imports.gi;
const currentWindow = () => Label({
style: 'color: #CBA6F7; font-size: 18px',
connections: [
[Hyprland, label => {
label.label = Hyprland.active.client.title;
}, 'changed'],
],
});
export const CurrentWindow = currentWindow();

View file

@ -1,5 +1,6 @@
import Gdk from 'gi://Gdk'; import Gdk from 'gi://Gdk';
const display = Gdk.Display.get_default(); const display = Gdk.Display.get_default();
import { CurrentWindow } from 'file:///home/matt/.nix/config/ags/current-window/current-window.js';
const Separator = () => ags.Widget.Box({ const Separator = () => ags.Widget.Box({
style: 'min-width: 8px; min-height: 8px', style: 'min-width: 8px; min-height: 8px',
@ -129,10 +130,7 @@ export const LeftBar = ags.Widget.Window({
], ],
}), }),
ags.Widget.Box({ CurrentWindow,
halign: 'center',
style: 'background: red; min-width: 100px; min-height: 40px',
}),
ags.Widget.Box({ ags.Widget.Box({
halign: 'end', halign: 'end',