Waybar/include/modules/workspaces.hpp

34 lines
857 B
C++
Raw Normal View History

2018-08-08 21:54:58 +00:00
#pragma once
#include <fmt/format.h>
#include "bar.hpp"
#include "client.hpp"
#include "util/chrono.hpp"
2018-08-09 10:05:48 +00:00
#include "IModule.hpp"
2018-08-08 21:54:58 +00:00
namespace waybar::modules {
2018-08-09 10:05:48 +00:00
class Workspaces : public IModule {
2018-08-08 21:54:58 +00:00
public:
2018-08-09 10:05:48 +00:00
Workspaces(waybar::Bar &bar);
2018-08-08 21:54:58 +00:00
auto update() -> void;
operator Gtk::Widget &();
private:
2018-08-09 18:22:01 +00:00
void _updateThread();
static void _handle_idle(void *data,
struct org_kde_kwin_idle_timeout *timer);
static void _handle_resume(void *data,
struct org_kde_kwin_idle_timeout *timer);
2018-08-08 21:54:58 +00:00
void _addWorkspace(Json::Value node);
Json::Value _getWorkspaces();
Bar &_bar;
2018-08-09 18:22:01 +00:00
util::SleeperThread *_thread;
2018-08-08 21:54:58 +00:00
Gtk::Box *_box;
std::unordered_map<int, Gtk::Button> _buttons;
int _ipcSocketfd;
int _ipcEventSocketfd;
struct org_kde_kwin_idle_timeout *_idle_timer;
2018-08-08 21:54:58 +00:00
};
}