From 8da52af6a20ead1deb191618713831f870b4eb6c Mon Sep 17 00:00:00 2001 From: Michael Carlberg Date: Wed, 14 Dec 2016 10:54:38 +0100 Subject: [PATCH] fix(tray): Attached offset relative to inner area --- src/components/bar.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/components/bar.cpp b/src/components/bar.cpp index a70a09ce..fcc04a22 100644 --- a/src/components/bar.cpp +++ b/src/components/bar.cpp @@ -327,13 +327,19 @@ void bar::bootstrap_tray() { auto offset_y = atoi(offset_y_def.c_str()); if (offset_x != 0 && offset_x_def.find('%') != string::npos) { - offset_x = math_util::percentage_to_value(offset_x, m_opts.monitor->w); - offset_x -= settings.width / 2; + if (settings.detached) { + offset_x = math_util::percentage_to_value(offset_x, m_opts.monitor->w); + } else { + offset_x = math_util::percentage_to_value(offset_x, inner_area.width); + } } if (offset_y != 0 && offset_y_def.find('%') != string::npos) { - offset_y = math_util::percentage_to_value(offset_y, m_opts.monitor->h); - offset_y -= settings.width / 2; + if (settings.detached) { + offset_y = math_util::percentage_to_value(offset_y, m_opts.monitor->h); + } else { + offset_y = math_util::percentage_to_value(offset_y, inner_area.height); + } } settings.orig_x += offset_x;