refactor(modules): const bar
parent
281bab4943
commit
691fb88057
|
@ -26,7 +26,6 @@ class Bar {
|
|||
std::string output_name;
|
||||
uint32_t wl_name;
|
||||
bool visible = true;
|
||||
uint32_t nb_tray_hosts = 0;
|
||||
private:
|
||||
static void handleLogicalPosition(void *, struct zxdg_output_v1 *, int32_t,
|
||||
int32_t);
|
||||
|
|
|
@ -27,10 +27,10 @@ class Bar;
|
|||
|
||||
class Factory {
|
||||
public:
|
||||
Factory(Bar& bar, const Json::Value& config);
|
||||
Factory(const Bar& bar, const Json::Value& config);
|
||||
IModule* makeModule(const std::string &name) const;
|
||||
private:
|
||||
Bar& bar_;
|
||||
const Bar& bar_;
|
||||
const Json::Value& config_;
|
||||
};
|
||||
|
||||
|
|
|
@ -12,13 +12,14 @@ namespace waybar::modules::SNI {
|
|||
|
||||
class Tray : public IModule {
|
||||
public:
|
||||
Tray(Bar& bar, const Json::Value&);
|
||||
Tray(const Bar& bar, const Json::Value&);
|
||||
auto update() -> void;
|
||||
operator Gtk::Widget &();
|
||||
private:
|
||||
void onAdd(std::unique_ptr<Item>& item);
|
||||
void onRemove(std::unique_ptr<Item>& item);
|
||||
|
||||
static inline std::size_t nb_hosts_ = 0;
|
||||
std::thread thread_;
|
||||
const Json::Value& config_;
|
||||
Gtk::Box box_;
|
||||
|
|
|
@ -12,12 +12,12 @@ namespace waybar::modules::sway {
|
|||
|
||||
class Mode : public ALabel {
|
||||
public:
|
||||
Mode(waybar::Bar&, const Json::Value&);
|
||||
Mode(const waybar::Bar&, const Json::Value&);
|
||||
auto update() -> void;
|
||||
private:
|
||||
void worker();
|
||||
|
||||
Bar& bar_;
|
||||
const Bar& bar_;
|
||||
waybar::util::SleeperThread thread_;
|
||||
util::JsonParser parser_;
|
||||
Ipc ipc_;
|
||||
|
|
|
@ -13,14 +13,14 @@ namespace waybar::modules::sway {
|
|||
|
||||
class Window : public ALabel {
|
||||
public:
|
||||
Window(waybar::Bar&, const Json::Value&);
|
||||
Window(const waybar::Bar&, const Json::Value&);
|
||||
auto update() -> void;
|
||||
private:
|
||||
void worker();
|
||||
std::tuple<int, std::string> getFocusedNode(Json::Value nodes);
|
||||
void getFocusedWindow();
|
||||
|
||||
Bar& bar_;
|
||||
const Bar& bar_;
|
||||
waybar::util::SleeperThread thread_;
|
||||
util::JsonParser parser_;
|
||||
Ipc ipc_;
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace waybar::modules::sway {
|
|||
|
||||
class Workspaces : public IModule {
|
||||
public:
|
||||
Workspaces(waybar::Bar&, const Json::Value&);
|
||||
Workspaces(const waybar::Bar&, const Json::Value&);
|
||||
auto update() -> void;
|
||||
operator Gtk::Widget &();
|
||||
private:
|
||||
|
@ -23,7 +23,7 @@ class Workspaces : public IModule {
|
|||
std::string getPrevWorkspace();
|
||||
std::string getNextWorkspace();
|
||||
|
||||
Bar& bar_;
|
||||
const Bar& bar_;
|
||||
const Json::Value& config_;
|
||||
waybar::util::SleeperThread thread_;
|
||||
Gtk::Box box_;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "factory.hpp"
|
||||
|
||||
waybar::Factory::Factory(Bar& bar, const Json::Value& config)
|
||||
waybar::Factory::Factory(const Bar& bar, const Json::Value& config)
|
||||
: bar_(bar), config_(config)
|
||||
{}
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
#include <iostream>
|
||||
|
||||
waybar::modules::SNI::Tray::Tray(Bar& bar, const Json::Value &config)
|
||||
: config_(config), watcher_(), host_(bar.nb_tray_hosts, config,
|
||||
waybar::modules::SNI::Tray::Tray(const Bar& bar, const Json::Value &config)
|
||||
: config_(config), watcher_(), host_(nb_hosts_, config,
|
||||
std::bind(&Tray::onAdd, this, std::placeholders::_1),
|
||||
std::bind(&Tray::onRemove, this, std::placeholders::_1))
|
||||
{
|
||||
|
@ -11,7 +11,7 @@ waybar::modules::SNI::Tray::Tray(Bar& bar, const Json::Value &config)
|
|||
if (config_["spacing"].isUInt()) {
|
||||
box_.set_spacing(config_["spacing"].asUInt());
|
||||
}
|
||||
bar.nb_tray_hosts += 1;
|
||||
nb_hosts_ += 1;
|
||||
}
|
||||
|
||||
void waybar::modules::SNI::Tray::onAdd(std::unique_ptr<Item>& item)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "modules/sway/mode.hpp"
|
||||
|
||||
waybar::modules::sway::Mode::Mode(Bar& bar, const Json::Value& config)
|
||||
waybar::modules::sway::Mode::Mode(const Bar& bar, const Json::Value& config)
|
||||
: ALabel(config, "{}"), bar_(bar)
|
||||
{
|
||||
ipc_.connect();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "modules/sway/window.hpp"
|
||||
|
||||
waybar::modules::sway::Window::Window(Bar &bar, const Json::Value& config)
|
||||
waybar::modules::sway::Window::Window(const Bar &bar, const Json::Value& config)
|
||||
: ALabel(config, "{}"), bar_(bar), windowId_(-1)
|
||||
{
|
||||
label_.set_name("window");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "modules/sway/workspaces.hpp"
|
||||
|
||||
waybar::modules::sway::Workspaces::Workspaces(Bar& bar,
|
||||
waybar::modules::sway::Workspaces::Workspaces(const Bar& bar,
|
||||
const Json::Value& config)
|
||||
: bar_(bar), config_(config), scrolling_(false)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue