Merge pull request #322 from RX14/feature/generic-scroll
Allow scrolling on the entire bar surface
This commit is contained in:
commit
2cb70c7324
|
@ -7,8 +7,8 @@
|
||||||
#include "bar.hpp"
|
#include "bar.hpp"
|
||||||
#include "client.hpp"
|
#include "client.hpp"
|
||||||
#include "modules/sway/ipc/client.hpp"
|
#include "modules/sway/ipc/client.hpp"
|
||||||
#include "util/sleeper_thread.hpp"
|
|
||||||
#include "util/json.hpp"
|
#include "util/json.hpp"
|
||||||
|
#include "util/sleeper_thread.hpp"
|
||||||
|
|
||||||
namespace waybar::modules::sway {
|
namespace waybar::modules::sway {
|
||||||
|
|
||||||
|
@ -27,10 +27,10 @@ class Workspaces : public IModule, public sigc::trackable {
|
||||||
Gtk::Button& addButton(const Json::Value&);
|
Gtk::Button& addButton(const Json::Value&);
|
||||||
void onButtonReady(const Json::Value&, Gtk::Button&);
|
void onButtonReady(const Json::Value&, Gtk::Button&);
|
||||||
std::string getIcon(const std::string&, const Json::Value&);
|
std::string getIcon(const std::string&, const Json::Value&);
|
||||||
bool handleScroll(GdkEventScroll*);
|
|
||||||
const std::string getCycleWorkspace(std::vector<Json::Value>::iterator, bool prev) const;
|
const std::string getCycleWorkspace(std::vector<Json::Value>::iterator, bool prev) const;
|
||||||
uint16_t getWorkspaceIndex(const std::string& name) const;
|
uint16_t getWorkspaceIndex(const std::string& name) const;
|
||||||
std::string trimWorkspaceName(std::string);
|
std::string trimWorkspaceName(std::string);
|
||||||
|
bool handleScroll(GdkEventScroll*);
|
||||||
|
|
||||||
const Bar& bar_;
|
const Bar& bar_;
|
||||||
const Json::Value& config_;
|
const Json::Value& config_;
|
||||||
|
|
|
@ -15,6 +15,11 @@ Workspaces::Workspaces(const std::string &id, const Bar &bar, const Json::Value
|
||||||
ipc_.signal_event.connect(sigc::mem_fun(*this, &Workspaces::onEvent));
|
ipc_.signal_event.connect(sigc::mem_fun(*this, &Workspaces::onEvent));
|
||||||
ipc_.signal_cmd.connect(sigc::mem_fun(*this, &Workspaces::onCmd));
|
ipc_.signal_cmd.connect(sigc::mem_fun(*this, &Workspaces::onCmd));
|
||||||
ipc_.sendCmd(IPC_GET_WORKSPACES);
|
ipc_.sendCmd(IPC_GET_WORKSPACES);
|
||||||
|
if (!config["disable-workspace-scroll"].asBool()) {
|
||||||
|
auto &window = const_cast<Bar&>(bar_).window;
|
||||||
|
window.add_events(Gdk::SCROLL_MASK | Gdk::SMOOTH_SCROLL_MASK);
|
||||||
|
window.signal_scroll_event().connect(sigc::mem_fun(*this, &Workspaces::handleScroll));
|
||||||
|
}
|
||||||
// Launch worker
|
// Launch worker
|
||||||
worker();
|
worker();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue