mirror of
https://github.com/end-4/dots-hyprland.git
synced 2026-06-06 07:19:27 -05:00
only keep strongest network by ssid
(cherry picked from commit 9f0a19e2655637313ac4673b83e6803a30f5c546)
This commit is contained in:
@@ -167,7 +167,16 @@ export default (props) => {
|
||||
child: Box({
|
||||
attribute: {
|
||||
'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,
|
||||
|
||||
Reference in New Issue
Block a user