From a49b6defd6b20434d03e526306755c0e677ad4f3 Mon Sep 17 00:00:00 2001 From: retrozinndev Date: Sun, 13 Apr 2025 00:18:33 -0300 Subject: [PATCH] :sparkles: ags(bar): peek workspace numbers on workspaces widget hover --- ags/widget/bar/Workspaces.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/ags/widget/bar/Workspaces.ts b/ags/widget/bar/Workspaces.ts index fc9a78b..7b71e97 100644 --- a/ags/widget/bar/Workspaces.ts +++ b/ags/widget/bar/Workspaces.ts @@ -11,6 +11,8 @@ export function Workspaces(): Gtk.Widget { return new Widget.EventBox({ onScroll: (_, event) => event.delta_y > 0 ? hyprland.dispatch("workspace", "e-1") : hyprland.dispatch("workspace", "e+1"), + onHover: () => showWorkspaceNumbers.set(true), + onHoverLost: () => showWorkspaceNumbers.set(false), child: new Widget.Box({ className: "workspaces", children: bind(hyprland, "workspaces").as((workspaces) => { @@ -26,15 +28,19 @@ export function Workspaces(): Gtk.Widget { `${focusedWs.id === workspace.id ? "focus" : ""} ${showWsNumbers ? "show" : ""}` )(), visible: true, - tooltipText: bind(workspace, "lastClient").as((lastClient) => `Workspace ${workspace.id}${ lastClient ? ` - ${ - !lastClient.title.toLowerCase().includes(lastClient.class) ? - `${lastClient.get_class()}: ` - : "" - } ${lastClient.title}` : "" }`), + tooltipText: Variable.derive([ + bind(workspace, "lastClient"), + bind(hyprland, "focusedWorkspace") + ],(lastClient, focusWs) => focusWs.id === workspace.id ? "" : + `Workspace ${workspace.id}${ lastClient ? ` - ${ + !lastClient.title.toLowerCase().includes(lastClient.class) ? + `${lastClient.get_class()}: ` + : "" + } ${lastClient.title}` : "" }`)(), child: new Widget.Box({ children: [ new Widget.Revealer({ - transitionDuration: 120, + transitionDuration: 200, transitionType: Gtk.RevealerTransitionType.SLIDE_LEFT, revealChild: showWorkspaceNumbers(), child: new Widget.Label({