fix: forgot to add file
This commit is contained in:
parent
559234cbba
commit
5dba231074
1 changed files with 75 additions and 0 deletions
75
devices/wim/config/ags/js/bar/buttons/network.js
Normal file
75
devices/wim/config/ags/js/bar/buttons/network.js
Normal file
|
@ -0,0 +1,75 @@
|
|||
import Network from 'resource:///com/github/Aylur/ags/service/network.js';
|
||||
|
||||
import { Label, Box, EventBox, Icon, Revealer } from 'resource:///com/github/Aylur/ags/widget.js';
|
||||
|
||||
import Separator from '../../misc/separator.js';
|
||||
|
||||
|
||||
const Indicator = (props) => Icon({
|
||||
...props,
|
||||
connections: [[Network, (self) => {
|
||||
if (Network.wifi.internet === 'connected' ||
|
||||
Network.wifi.internet === 'connecting') {
|
||||
self.icon = Network.wifi.iconName;
|
||||
}
|
||||
else if (Network.wired.internet === 'connected' ||
|
||||
Network.wired.internet === 'connecting') {
|
||||
self.icon = Network.wired.iconName;
|
||||
}
|
||||
else {
|
||||
self.icon = Network.wifi.iconName;
|
||||
}
|
||||
}]],
|
||||
});
|
||||
|
||||
const APLabel = (props) => Label({
|
||||
...props,
|
||||
connections: [[Network, (self) => {
|
||||
if (Network.wifi.internet === 'connected' ||
|
||||
Network.wifi.internet === 'connecting') {
|
||||
self.label = Network.wifi.ssid;
|
||||
}
|
||||
else if (Network.wired.internet === 'connected' ||
|
||||
Network.wired.internet === 'connecting') {
|
||||
self.label = 'Connected';
|
||||
}
|
||||
else {
|
||||
self.label = 'Disconnected';
|
||||
}
|
||||
}]],
|
||||
});
|
||||
|
||||
const SPACING = 5;
|
||||
|
||||
export default () => {
|
||||
const rev = Revealer({
|
||||
transition: 'slide_right',
|
||||
child: Box({
|
||||
children: [
|
||||
Separator(SPACING),
|
||||
APLabel(),
|
||||
],
|
||||
}),
|
||||
});
|
||||
|
||||
const widget = EventBox({
|
||||
onHover: () => {
|
||||
rev.revealChild = true;
|
||||
},
|
||||
onHoverLost: () => {
|
||||
rev.revealChild = false;
|
||||
},
|
||||
child: Box({
|
||||
className: 'network',
|
||||
children: [
|
||||
Indicator(),
|
||||
|
||||
rev,
|
||||
],
|
||||
}),
|
||||
});
|
||||
|
||||
widget.rev = rev;
|
||||
|
||||
return widget;
|
||||
};
|
Loading…
Reference in a new issue