feat: improve AGS JavaScript definition files
This commit is contained in:
parent
bc64af1a17
commit
9ac744a8ce
2 changed files with 19 additions and 17 deletions
|
@ -12,28 +12,30 @@ const date = Variable("", {
|
|||
// so to make a reuseable widget, make it a function
|
||||
// then you can simply instantiate one by calling it
|
||||
const focusedTitle = Widget.Label({
|
||||
label: hyprland.active.client.bind('title'),
|
||||
visible: hyprland.active.client.bind('address')
|
||||
.as(addr => addr !== "0x"),
|
||||
label: hyprland.active.client.bind('title'),
|
||||
visible: hyprland.active.client.bind('address')
|
||||
.as(addr => addr !== "0x"),
|
||||
})
|
||||
|
||||
const dispatch = ws => hyprland.messageAsync(`dispatch workspace ${ws}`);
|
||||
|
||||
const Workspaces = () => Widget.EventBox({
|
||||
onScrollUp: () => dispatch('+1'),
|
||||
onScrollDown: () => dispatch('-1'),
|
||||
child: Widget.Box({
|
||||
children: Array.from({ length: 10 }, (_, i) => i + 1).map(i => Widget.Button({
|
||||
attribute: i,
|
||||
label: `${i}`,
|
||||
onClicked: () => dispatch(i),
|
||||
})),
|
||||
onScrollUp: () => dispatch('+1'),
|
||||
onScrollDown: () => dispatch('-1'),
|
||||
child: Widget.Box({
|
||||
children: Array.from({ length: 10 }, (_, i) => i + 1).map(i => Widget.Button({
|
||||
attribute: i,
|
||||
label: `${i}`,
|
||||
onClicked: () => dispatch(i),
|
||||
|
||||
// remove this setup hook if you want fixed number of buttons
|
||||
setup: self => self.hook(hyprland, () => self.children.forEach(btn => {
|
||||
btn.visible = hyprland.workspaces.some(ws => ws.id === btn.attribute);
|
||||
})),
|
||||
}),
|
||||
class_name: i === hyprland.active.workspace.id ? "focused" : ""
|
||||
})),
|
||||
|
||||
// remove this setup hook if you want fixed number of buttons
|
||||
setup: self => self.hook(hyprland, () => self.children.forEach(btn => {
|
||||
btn.visible = hyprland.workspaces.some(ws => ws.id === btn.attribute);
|
||||
})),
|
||||
}),
|
||||
})
|
||||
function ClientTitle() {
|
||||
return Widget.Label({
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
home.packages = with pkgs; [ags];
|
||||
myAutostartCommands = [
|
||||
#"${pkgs.ags}/bin/ags --init"
|
||||
#"${pkgs.ags}/bin/ags"
|
||||
"${pkgs.ags}/bin/ags"
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue