forked from Shinonome/dots-hyprland
only keep strongest network by ssid (#506)
This commit is contained in:
@@ -167,7 +167,16 @@ export default (props) => {
|
|||||||
child: Box({
|
child: Box({
|
||||||
attribute: {
|
attribute: {
|
||||||
'updateNetworks': (self) => {
|
'updateNetworks': (self) => {
|
||||||
self.children = Network.wifi?.access_points?.map(n => WifiNetwork(n));
|
const accessPoints = Network.wifi?.access_points || [];
|
||||||
|
self.children = Object.values(accessPoints.reduce((a, accessPoint) => {
|
||||||
|
// Only keep max strength networks by ssid
|
||||||
|
if (!a[accessPoint.ssid] || a[accessPoint.ssid].strength < accessPoint.strength) {
|
||||||
|
a[accessPoint.ssid] = accessPoint;
|
||||||
|
a[accessPoint.ssid].active |= accessPoint.active;
|
||||||
|
}
|
||||||
|
|
||||||
|
return a;
|
||||||
|
}, {})).map(n => WifiNetwork(n));
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
vertical: true,
|
vertical: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user