added workspaces

This commit is contained in:
vaxerski
2022-07-01 15:16:54 +02:00
parent 72f478c195
commit c1f92d2a3c
7 changed files with 351 additions and 10 deletions

View File

@ -24,6 +24,7 @@
#ifdef HAVE_HYPRLAND
#include "modules/hyprland/backend.hpp"
#include "modules/hyprland/window.hpp"
#include "modules/hyprland/workspaces.hpp"
#endif
#if defined(__linux__) && !defined(NO_FILESYSTEM)
#include "modules/battery.hpp"

View File

@ -18,10 +18,6 @@ private:
void onEvent(const std::string&);
const Bar& bar_;
IPC ipc;
unsigned app_icon_size_{24};
bool update_app_icon_{true};
std::string app_icon_name_;
util::JsonParser parser_;
std::string lastView;
};

View File

@ -0,0 +1,45 @@
#pragma once
#include <fmt/format.h>
#include <gtkmm/button.h>
#include <gtkmm/label.h>
#include "AModule.hpp"
#include "bar.hpp"
#include "modules/hyprland/backend.hpp"
#include "util/json.hpp"
#include <deque>
#include <algorithm>
#include <spdlog/spdlog.h>
namespace waybar::modules::hyprland {
class Workspaces : public AModule, public sigc::trackable {
public:
Workspaces(const std::string&, const waybar::Bar&, const Json::Value&);
~Workspaces() = default;
auto update() -> void;
private:
void onEvent(const std::string&);
bool handleScroll(GdkEventScroll*);
void configOnLaunch(const Json::Value&);
void updateButtons();
void parseInitHyprlandWorkspaces();
Gtk::Button& addButton(const std::string&);
std::string getIcon(const std::string&);
std::deque<std::string> getAllSortedWS();
bool isNumber(const std::string&);
Gtk::Box box_;
const Bar& bar_;
std::deque<std::string> workspaces;
std::deque<std::string> persistentWorkspaces;
std::unordered_map<std::string, Gtk::Button> buttons_;
std::string focusedWorkspace;
std::mutex mutex_;
};
} // namespace waybar::modules::sway