From 61f0e9dd5d1d7880a2546b485bfe92704ac08554 Mon Sep 17 00:00:00 2001
From: patrick96
Date: Sat, 29 Apr 2023 14:30:23 +0200
Subject: [PATCH] fix(tray): Vertically center in inner bar area
The tray should be vertically centered in the inner area of the bar.
Unequal top and bottom borders should not affect the alignment relative
to other text.
Fixes #2950
---
src/x11/tray_manager.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/x11/tray_manager.cpp b/src/x11/tray_manager.cpp
index 1a895f9b..68c2d997 100644
--- a/src/x11/tray_manager.cpp
+++ b/src/x11/tray_manager.cpp
@@ -459,10 +459,10 @@ unsigned manager::calculate_w() const {
}
/**
- * Calculate y position of client window
+ * Calculate y position of client window to vertically center it in the inner area of the bar.
*/
int manager::calculate_client_y() {
- return (m_bar_opts.outer_area(true).height - m_opts.client_size.h) / 2;
+ return m_bar_opts.inner_area(false).y + (m_bar_opts.inner_area(false).height - m_opts.client_size.h) / 2;
}
/**