This gist contains an instruction to configure SwiftBar and launchd to show a network interface indicator on the macOS menu bar. This allows you to tell when an ethernet connection is used over a wireless connection (a feature that is not provided by macOS).
First, put the files attached below in the following locations:
network-interface.shin your SwiftBar plugin folder (e.g.,~/.swiftbar_plugins/network-interface.sh(change the permission octal to755).org.jazali.network-listener.plistin/Library/LaunchAgents/org.jazali.network-listener.plist(change the permisson octal to600).refresh_swiftbar_network_interface.shin the directory where you put your scripts; e.g.,~/scripts/refresh_swiftbar_network_interface.sh(change the permission octal to755).
Note that you can change the identifier org.jazali into any unique identifier you desire, such as com.user. Also, the icons in network-interface.sh are SF Symbols icons, which should be fully supported on all modern Apple devices.
After that, use launchd's launchctl bootstrap to load the listener:
sudo launchctl bootstrap gui/$(id -u) /Library/LaunchAgents/org.jazali.network-listener.plist
You can also use launchctl bootout to unload the listener if you ever need to:
sudo launchctl bootout gui/$(id -u) /Library/LaunchAgents/org.jazali.network-listener.plist
works great. thanks.