From 9e8a840430f165d69eebbb905ef96de314232188 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Fri, 8 Mar 2024 14:03:20 +0700 Subject: [PATCH] overview: add ws numbers --- .../ags/modules/overview/overview_hyprland.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.config/ags/modules/overview/overview_hyprland.js b/.config/ags/modules/overview/overview_hyprland.js index 0fe06254..7a5b55c7 100644 --- a/.config/ags/modules/overview/overview_hyprland.js +++ b/.config/ags/modules/overview/overview_hyprland.js @@ -208,13 +208,19 @@ export default () => { }, } }) - const WorkspaceNumber = (index) => Widget.Label({ + const WorkspaceNumber = ({ index, ...rest }) => Widget.Label({ className: 'overview-tasks-workspace-number', label: `${index}`, css: ` margin: ${Math.min(SCREEN_WIDTH, SCREEN_HEIGHT) * userOptions.overview.scale * userOptions.overview.wsNumMarginScale}px; font-size: ${SCREEN_HEIGHT * userOptions.overview.scale * userOptions.overview.wsNumScale}px; `, + setup: (self) => self.hook(Hyprland.active.workspace, (self) => { + // Update when going to new ws group + const currentGroup = Math.floor((Hyprland.active.workspace.id - 1) / NUM_OF_WORKSPACES_SHOWN); + self.label = `${currentGroup * NUM_OF_WORKSPACES_SHOWN + index}`; + }), + ...rest, }) const widget = Widget.Box({ className: 'overview-tasks-workspace', @@ -238,7 +244,13 @@ export default () => { overviewTick.setValue(!overviewTick.value); }); }, - child: fixed, + child: Widget.Overlay({ + child: Widget.Box({}), + overlays: [ + WorkspaceNumber({ index: index, hpack: 'start', vpack: 'start' }), + fixed + ] + }), })], }); const offset = Math.floor((Hyprland.active.workspace.id - 1) / NUM_OF_WORKSPACES_SHOWN) * NUM_OF_WORKSPACES_SHOWN;