From 2e1f0509df96e5ec35b1969d3fba2f31f3ed0d68 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Tue, 23 Jan 2024 12:03:58 +0700 Subject: [PATCH] add keyboard tip for apis --- .config/ags/widgets/sideleft/apiwidgets.js | 38 ++++++++++++---------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/.config/ags/widgets/sideleft/apiwidgets.js b/.config/ags/widgets/sideleft/apiwidgets.js index a015f00f..31e372f5 100644 --- a/.config/ags/widgets/sideleft/apiwidgets.js +++ b/.config/ags/widgets/sideleft/apiwidgets.js @@ -1,7 +1,7 @@ import App from 'resource:///com/github/Aylur/ags/app.js'; import Widget from 'resource:///com/github/Aylur/ags/widget.js'; import * as Utils from 'resource:///com/github/Aylur/ags/utils.js'; -const { Box, Button, Entry, EventBox, Icon, Label, Revealer, Scrollable, Stack } = Widget; +const { Box, Button, CenterBox, Entry, EventBox, Icon, Label, Revealer, Scrollable, Stack } = Widget; const { execAsync, exec } = Utils; import { setupCursorHover, setupCursorHoverInfo } from "../../lib/cursorhover.js"; // APIs @@ -86,22 +86,26 @@ function switchToTab(id) { chatEntry.placeholderText = APIS[id].placeholderText, currentApiId = id; } -const apiSwitcher = Box({ - homogeneous: true, - children: [ - Box({ - className: 'sidebar-chat-apiswitcher spacing-h-5', - hpack: 'center', - children: APIS.map((api, id) => Button({ - child: api.tabIcon, - tooltipText: api.name, - setup: setupCursorHover, - onClicked: () => { - switchToTab(id); - } - })), - }), - ] +const apiSwitcher = CenterBox({ + centerWidget: Box({ + className: 'sidebar-chat-apiswitcher spacing-h-5', + hpack: 'center', + children: APIS.map((api, id) => Button({ + child: api.tabIcon, + tooltipText: api.name, + setup: setupCursorHover, + onClicked: () => { + switchToTab(id); + } + })), + }), + endWidget: Button({ + hpack: 'end', + className: 'txt-subtext txt-norm icon-material', + label: 'lightbulb', + tooltipText: 'Use PageUp/PageDown to switch between API pages', + setup: setupCursorHoverInfo, + }), }) export default Widget.Box({