This repository has been archived on 2024-04-14. You can view files and clone it, but cannot push or open issues or pull requests.
nixos-dotfiles/user/configs/wayland/ags/ags-config/js/panel/widgets/workspaces.js

25 lines
1.2 KiB
JavaScript

export default monitor => ags.Widget.Box({
className: 'workspaces',
connections: [[ags.Service.Hyprland, box => {
if (monitor == 0) {
box.children = [1,2,3].map(i => ags.Widget.Button({
onClicked: () => ags.Utils.execAsync(`hyprctl dispatch workspace ${i}`),
onScrollDown: () => ags.Utils.execAsync(`hyprctl dispatch workspace +1`),
onScrollUp: () => ags.Utils.execAsync(`hyprctl dispatch workspace -1`),
child: ags.Widget.Label({ label: `${i}` }),
className: ags.Service.Hyprland.active.workspace.id == i ? 'focused' : '',
}));
} else if (monitor == 1) {
box.children = [4,5,6].map(i => ags.Widget.Button({
onClicked: () => ags.Utils.execAsync(`hyprctl dispatch workspace ${i}`),
onScrollDown: () => ags.Utils.execAsync(`hyprctl dispatch workspace +1`),
onScrollUp: () => ags.Utils.execAsync(`hyprctl dispatch workspace -1`),
child: ags.Widget.Label({ label: `${i}` }),
className: ags.Service.Hyprland.active.workspace.id == i ? 'focused' : '',
}));
}
}]],
});