fix(workspaces): proper order workspace
parent
b987668f97
commit
4659f04454
29
src/bar.cpp
29
src/bar.cpp
|
@ -10,39 +10,39 @@
|
||||||
#include "modules/memory.hpp"
|
#include "modules/memory.hpp"
|
||||||
#include "modules/cpu.hpp"
|
#include "modules/cpu.hpp"
|
||||||
|
|
||||||
static void handle_geometry(void *data, struct wl_output *wl_output, int32_t x,
|
static void handleGeometry(void *data, struct wl_output *wl_output, int32_t x,
|
||||||
int32_t y, int32_t physical_width, int32_t physical_height, int32_t subpixel,
|
int32_t y, int32_t physical_width, int32_t physical_height, int32_t subpixel,
|
||||||
const char *make, const char *model, int32_t transform)
|
const char *make, const char *model, int32_t transform)
|
||||||
{
|
{
|
||||||
// Nothing here
|
// Nothing here
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_mode(void *data, struct wl_output *wl_output, uint32_t f,
|
static void handleMode(void *data, struct wl_output *wl_output, uint32_t f,
|
||||||
int32_t w, int32_t h, int32_t refresh)
|
int32_t w, int32_t h, int32_t refresh)
|
||||||
{
|
{
|
||||||
auto o = reinterpret_cast<waybar::Bar *>(data);
|
auto o = reinterpret_cast<waybar::Bar *>(data);
|
||||||
o->setWidth(w);
|
o->setWidth(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_done(void *data, struct wl_output *)
|
static void handleDone(void *data, struct wl_output *)
|
||||||
{
|
{
|
||||||
// Nothing here
|
// Nothing here
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_scale(void *data, struct wl_output *wl_output,
|
static void handleScale(void *data, struct wl_output *wl_output,
|
||||||
int32_t factor)
|
int32_t factor)
|
||||||
{
|
{
|
||||||
// Nothing here
|
// Nothing here
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct wl_output_listener outputListener = {
|
static const struct wl_output_listener outputListener = {
|
||||||
.geometry = handle_geometry,
|
.geometry = handleGeometry,
|
||||||
.mode = handle_mode,
|
.mode = handleMode,
|
||||||
.done = handle_done,
|
.done = handleDone,
|
||||||
.scale = handle_scale,
|
.scale = handleScale,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void layer_surface_handle_configure(
|
static void layerSurfaceHandleConfigure(
|
||||||
void *data, struct zwlr_layer_surface_v1 *surface, uint32_t serial,
|
void *data, struct zwlr_layer_surface_v1 *surface, uint32_t serial,
|
||||||
uint32_t width, uint32_t height)
|
uint32_t width, uint32_t height)
|
||||||
{
|
{
|
||||||
|
@ -59,7 +59,7 @@ static void layer_surface_handle_configure(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void layer_surface_handle_closed(void *data,
|
static void layerSurfaceHandleClosed(void *data,
|
||||||
struct zwlr_layer_surface_v1 *surface)
|
struct zwlr_layer_surface_v1 *surface)
|
||||||
{
|
{
|
||||||
auto o = reinterpret_cast<waybar::Bar *>(data);
|
auto o = reinterpret_cast<waybar::Bar *>(data);
|
||||||
|
@ -71,8 +71,8 @@ static void layer_surface_handle_closed(void *data,
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct zwlr_layer_surface_v1_listener layerSurfaceListener = {
|
static const struct zwlr_layer_surface_v1_listener layerSurfaceListener = {
|
||||||
.configure = layer_surface_handle_configure,
|
.configure = layerSurfaceHandleConfigure,
|
||||||
.closed = layer_surface_handle_closed,
|
.closed = layerSurfaceHandleClosed,
|
||||||
};
|
};
|
||||||
|
|
||||||
waybar::Bar::Bar(Client &client, std::unique_ptr<struct wl_output *> &&p_output)
|
waybar::Bar::Bar(Client &client, std::unique_ptr<struct wl_output *> &&p_output)
|
||||||
|
@ -106,8 +106,7 @@ auto waybar::Bar::_setupCss() -> void
|
||||||
_styleContext = Gtk::StyleContext::create();
|
_styleContext = Gtk::StyleContext::create();
|
||||||
|
|
||||||
// load our css file, wherever that may be hiding
|
// load our css file, wherever that may be hiding
|
||||||
if (_cssProvider->load_from_path(client.css_file))
|
if (_cssProvider->load_from_path(client.css_file)) {
|
||||||
{
|
|
||||||
Glib::RefPtr<Gdk::Screen> screen = window.get_screen();
|
Glib::RefPtr<Gdk::Screen> screen = window.get_screen();
|
||||||
_styleContext->add_provider_for_screen(screen, _cssProvider,
|
_styleContext->add_provider_for_screen(screen, _cssProvider,
|
||||||
GTK_STYLE_PROVIDER_PRIORITY_USER);
|
GTK_STYLE_PROVIDER_PRIORITY_USER);
|
||||||
|
@ -116,8 +115,8 @@ auto waybar::Bar::_setupCss() -> void
|
||||||
|
|
||||||
auto waybar::Bar::setWidth(int width) -> void
|
auto waybar::Bar::setWidth(int width) -> void
|
||||||
{
|
{
|
||||||
std::cout << fmt::format("Bar width configured: {}", width) << std::endl;
|
|
||||||
if (width == this->_width) return;
|
if (width == this->_width) return;
|
||||||
|
std::cout << fmt::format("Bar width configured: {}", width) << std::endl;
|
||||||
this->_width = width;
|
this->_width = width;
|
||||||
window.set_size_request(width);
|
window.set_size_request(width);
|
||||||
window.resize(width, client.height);
|
window.resize(width, client.height);
|
||||||
|
|
|
@ -85,6 +85,7 @@ void waybar::modules::WorkspaceSelector::_addWorkspace(Json::Value node)
|
||||||
ipc_single_command(_ipcSocketfd, IPC_COMMAND, value.c_str(), &size);
|
ipc_single_command(_ipcSocketfd, IPC_COMMAND, value.c_str(), &size);
|
||||||
});
|
});
|
||||||
_box->pack_start(button, false, false, 0);
|
_box->pack_start(button, false, false, 0);
|
||||||
|
_box->reorder_child(button, node["num"].asInt() - 1);
|
||||||
if (node["focused"].asBool()) {
|
if (node["focused"].asBool()) {
|
||||||
button.get_style_context()->add_class("current");
|
button.get_style_context()->add_class("current");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue