Files
custum-hyprpanel/modules/menus/network/ethernet/index.ts
Rubin Bhandari 3cc3fa5d42 feat: launcher icon auto detect from os name (#413)
* feat: launcher icon auto detect from os name

* feat: add more

* fix: revamp distro icon

* feat: on hover only show actions if available on notifications (#396)

* feat: on hover only show actions if available on notifications

* feat: on hover only show actions if available on notifications

* fix: make the change configurable

* fix: remove unneeded op

* Added the ability to scale a popover. (#443)

* Added the ability to scale a popover.

* Removed redundant code

* Provide a cli command to clear notifications. (#444)

* Added a cpu temperature custom module. (#446)

* Added a CPU Temperature module.

* Update defauls and add wiki link.

* Move celsius to fahr conversion to method.

* fix: move distoicons , use capitalizeLetter func

* fix: lint

* Rename dissto.ts to distro.ts

* Update lib/utils.ts

---------

Co-authored-by: Jas Singh <jaskiratpal.singh@outlook.com>
2024-11-08 01:31:21 -08:00

69 lines
3.1 KiB
TypeScript

import { BoxWidget } from 'lib/types/widget';
import { capitalizeFirstLetter } from 'lib/utils';
const network = await Service.import('network');
const Ethernet = (): BoxWidget => {
return Widget.Box({
class_name: 'menu-section-container ethernet',
vertical: true,
children: [
Widget.Box({
class_name: 'menu-label-container',
hpack: 'fill',
child: Widget.Label({
class_name: 'menu-label',
hexpand: true,
hpack: 'start',
label: 'Ethernet',
}),
}),
Widget.Box({
class_name: 'menu-items-section',
vertical: true,
child: Widget.Box({
class_name: 'menu-content',
vertical: true,
setup: (self) => {
self.hook(network, () => {
return (self.child = Widget.Box({
class_name: 'network-element-item',
child: Widget.Box({
hpack: 'start',
children: [
Widget.Icon({
class_name: `network-icon ethernet ${network.wired.state === 'activated' ? 'active' : ''}`,
tooltip_text: network.wired.internet,
icon: `${network.wired['icon_name']}`,
}),
Widget.Box({
class_name: 'connection-container',
vertical: true,
children: [
Widget.Label({
class_name: 'active-connection',
hpack: 'start',
truncate: 'end',
wrap: true,
label: `Ethernet Connection ${network.wired.state !== 'unknown' && typeof network.wired?.speed === 'number' ? `(${network.wired?.speed / 1000} Gbps)` : ''}`,
}),
Widget.Label({
hpack: 'start',
class_name: 'connection-status dim',
label: capitalizeFirstLetter(network.wired.internet),
}),
],
}),
],
}),
}));
});
},
}),
}),
],
});
};
export { Ethernet };