start out updating macos
This commit is contained in:
parent
ff3d9bcce8
commit
5f2ecf8cae
4 changed files with 31 additions and 3 deletions
|
@ -1,6 +1,8 @@
|
|||
#ifdef __APPLE__
|
||||
|
||||
#include <map>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/utsname.h>
|
||||
|
||||
#include "macos/bridge.h"
|
||||
#include "os.h"
|
||||
|
@ -25,4 +27,29 @@ fn GetOSVersion() -> string { return GetMacOSVersion(); }
|
|||
|
||||
fn GetDesktopEnvironment() -> string { return "Aqua"; }
|
||||
|
||||
fn GetKernelVersion() -> string {
|
||||
struct utsname uts;
|
||||
|
||||
if (uname(&uts) == -1) {
|
||||
ERROR_LOG("uname() failed: {}", std::strerror(errno));
|
||||
return "";
|
||||
}
|
||||
|
||||
return static_cast<const char*>(uts.release);
|
||||
}
|
||||
|
||||
fn GetHost() -> string {
|
||||
std::array<char, 256> hwModel;
|
||||
size_t hwModelLen = sizeof(hwModel);
|
||||
|
||||
sysctlbyname("hw.model", hwModel.data(), &hwModelLen, nullptr, 0);
|
||||
|
||||
// shamelessly stolen from https://github.com/fastfetch-cli/fastfetch/blob/dev/src/detection/host/host_mac.c
|
||||
std::map<string, string> modelNameByHwModel = {
|
||||
{ "Mac14,2", "MacBook Air (M2, 2022)" }
|
||||
};
|
||||
|
||||
return modelNameByHwModel[hwModel.data()];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue