Can a floating menu display live network configuration?

I'm no scripting expert but is it even possible to show the details of network connections in a floating menu? When I'm configuring or troubleshooting network issues I'd love to know simple details usually available clicking back and forth in system preferences (Sonoma). Items would be:
The set Location
If Wifi is connected
If LAN is connected
with the service order.

Very simple, but better than having system settings always open.

I know Siri shortcuts floating menus can be built, which is a widget I'd assume. I love these little small-task centres and I can make use of specific shortcuts while doing specific tasks. But can system information be displayed in a floating menu and pinned to the desktop -yes, like a widget- and would it be built in script or a html/webview?

The floating menu's can run scripts, getting network info should be relatively simple using some terminal commands:

networksetup -getcurrentlocation
networksetup -listnetworkserviceorder
networksetup -listallhardwareports | awk '/Wi-Fi/{getline; print $2}' | xargs networksetup -getairportnetwork

Here a simple example (using Java Script):

async function getCurrentLocation() {

let result = await runShellScript({script: 'networksetup -getcurrentlocation'});

return `Location: ${result}`;
}

If you want to format the output you can return a JSON object with the property BTTMenuAttributedText and use basic HTML within that:

async function getCurrentLocation() {

let result = await runShellScript({script: 'networksetup -getcurrentlocation'});

return `{"BTTMenuAttributedText": "<html><b>Location</b>: ${result}</html>"}`;
}
1 Like

Thanks Andreas

Where do we put the formatting for the HTML (for example, font and style tage)? Is it best to save HTML files locally and link to them or keep it in the script?

Is there a guide or tutorial or someone else's preset that you know of?

This here works in the script to format:

async function setText() {

return `{"BTTMenuAttributedText": "<html><p style='font-family:verdana; font-size:14px; color: #eeee00'>Text color</p></html>"}`;

}