Waybar/src/main.cpp

31 lines
595 B
C++
Raw Normal View History

2018-08-16 12:29:41 +00:00
#include "client.hpp"
2018-08-08 21:54:58 +00:00
#include <csignal>
2018-08-12 18:25:19 +00:00
#include <iostream>
2018-08-08 21:54:58 +00:00
namespace waybar {
2018-08-16 12:29:41 +00:00
static Client* client;
} // namespace waybar
2018-08-08 21:54:58 +00:00
int main(int argc, char* argv[])
{
try {
waybar::Client c(argc, argv);
waybar::client = &c;
2018-09-10 09:16:57 +00:00
std::signal(SIGUSR1, [] (int /*signal*/) {
2018-08-08 21:54:58 +00:00
for (auto& bar : waybar::client->bars) {
bar->toggle();
2018-08-08 21:54:58 +00:00
}
});
return c.main(argc, argv);
} catch (const std::exception& e) {
std::cerr << e.what() << std::endl;
return 1;
} catch (const Glib::Exception& e) {
std::cerr << e.what().c_str() << std::endl;
return 1;
}
}