2018-08-16 14:29:41 +02:00
|
|
|
#include "client.hpp"
|
2018-08-08 23:54:58 +02:00
|
|
|
#include <csignal>
|
2018-08-12 20:25:19 +02:00
|
|
|
#include <iostream>
|
2018-08-08 23:54:58 +02:00
|
|
|
|
|
|
|
namespace waybar {
|
2018-08-16 14:29:41 +02:00
|
|
|
|
|
|
|
static Client* client;
|
|
|
|
|
|
|
|
} // namespace waybar
|
2018-08-08 23:54:58 +02:00
|
|
|
|
|
|
|
int main(int argc, char* argv[])
|
|
|
|
{
|
|
|
|
try {
|
|
|
|
waybar::Client c(argc, argv);
|
|
|
|
waybar::client = &c;
|
2018-09-10 11:16:57 +02:00
|
|
|
std::signal(SIGUSR1, [] (int /*signal*/) {
|
2018-08-08 23:54:58 +02:00
|
|
|
for (auto& bar : waybar::client->bars) {
|
2018-08-16 14:29:41 +02:00
|
|
|
(*bar).toggle();
|
2018-08-08 23:54:58 +02: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;
|
|
|
|
}
|
|
|
|
}
|