From 731992bf6f3fe5cd762e519b69642a34eb2eae19 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Tue, 2 Apr 2024 21:55:14 +0700 Subject: [PATCH] wifi: right click -> configure with sidebar --- .config/ags/modules/.commonwidgets/tabcontainer.js | 6 ++++++ .config/ags/modules/sideright/quicktoggles.js | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.config/ags/modules/.commonwidgets/tabcontainer.js b/.config/ags/modules/.commonwidgets/tabcontainer.js index f30fadf09..abe642c51 100644 --- a/.config/ags/modules/.commonwidgets/tabcontainer.js +++ b/.config/ags/modules/.commonwidgets/tabcontainer.js @@ -268,6 +268,12 @@ export const ExpandingIconTabContainer = ({ mainBox.nextTab = () => shownIndex.value = Math.min(shownIndex.value + 1, count - 1); mainBox.prevTab = () => shownIndex.value = Math.max(shownIndex.value - 1, 0); mainBox.cycleTab = () => shownIndex.value = (shownIndex.value + 1) % count; + mainBox.focusName = (name) => { + const focusIndex = names.indexOf(name); + if (focusIndex !== -1) { + shownIndex.value = focusIndex; + } + } mainBox.shown = shownIndex; return mainBox; diff --git a/.config/ags/modules/sideright/quicktoggles.js b/.config/ags/modules/sideright/quicktoggles.js index 7f2ff3165..3fe788525 100644 --- a/.config/ags/modules/sideright/quicktoggles.js +++ b/.config/ags/modules/sideright/quicktoggles.js @@ -9,14 +9,14 @@ const { execAsync, exec } = Utils; import { BluetoothIndicator, NetworkIndicator } from '../.commonwidgets/statusicons.js'; import { setupCursorHover } from '../.widgetutils/cursorhover.js'; import { MaterialIcon } from '../.commonwidgets/materialicon.js'; +import { sidebarOptionsStack } from './sideright.js'; export const ToggleIconWifi = (props = {}) => Widget.Button({ className: 'txt-small sidebar-iconbutton', tooltipText: 'Wifi | Right-click to configure', onClicked: () => Network.toggleWifi(), - onSecondaryClickRelease: () => { - execAsync(['bash', '-c', `${userOptions.apps.network}`, '&']); - App.closeWindow('sideright'); + onSecondaryClick: () => { + sidebarOptionsStack.focusName('Wifi networks') }, child: NetworkIndicator(), setup: (self) => {