Can a floating menu display live network configuration?

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