This commit is contained in:
Mars 2025-01-27 23:11:03 -05:00
parent 94a69518b1
commit bd8c149945
Signed by: pupbrained
GPG key ID: 0FF5B8826803F895
9 changed files with 240 additions and 117 deletions

View file

@ -9,7 +9,7 @@
#include "os.h"
enum SessionType { Wayland, X11, TTY, Unknown };
enum SessionType : u8 { Wayland, X11, TTY, Unknown };
fn ParseLineAsNumber(const std::string& input) -> u64 {
usize start = input.find_first_of("0123456789");
@ -132,4 +132,23 @@ fn GetNowPlaying() -> string {
return "";
}
fn GetShell() -> string {
const char* shell = std::getenv("SHELL");
return shell ? shell : "";
}
fn GetProductFamily() -> string {
std::ifstream file("/sys/class/dmi/id/product_family");
if (!file.is_open())
throw std::runtime_error("Failed to open /sys/class/dmi/id/product_family");
std::string productFamily;
std::getline(file, productFamily);
return productFamily;
}
#endif