dwl/tags: add hide-vacant option
This commit is contained in:
@@ -28,6 +28,7 @@ class Tags : public waybar::AModule {
|
|||||||
const waybar::Bar &bar_;
|
const waybar::Bar &bar_;
|
||||||
Gtk::Box box_;
|
Gtk::Box box_;
|
||||||
std::vector<Gtk::Button> buttons_;
|
std::vector<Gtk::Button> buttons_;
|
||||||
|
bool hide_vacant_;
|
||||||
struct zdwl_ipc_output_v2 *output_status_;
|
struct zdwl_ipc_output_v2 *output_status_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,11 @@ Addressed by *dwl/tags*
|
|||||||
typeof: array ++
|
typeof: array ++
|
||||||
The label to display for each tag.
|
The label to display for each tag.
|
||||||
|
|
||||||
|
*hide-vacant*: ++
|
||||||
|
typeof: bool ++
|
||||||
|
default: false ++
|
||||||
|
If set to true, tags without clients and that are not active will be hidden.
|
||||||
|
|
||||||
*disable-click*: ++
|
*disable-click*: ++
|
||||||
typeof: bool ++
|
typeof: bool ++
|
||||||
default: false ++
|
default: false ++
|
||||||
|
|||||||
@@ -94,7 +94,11 @@ Tags::Tags(const std::string &id, const waybar::Bar &bar, const Json::Value &con
|
|||||||
seat_{nullptr},
|
seat_{nullptr},
|
||||||
bar_(bar),
|
bar_(bar),
|
||||||
box_{bar.orientation, 0},
|
box_{bar.orientation, 0},
|
||||||
|
hide_vacant_(false),
|
||||||
output_status_{nullptr} {
|
output_status_{nullptr} {
|
||||||
|
if (config_["hide-vacant"].asBool()) {
|
||||||
|
hide_vacant_ = config_["hide-vacant"].asBool();
|
||||||
|
}
|
||||||
struct wl_display *display = Client::inst()->wl_display;
|
struct wl_display *display = Client::inst()->wl_display;
|
||||||
struct wl_registry *registry = wl_display_get_registry(display);
|
struct wl_registry *registry = wl_display_get_registry(display);
|
||||||
|
|
||||||
@@ -198,6 +202,12 @@ void Tags::handle_view_tags(uint32_t tag, uint32_t state, uint32_t clients, uint
|
|||||||
} else {
|
} else {
|
||||||
button.get_style_context()->remove_class("urgent");
|
button.get_style_context()->remove_class("urgent");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hide_vacant_ && !clients && !(state & TAG_ACTIVE)) {
|
||||||
|
button.set_visible(false);
|
||||||
|
} else {
|
||||||
|
button.set_visible(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace waybar::modules::dwl */
|
} /* namespace waybar::modules::dwl */
|
||||||
|
|||||||
Reference in New Issue
Block a user