Repository navigation
Expand file tree
/
Copy pathmain.cpp
More file actions
69 lines (58 loc) 路 2.17 KB
/
Copy pathmain.cpp
File metadata and controls
69 lines (58 loc) 路 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/**
* @file main.cpp
*/
#include <csignal>
#include <iostream>
#include "fetch.hpp"
#include "Crayon.hpp"
#include "Options.hpp"
void DisplayInfo()
{
std::string delim = ": ";
auto title = Crayon{}.bright().green();
auto ye = Crayon{}.yellow();
std::string username = ye.text(getuser()) + "@" +
ye.text(gethostname("/proc/sys/kernel/hostname"));
std::cout << Crayon{}.underscore().text(username) << std::endl;
std::cout << std::endl;
std::cout << title.text("OS") << delim << getOS("/etc/os-release")
<< getHardwarePlatform() << std::endl;
std::cout << title.text("Host") << delim
<< getHost("/sys/devices/virtual/dmi/id/") << std::endl;
std::cout << title.text("Kernel") << delim
<< getKernel("/proc/sys/kernel/osrelease") << std::endl;
std::cout << title.text("UpTime") << delim << getUpTime("/proc/uptime") << std::endl;
std::cout << title.text("RAM") << delim << getRAM("/proc/meminfo") << std::endl;
std::cout << title.text("shell") << delim << getSHELL("/etc/passwd") << std::endl;
std::cout << title.text("DE") << delim << getDE() << std::endl;
if (resCheck())
{
std::cout << title.text("Resolution") << delim
<< getRES("/sys/class/graphics/fb0/modes") << std::endl;
}
std::cout << title.text("Theme") << delim << getTheme() << std::endl;
std::cout << title.text("Icons") << delim << getIcons() << std::endl;
std::cout << title.text("CPU") << delim << getCPU("/proc/cpuinfo") << std::endl;
if (CpuTempCheck())
{
int temp = getCPUtemp("/sys/class/thermal/thermal_zone0/temp");
std::cout << title.text("CPU Temperature") << delim << float(temp / 1000.0)
<< " 掳C" << std::endl;
}
std::vector<std::string> gpus = getGPU();
for (auto gpu : gpus)
std::cout << title.text("GPU") << delim << gpu << std::endl;
std::cout << title.text("Packages") << delim << getPackages() << std::endl;
printBattery("/sys/class/power_supply/");
std::cout << std::endl;
}
/**
* @returns process status
* @param argc
* @param argv
*/
int main(int argc, char *argv[])
{
DisplayInfo();
return 0;
}