feat(ags): add tooltip to individual workspaces

This commit is contained in:
matt1432 2023-09-10 23:15:11 -04:00
parent 1e19096f83
commit 2305f1e06a

View file

@ -4,10 +4,13 @@ const { Box, Button, Label, Revealer } = ags.Widget;
import { EventBox } from '../common.js'; import { EventBox } from '../common.js';
const WorkspaceModule = ({ i } = {}) => const Workspace = ({ i } = {}) =>
Revealer({ Revealer({
transition: "slide_right", transition: "slide_right",
child: EventBox({ child: EventBox({
setup: widget => {
widget.set_tooltip_text(`${i}`);
},
onPrimaryClickRelease: () => execAsync(`hyprctl dispatch workspace ${i}`).catch(print), onPrimaryClickRelease: () => execAsync(`hyprctl dispatch workspace ${i}`).catch(print),
child: Box({ child: Box({
className: 'button', className: 'button',
@ -24,11 +27,11 @@ Revealer({
}), }),
}); });
const Workspace = props => Box({ export const Workspaces = Box({
className: 'workspaces', className: 'workspaces',
children: [EventBox({ children: [EventBox({
child: Box({ child: Box({
children: Array.from({ length: 15 }, (_, i) => i + 1).map(i => WorkspaceModule({ i: i})), children: Array.from({ length: 15 }, (_, i) => i + 1).map(i => Workspace({ i: i})),
connections: [[Hyprland, box => { connections: [[Hyprland, box => {
let workspaces = []; let workspaces = [];
Hyprland.workspaces.forEach(ws => { Hyprland.workspaces.forEach(ws => {
@ -43,5 +46,3 @@ const Workspace = props => Box({
}), }),
})], })],
}); });
export const Workspaces = Workspace();