River tags: only show occupied tags #2101
Unanswered
fritzrehde
asked this question in
Q&A
Replies: 3 comments 2 replies
-
Would be handy if #tags button:not(.occupied) {
visibility: hidden;
} could be implemented in the styling. The selector works but the visibility tag isn't accepted. |
Beta Was this translation helpful? Give feedback.
0 replies
-
As @alrayyes pointed out, a handy method for obtaining vacant tags would be to define button visibility within the styling. Since this functionality is managed by the Gtk library, this feature should likely be addressed there. I came up with a hackish solution involving the addition of a few extra lines in waybar's river module. I presume that for other window managers, a similar approach may be feasible. diff --git a/src/modules/river/tags.cpp b/src/modules/river/tags.cpp
index baa6b7ec..613edfc2 100644
--- a/src/modules/river/tags.cpp
+++ b/src/modules/river/tags.cpp
@@ -191,8 +191,12 @@ void Tags::handle_focused_tags(uint32_t tags) {
for (size_t i = 0; i < buttons_.size(); ++i) {
if ((1 << i) & tags) {
buttons_[i].get_style_context()->add_class("focused");
+ buttons_[i].show();
} else {
buttons_[i].get_style_context()->remove_class("focused");
+ if (!buttons_[i].get_style_context()->has_class("occupied")) {
+ buttons_[i].hide();
+ }
}
}
}
@@ -207,8 +211,12 @@ void Tags::handle_view_tags(struct wl_array *view_tags) {
for (size_t i = 0; i < buttons_.size(); ++i) {
if ((1 << i) & tags) {
buttons_[i].get_style_context()->add_class("occupied");
+ buttons_[i].show();
} else {
buttons_[i].get_style_context()->remove_class("occupied");
+ if (!buttons_[i].get_style_context()->has_class("focused")) {
+ buttons_[i].hide();
+ }
}
}
}
|
Beta Was this translation helpful? Give feedback.
2 replies
-
I would love to see this too. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am coming from polybar on X11, where I enjoyed the following behaviour regarding tags/workspaces/desktops (on bspwm): I only see the workspaces that are occupied, AND, importantly, if I switch to a new desktop, there will not be a large piece of space between the new desktop and the previously occupied ones. This sounds quite complex, so here is an example of what I mean:
Currently, I have workspaces 1 and 2 occupied, so waybar shows sth like:
1 2
.If I were to switch to workspace 6 now, then waybar shows
1 2 <space> <space> <space> 6
. I don't find this very intuitive, and would prefer waybar to display this instead:1 2 6
, without any "empty" workspaces displayed between 2 and 6.Is this possible in waybar? Thanks for your help!
Beta Was this translation helpful? Give feedback.
All reactions