Added the ability to enable dynamic network icons for netstat module. (#376)

This commit is contained in:
Jas Singh
2024-10-26 17:21:27 -07:00
committed by GitHub
parent c1bbb11b86
commit 86ff27fd3e
5 changed files with 27 additions and 12 deletions

View File

@@ -1,3 +1,4 @@
const network = await Service.import('network');
import options from 'options';
import { module } from '../module';
import { inputHandler } from 'customModules/utils';
@@ -15,6 +16,7 @@ const {
labelType,
networkInterface,
rateUnit,
dynamicIcon,
icon,
round,
leftClick,
@@ -59,6 +61,13 @@ export const Netstat = (): BarBoxChild => {
};
const netstatModule = module({
useTextIcon: dynamicIcon.bind('value').as((useDynamicIcon) => !useDynamicIcon),
icon: Utils.merge([network.bind('primary'), network.bind('wifi'), network.bind('wired')], (pmry, wfi, wrd) => {
if (pmry === 'wired') {
return wrd.icon_name;
}
return wfi.icon_name;
}),
textIcon: icon.bind('value'),
label: Utils.merge(
[networkUsage.bind('value'), labelType.bind('value')],