-
Notifications
You must be signed in to change notification settings - Fork 152
/
main.cpp
36 lines (31 loc) · 855 Bytes
/
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
#include "config.hpp"
#include "discord.hpp"
#include <chrono>
#include <csignal>
#include <thread>
int main(void) {
// define when to shutdown
signal(SIGINT, Shutdown);
signal(SIGTERM, Shutdown);
#ifdef SIGBREAK
signal(SIGBREAK, Shutdown);
#endif
// main config instance
config_t config;
config.update();
// start discord-rpc
initDiscord(config.client_id);
// loop to keep program running also to check for updated config
while (true) {
config.update();
if (config.changed) {
// print and set variables for the presence
config.print();
updatePresence(&config);
config.changed = false;
}
refreshDiscord();
std::this_thread::sleep_for(std::chrono::seconds(1));
}
return 0;
}