Commit 92edbe5d authored by Minteck's avatar Minteck 😸

200331 - Commit final

parent d89158d0
Pipeline #131230662 passed with stages
in 1 minute and 14 seconds
......@@ -60,7 +60,14 @@
"qs_battery": "Power",
"qs_timedate": "Time and Date",
"qs_exit": "System",
"qs_output_volume": "Output Volume"
"qs_output_volume": "Output Volume",
"qs_network_online": "Connected",
"qs_network_connecting": "Establishing Connection...",
"qs_network_offline": "Disconnected",
"qs_network_error": "Connection Error",
"qs_network_unknown": "Unable to connect to network service",
"qs_network_unknownssid": "Unnamed Wireless Network",
"qs_network_openwifi": "Open Network"
},
"localized_default_apps": {
"com.future.shell": "Future Desktop",
......
......@@ -88,6 +88,18 @@
</div>
<div id="qs-container-network" class="qs-container" style="display:none;">
<!-- Network -->
<center><table>
<tbody>
<tr id="qs-network-wired">
<td id="qs-network-wiredicon"></td>
<td><b id="qs-network-wiredstatus"></b></td>
</tr>
<tr id="qs-network-wireless">
<td id="qs-network-wlicon"></td>
<td><b id="qs-network-wlname"></b><br><i id="qs-network-wlid"></i><br><span id="qs-network-wlsec"></span></td>
</tr>
</tbody>
</table></center>
</div>
<div id="qs-container-battery" class="qs-container" style="display:none;">
<!-- Battery -->
......@@ -161,6 +173,101 @@
document.getElementById('qs_volume_slider').value = vol;
});
}
// Network
ifaces = Object.keys(os.networkInterfaces());
image = "../../icons/shell/network/wired_error.svg";
wiredprocessed = false;
ifaces.forEach((iface, index) => {
if (iface.toLowerCase().includes("enp") || iface.toLowerCase().includes("eth")) { // Check if interface is Ethernet
wiredprocessed = true;
e = os.networkInterfaces()[iface];
if (e.address.trim() != "" && e.family.startsWith("IP") && e.mac != "00:00:00:00:00:00") { // Check if Ethernet is connected and enabled
image = "../../icons/shell/network/wired_online.svg";
} else {
if (e.address.trim() == "") {
image = "../../icons/shell/network/wired_connecting.svg";
}
if (!e.family.startsWith("IP")) {
image = "../../icons/shell/network/wired_offline.svg";
}
if (e.mac == "00:00:00:00:00:00") {
image = "../../icons/shell/network/wired_error.svg";
}
}
}
})
wifi.init({
iface: null,
});
wifi.getCurrentConnections((err, conn) => {
if (!wiredprocessed) {
c = conn[0];
if (c.ssid.trim() == "" || c.bssid.trim() == "") {
image = "../../icons/shell/network/wireless_connecting.svg";
} else {
if (c.quality < 5) {
image = "../../icons/shell/network/wireless_0.svg";
} else if (c.quality <= 20) {
image = "../../icons/shell/network/wireless_1.svg";
} else if (c.quality > 20 && c.quality <= 35) {
image = "../../icons/shell/network/wireless_2.svg";
} else if (c.quality > 35 && c.quality <= 80) {
image = "../../icons/shell/network/wireless_3.svg";
} else if (c.quality > 80) {
image = "../../icons/shell/network/wireless_4.svg";
}
}
}
document.getElementById('qs-network-wiredicon').innerHTML = '<img src="' + image + '" width="32px" height="32px" style="filter:brightness(200%);vertical-align:middle;">';
document.getElementById('qs-network-wlicon').innerHTML = '<img src="' + image + '" width="32px" height="32px" style="filter:brightness(200%);vertical-align:middle;">';
if (wiredprocessed) {
document.getElementById('qs-network-wired').style.display = "block";
document.getElementById('qs-network-wireless').style.display = "none";
if (image == "../../icons/shell/network/wired_online.svg") {
document.getElementById('qs-network-wiredstatus').innerHTML = lang.shell.qs_network_online;
} else if (image == "../../icons/shell/network/wired_connecting.svg") {
document.getElementById('qs-network-wiredstatus').innerHTML = lang.shell.qs_network_connecting
} else if (image == "../../icons/shell/network/wired_offline.svg") {
document.getElementById('qs-network-wiredstatus').innerHTML = lang.shell.qs_network_offline
} else if (image == "../../icons/shell/network/wired_error.svg") {
document.getElementById('qs-network-wiredstatus').innerHTML = lang.shell.qs_network_error
} else {
document.getElementById('qs-network-wiredstatus').innerHTML = lang.shell.qs_network_unknown
}
} else {
if (typeof c != "undefined") {
document.getElementById('qs-network-wireless').style.display = "block";
document.getElementById('qs-network-wired').style.display = "none";
if (c.ssid == "") {
document.getElementById('qs-network-wlname').innerHTML = lang.shell.qs_network_unknownssid;
} else {
document.getElementById('qs-network-wlname').innerHTML = c.ssid;
}
document.getElementById('qs-network-wlid').innerHTML = c.bssid;
if (c.security == "") {
document.getElementById('qs-network-wlsec').innerHTML = lang.shell.qs_network_openwifi;
} else {
document.getElementById('qs-network-wlsec').innerHTML = c.security;
}
} else {
document.getElementById('qs-network-wired').style.display = "block";
document.getElementById('qs-network-wireless').style.display = "none";
if (image == "../../icons/shell/network/wired_online.svg") {
document.getElementById('qs-network-wiredstatus').innerHTML = lang.shell.qs_network_online
} else if (image == "../../icons/shell/network/wired_connecting.svg") {
document.getElementById('qs-network-wiredstatus').innerHTML = lang.shell.qs_network_connecting
} else if (image == "../../icons/shell/network/wired_offline.svg") {
document.getElementById('qs-network-wiredstatus').innerHTML = lang.shell.qs_network_offline
} else if (image == "../../icons/shell/network/wired_error.svg") {
document.getElementById('qs-network-wiredstatus').innerHTML = lang.shell.qs_network_error
} else {
document.getElementById('qs-network-wiredstatus').innerHTML = lang.shell.qs_network_unknown
}
}
}
});
}, 2000)
</script>
<style>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment