feat: kernel network statistics reporting, new Network configuration applet
This commit is contained in:
@@ -158,6 +158,7 @@ namespace Montauk {
|
||||
static constexpr uint64_t SYS_CLIPBOARD_CLEAR = 122;
|
||||
static constexpr uint64_t SYS_INPUT_WAIT = 123;
|
||||
static constexpr uint64_t SYS_DRIVELABEL = 124;
|
||||
static constexpr uint64_t SYS_NETSTATUS = 125;
|
||||
|
||||
static constexpr uint32_t CLIPBOARD_MAX_TEXT_BYTES = 256 * 1024;
|
||||
|
||||
@@ -188,6 +189,16 @@ namespace Montauk {
|
||||
uint32_t dnsServer; // network byte order
|
||||
};
|
||||
|
||||
struct NetStatus {
|
||||
uint8_t initialized;
|
||||
uint8_t linkUp;
|
||||
uint8_t polling;
|
||||
uint8_t _pad0;
|
||||
char driver[32];
|
||||
uint64_t rxPackets;
|
||||
uint64_t txPackets;
|
||||
};
|
||||
|
||||
struct DateTime {
|
||||
uint16_t Year;
|
||||
uint8_t Month;
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* settings.hpp
|
||||
* Montauk Toolkit helpers for loading desktop appearance settings
|
||||
* Copyright (c) 2026 Daniel Hammer
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <montauk/config.h>
|
||||
#include <montauk/syscall.h>
|
||||
#include "gui/gui.hpp"
|
||||
|
||||
namespace gui::mtk {
|
||||
|
||||
inline Color color_from_rgb_int(int64_t rgb, Color fallback = colors::ACCENT) {
|
||||
if (rgb < 0) return fallback;
|
||||
return Color::from_rgb((uint8_t)((rgb >> 16) & 0xFF),
|
||||
(uint8_t)((rgb >> 8) & 0xFF),
|
||||
(uint8_t)(rgb & 0xFF));
|
||||
}
|
||||
|
||||
inline Color load_system_accent(Color fallback = colors::ACCENT) {
|
||||
char user[64] = {};
|
||||
if (montauk::getuser(user, sizeof(user)) > 0 && user[0]) {
|
||||
auto doc = montauk::config::load_user(user, "desktop");
|
||||
int64_t accent = doc.get_int("appearance.accent_color", -1);
|
||||
if (accent >= 0) {
|
||||
Color color = color_from_rgb_int(accent, fallback);
|
||||
doc.destroy();
|
||||
return color;
|
||||
}
|
||||
doc.destroy();
|
||||
}
|
||||
|
||||
auto doc = montauk::config::load("desktop");
|
||||
int64_t accent = doc.get_int("appearance.accent_color", -1);
|
||||
Color color = color_from_rgb_int(accent, fallback);
|
||||
doc.destroy();
|
||||
return color;
|
||||
}
|
||||
|
||||
} // namespace gui::mtk
|
||||
@@ -197,6 +197,7 @@ namespace montauk {
|
||||
// Network configuration
|
||||
inline void get_netcfg(Montauk::NetCfg* out) { syscall1(Montauk::SYS_GETNETCFG, (uint64_t)out); }
|
||||
inline int set_netcfg(const Montauk::NetCfg* cfg) { return (int)syscall1(Montauk::SYS_SETNETCFG, (uint64_t)cfg); }
|
||||
inline int net_status(Montauk::NetStatus* out) { return (int)syscall1(Montauk::SYS_NETSTATUS, (uint64_t)out); }
|
||||
|
||||
// Sockets
|
||||
inline int socket(int type) {
|
||||
|
||||
Reference in New Issue
Block a user