8000 Center module is off center when system tray is on the same bar · Issue #551 · polybar/polybar · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Center module is off center when system tray is on the same bar #551

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

Closed
ghost opened this issue Apr 25, 2017 · 17 comments
Closed

Center module is off center when system tray is on the same bar #551

ghost opened this issue Apr 25, 2017 · 17 comments

Comments

@ghost
Copy link
ghost commented Apr 25, 2017

In my setup, I have a time module at the center of my bar, but with the system tray on the right of this bar, the time gets pushed left, and with each new tray applet I open, the time module gets pushed more left.

@jaagr
Copy link
Member
jaagr commented Apr 25, 2017

Try changing the value of the bar parameter fixed-center (default value is true)

@ghost
Copy link
Author
ghost commented Apr 26, 2017

Already tried that, setting that to false makes it worse.

@jaagr
Copy link
Member
jaagr commented Apr 26, 2017

Could you show me some screenshots of the issue along with a description on how you expect it to behave?

@ghost
Copy link
Author
ghost commented Apr 26, 2017

2017-04-26-123818_3840x2160_scrot

The time should be centered at the y-axis of that graph.

If I remove system tray it displays correctly:

2017-04-26-124108_3840x2160_scrot

@ghost
Copy link
Author
ghost commented Apr 26, 2017

With four tray apps:

2017-04-26-124603_3840x2160_scrot

@jaagr
Copy link
Member
jaagr commented Apr 26, 2017

Try this patch:

diff --git a/src/components/renderer.cpp b/src/components/renderer.cpp
index 964e882..ef34c25 100644
--- a/src/components/renderer.cpp
+++ b/src/components/renderer.cpp
@@ -399,6 +399,11 @@ double renderer::block_x(alignment a) const {
       if ((min_pos = block_w(alignment::LEFT))) {
         min_pos += BLOCK_GAP;
       }
+      if (m_rect.x > 0) {
+        base_pos -= (m_bar.size.w - m_rect.width) / 2.0;
+      } else {
+        base_pos += (m_bar.size.w - m_rect.width) / 2.0;
+      }
       return std::max(base_pos - block_w(a) / 2.0, min_pos);
     }
     case alignment::RIGHT: {

@ghost
Copy link
Author
ghost commented Apr 26, 2017

Excuse my ignorance, but how do I use that? I tried to copy that into a renderer.patch and use patch, but I got errors.

@jaagr
Copy link
Member
jaagr commented Apr 26, 2017

Use git apply <patchfile>

@3tini
Copy link
3tini commented May 4, 2017

Saw this was still open. That patch worked perfectly for me. Thanks.

@mpcsh
Copy link
mpcsh commented May 10, 2017

This patch worked for me as well. Will it be merged?

@ghost
Copy link
Author
ghost commented May 19, 2017

I can't test this myself because I don't build from source and I'm too busy to figure it out. Based on @FuegoAliado and @mpcsh it seems to work. I hope this is included in an update.

@jaagr jaagr closed this as completed in 389bae2 May 19, 2017
@alexhulbert
Copy link
alexhulbert commented Jun 27, 2017

This only works if you put the tray on the left. Not working for me if I set tray-position to "right."

@3tini
Copy link
3tini commented Jun 27, 2017

@Taconut It's not an issue with the tray-position. My tray is on the right as well and does not shift my centered modules regardless of how many notifications I have on the tray.
2017-06-26-231330_1280x800_scrot

@alexhulbert
Copy link

@FuegoAliado Well I tried both directions multiple times and I'm 100% positive it's only happening when the tray is on the right. I have absolutely no idea why our setups would be any different, but they are.

@jaagr
Copy link
Member
jaagr commented Jun 28, 2017

@Taconut could you post the bar section of your config?

@jaagr
Copy link
Member
jaagr commented Jun 28, 2017

And what version?

@alexhulbert
Copy link

My bar config is http://termbin.com/drul and my version is this repo's current HEAD with the commits in pull #426 cherry picked on top. The bar configuration listed works fine but when I change "left" to "right" it pushes the center module to the left when the tray is populated.

patrick96 added a commit to patrick96/polybar that referenced this issue Jul 23, 2017
The changes introduced in 389bae2 to
address polybar#551 did not consider the left border

Now center modules are centered regardless of border (left or right)
settings or tray position

Fixes polybar#672
NBonaparte pushed a commit that referenced this issue Sep 5, 2017
The changes introduced in 389bae2 to
address #551 did not consider the left border

Now center modules are centered regardless of border (left or right)
settings or tray position

Fixes #672
patrick96 added a commit that referenced this issue Dec 3, 2017
Breaking Changes:

* Date module no longer supports non-padded specifiers (i.e. `%-d`) and potentially other specifiers, see #792
  - Check http://en.cppreference.com/w/cpp/io/manip/put_time to see supported specifiers
* Setting background color to `background-0` with gradients (refer to https://github.com/jaagr/polybar/wiki/Known-Issues)

Changelog:

Features:
* Feat(mpd): State-specific formats (`format-playing`, `format-paused`, `format-stopped`) (#567), see #524 
* Feat(ipc): Visibility commands (show, hide, toggle, restart, quit) (b6c5563)
* Feat(shell): Bash completion (#588)
* Feat(menu): `expand-right` option (#658), see #655
* Feat(temperature): hwmon sysfs support (#688), see #404 
* Feat(cursor): Change cursors over clickable/scrollable areas (#727), see #721  
* Feat(temperature): Fahrenheit and Celsius tokens (#804)
* Feat(mpd): Use mpd name tag or URI as fallback for title-less tracks (#823), see #815 

Fixes:
* Fix(i3): Clicking workspaces without index (#521), see #520 
* Fix(parser): Prefix options overriding format options (#729), see #544
* Fix(parser): Overline tags (eebf105)
* Fix(process_util): Prefix shell environment variable (`$POLYBAR_SHELL`) (86ff947), see #566 
* Fix(parser): `%{R}` tag (reverse colors) (0bd8f1f), see #585 
* Fix(renderer): Center block position with tray (389bae2 & #673), see #551 & #672 
* Fix(xworkpaces): Active workspace with XMonad (#587), see #411 & #535 
* Fix(config): Expand tilde, environment variable (d3b0670 & #724), see #603 & #719 
* Fix(build): Remove curlbuild.h (#648), see #647 
* Fix(renderer): Off by one error for actions (#663), see #661 
* Fix(gcc): GCC 7.1 ([jaagr/xpp/#6](polybar/xpp#6))
* Fix(fs): Use `bytes_available` for `percentage_used` (138f5fa), see #710
* Fix(fs): Use `f_frsize` for calculations (a682d2a)
* Fix(date): Remove date string length limitation (#745), see #754 
* Fix(renderer): Nested actions (#772), see #760 and #758
* Fix(i3): Check and warn if current workspace not found (#826), see #824 
* Fix(github): Prevent module disappearing with no connection (#811), see #810 
* Fix(renderer): Module gradients (#831), see #759 
* Fix(build): Update deprecated jsoncpp Reader
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
0