feat(sway): add focused window name

This commit is contained in:
Alexis
2018-08-15 20:17:17 +02:00
parent 9b75302d22
commit f94598c138
10 changed files with 119 additions and 31 deletions

View File

@ -2,7 +2,8 @@
#include <json/json.h>
#include "modules/clock.hpp"
#include "modules/workspaces.hpp"
#include "modules/sway/workspaces.hpp"
#include "modules/sway/window.hpp"
#include "modules/battery.hpp"
#include "modules/memory.hpp"
#include "modules/cpu.hpp"

View File

@ -0,0 +1,30 @@
#pragma once
#include <fmt/format.h>
#include "bar.hpp"
#include "client.hpp"
#include "util/chrono.hpp"
#include "util/json.hpp"
#include "IModule.hpp"
namespace waybar::modules::sway {
class Window : public IModule {
public:
Window(waybar::Bar &bar, Json::Value config);
auto update() -> void;
operator Gtk::Widget &();
private:
std::string _getFocusedNode(Json::Value nodes);
void _getFocusedWindow();
Bar &_bar;
Json::Value _config;
waybar::util::SleeperThread _thread;
Gtk::Label _label;
util::JsonParser _parser;
int _ipcfd;
int _ipcEventfd;
std::string _window;
};
}

View File

@ -7,7 +7,7 @@
#include "util/json.hpp"
#include "IModule.hpp"
namespace waybar::modules {
namespace waybar::modules::sway {
class Workspaces : public IModule {
public:
@ -17,7 +17,6 @@ namespace waybar::modules {
private:
void _addWorkspace(Json::Value node);
std::string _getIcon(std::string name);
Json::Value _getWorkspaces(const std::string data);
bool _handleScroll(GdkEventScroll *e);
int _getPrevWorkspace();
int _getNextWorkspace();