Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wlr/taskbar pushes the modules on the right over the screen when I open windows. #917

Open
snakedye opened this issue Nov 17, 2020 · 14 comments
Labels
bug Something isn't working

Comments

@snakedye
Copy link

snakedye commented Nov 17, 2020

demo

  • Waybar v0.9.4-64-gfaacd76 (branch 'master')
  • Sway 1.5
  • Arch Linux
@JordanL2
Copy link
Contributor

A solution to this would be a max-length option, which limits the total width of the taskbar module.

Some nice to have options to possibly implement along side:

  1. A "squeeze" (name TBC) flag - when the bar reaches the max width, each window button will be shrunk to fit all buttons into the available width
  2. A flag that makes all buttons split the available space equally between them - one button uses all the space, two have half each, etc
  3. An option that sets each button to a fixed width, regardless of the length of the content

@snakedye snakedye changed the title wlt/taskbar pushes the modules on the right over the screen when I open windows. wlr/taskbar pushes the modules on the right over the screen when I open windows. Nov 23, 2020
@JordanL2
Copy link
Contributor

Also this is related to this issue: #882

@jsteinaker
Copy link

Any updates on this?

@Alexays Alexays added the bug Something isn't working label May 7, 2021
@Baitinq
Copy link

Baitinq commented Dec 23, 2022

Would be really nice to have this<3

1 similar comment
@Baitinq
Copy link

Baitinq commented Dec 23, 2022

Would be really nice to have this<3

@kyak
Copy link

kyak commented Sep 9, 2023

Are there any workarounds for that?

@snakedye
Copy link
Author

I think the obvious solution would be to have some kind of scroll box.

@kyak
Copy link

kyak commented Sep 14, 2023

I think the obvious solution would be to have some kind of scroll box.

Why? The behaviour in most (all?) panels is to shrink window buttons to fit.

@snakedye
Copy link
Author

It's not sustainable. If the button is too small you can't read or see anything and then what?

@Consolatis
Copy link

  • Max width of buttons, if there is enough space they grow as big as that.
  • Min width of buttons, if the available space is smaller than button_count * current button_width shrink buttons to MAX(min_width, available_space / button_count).
  • If new button_width * button_count is still > available space start scrolling

@tokyo4j
Copy link

tokyo4j commented Oct 22, 2023

By applying the patch below, titles can shrink, although icons don't.

diff --git a/src/bar.cpp b/src/bar.cpp
index d0a187c6..4b667b90 100644
--- a/src/bar.cpp
+++ b/src/bar.cpp
@@ -798,7 +798,7 @@ auto waybar::Bar::setupWidgets() -> void {
   if (config["fixed-center"].isBool() ? config["fixed-center"].asBool() : true) {
     box_.set_center_widget(center_);
   } else {
-    box_.pack_start(center_, true, false);
+    box_.pack_start(center_, true, true);
   }
   box_.pack_end(right_, false, false);
 
diff --git a/src/modules/wlr/taskbar.cpp b/src/modules/wlr/taskbar.cpp
index f4b137c0..bfe182c3 100644
--- a/src/modules/wlr/taskbar.cpp
+++ b/src/modules/wlr/taskbar.cpp
@@ -271,6 +271,9 @@ Task::Task(const waybar::Bar &bar, const Json::Value &config, Taskbar *tbar,
 
   button.set_relief(Gtk::RELIEF_NONE);
 
+  text_before_.set_ellipsize(Pango::EllipsizeMode::ELLIPSIZE_END);
+  text_after_.set_ellipsize(Pango::EllipsizeMode::ELLIPSIZE_END);
+
   content_.add(text_before_);
   content_.add(icon_);
   content_.add(text_after_);

@Vladimir-csp
Copy link

Considering potential compatibility with #2647, mouse wheel scrolling would be unavailable. An alternative is to stack icons behind each other when the bar becomes full, unstack on mouseover and scroll via mouse position on taskbar.

@tazjin
Copy link

tazjin commented Sep 29, 2024

A fairly simple workaround I've applied to my configuration for now is using the rewrite option of the wlr/taskbar config. The config looks like this:

    "wlr/taskbar": {
      "format": "{icon} {title}",
      "on-click": "activate",
      "rewrite": {
        "^(.{16}).+$": "$1…"
      }
    }

This regular expression will match any format output over 16 characters, and truncate it down to those characters plus an ellipsis. 16 was chosen kind of randomly by me, because it fits decently onto my screen.
In effect this looks like this (note the ellipsis characters at the ends of the long names):

image

If there's a LOT of windows this doesn't ultimately prevent them from flowing out, but it at least puts a boundary on individual windows.

@jjramsey
Copy link

Any updates on this? Looks like there's been no movement, not even an incorporation of this patch: #917 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests