-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
50 lines (41 loc) · 1.09 KB
/
main.cpp
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
#include "battery.hpp"
#include "cpu_temp.hpp"
#include "display.hpp"
#include "load_avg.hpp"
#include "mail_dir.hpp"
#include "status.hpp"
#include "time.hpp"
#include "unicode_time.hpp"
#include "wlan.hpp"
#include <iostream>
#include <thread>
int main()
{
using namespace dwmstatus;
using namespace std::chrono;
using namespace std;
try {
display_ptr display = make_unique<dwmstatus::stdout>();
status_ptr status = make_unique<dwmstatus::time>();
{
#include "config.inc"
}
if (!display) {
throw invalid_argument("unspecified display in configuration");
}
if (!status) {
throw invalid_argument("unspecified status in configuration");
}
while (true) {
const auto t = system_clock::now();
if (const auto s = status->update(t); s) {
display->set_status(s.value());
}
this_thread::sleep_until(t + seconds(1));
}
} catch (const exception& err) {
cerr << err.what() << endl;
return 1;
}
return 0;
}