mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
Fix docs typos
Add removing buttons Adjust handling multiple outputs.
This commit is contained in:
parent
42b6c089f3
commit
22409d27c5
@ -85,6 +85,7 @@ class WorkspaceGroup {
|
||||
auto handle_output_leave() -> void;
|
||||
|
||||
auto add_button(Gtk::Button &button) -> void;
|
||||
auto remove_button(Gtk::Button &button) -> void;
|
||||
auto handle_done() -> void;
|
||||
auto commit() -> void;
|
||||
auto sort_workspaces() -> void;
|
||||
|
@ -6,7 +6,7 @@ waybar - wlr workspaces module
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
The *workspaces* module displays the currently used workspaces in waynland compositor.
|
||||
The *workspaces* module displays the currently used workspaces in wayland compositor.
|
||||
|
||||
# CONFIGURATION
|
||||
|
||||
@ -35,7 +35,7 @@ Addressed by *wlr/workspaces*
|
||||
|
||||
# FORMAT REPLACEMENTS
|
||||
|
||||
*{name}*: Number stripped from workspace value.
|
||||
*{name}*: Name of workspace assigned by compositor
|
||||
|
||||
*{icon}*: Icon, as defined in *format-icons*.
|
||||
|
||||
@ -43,7 +43,7 @@ Addressed by *wlr/workspaces*
|
||||
|
||||
Additional to workspace name matching, the following *format-icons* can be set.
|
||||
|
||||
- *default*: Will be shown, when no string matches is found.
|
||||
- *default*: Will be shown, when no string match is found.
|
||||
- *focused*: Will be shown, when workspace is focused
|
||||
|
||||
# EXAMPLES
|
||||
@ -65,5 +65,6 @@ Additional to workspace name matching, the following *format-icons* can be set.
|
||||
|
||||
# Style
|
||||
|
||||
- *#workspaces*
|
||||
- *#workspaces button*
|
||||
- *#workspaces button.focused*
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "modules/wlr/workspace_manager.hpp"
|
||||
|
||||
#include <gdk/gdkwayland.h>
|
||||
#include <gtkmm.h>
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
@ -77,6 +78,7 @@ WorkspaceManager::~WorkspaceManager() {
|
||||
zwlr_workspace_manager_v1_destroy(workspace_manager_);
|
||||
workspace_manager_ = nullptr;
|
||||
}
|
||||
|
||||
auto WorkspaceManager::remove_workspace_group(uint32_t id) -> void {
|
||||
auto it = std::find_if(groups_.begin(),
|
||||
groups_.end(),
|
||||
@ -111,6 +113,7 @@ WorkspaceGroup::WorkspaceGroup(const Bar &bar, Gtk::Box &box, const Json::Value
|
||||
sort_by_coordinates = config_sort_by_coordinates.asBool();
|
||||
}
|
||||
}
|
||||
|
||||
auto WorkspaceGroup::add_button(Gtk::Button &button) -> void {
|
||||
box_.pack_start(button, false, false);
|
||||
}
|
||||
@ -138,15 +141,25 @@ auto WorkspaceGroup::handle_remove() -> void {
|
||||
|
||||
auto WorkspaceGroup::handle_output_enter(wl_output *output) -> void {
|
||||
spdlog::debug("Output {} assigned to {} group", (void *)output, id_);
|
||||
output_ = output;
|
||||
|
||||
if (output != gdk_wayland_monitor_get_wl_output(bar_.output->monitor->gobj())) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto &workspace : workspaces_) {
|
||||
workspace->show();
|
||||
}
|
||||
output_ = output;
|
||||
}
|
||||
|
||||
auto WorkspaceGroup::handle_output_leave() -> void {
|
||||
spdlog::debug("Output {} remove from {} group", (void *)output_, id_);
|
||||
output_ = nullptr;
|
||||
|
||||
if (output_ != gdk_wayland_monitor_get_wl_output(bar_.output->monitor->gobj())) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto &workspace : workspaces_) {
|
||||
workspace->hide();
|
||||
}
|
||||
@ -176,6 +189,7 @@ auto WorkspaceGroup::handle_done() -> void {
|
||||
workspace->handle_done();
|
||||
}
|
||||
}
|
||||
|
||||
auto WorkspaceGroup::commit() -> void { workspace_manager_.commit(); }
|
||||
|
||||
auto WorkspaceGroup::sort_workspaces() -> void {
|
||||
@ -207,6 +221,10 @@ auto WorkspaceGroup::sort_workspaces() -> void {
|
||||
}
|
||||
}
|
||||
|
||||
auto WorkspaceGroup::remove_button(Gtk::Button &button) -> void {
|
||||
box_.remove(button);
|
||||
}
|
||||
|
||||
Workspace::Workspace(const Bar &bar, const Json::Value &config, WorkspaceGroup &workspace_group,
|
||||
zwlr_workspace_handle_v1 *workspace, uint32_t id)
|
||||
: bar_(bar),
|
||||
@ -244,6 +262,7 @@ Workspace::Workspace(const Bar &bar, const Json::Value &config, WorkspaceGroup &
|
||||
}
|
||||
|
||||
Workspace::~Workspace() {
|
||||
workspace_group_.remove_button(button_);
|
||||
if (!workspace_handle_) {
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user