stuffs
This commit is contained in:
parent
94a69518b1
commit
bd8c149945
9 changed files with 240 additions and 117 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue