From 70a5f1d41e67f920d8f18c5f608862904ef70208 Mon Sep 17 00:00:00 2001 From: Michael Carlberg Date: Tue, 15 Nov 2016 02:17:21 +0100 Subject: [PATCH] fix: Bottom strut relative to screen --- include/components/bar.hpp | 4 +++- include/components/types.hpp | 5 +++++ src/components/bar.cpp | 9 +++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/include/components/bar.hpp b/include/components/bar.hpp index 17516d7e..dc986c45 100644 --- a/include/components/bar.hpp +++ b/include/components/bar.hpp @@ -36,7 +36,7 @@ class bar : public xpp::event::sinkroot); + m_screensize.w = geom->width; + m_screensize.h = geom->height; + // limit the amount of allowed input events to 1 per 60ms m_throttler = throttle_util::make_throttler(1, 60ms); @@ -671,6 +675,7 @@ void bar::restack_window() { * Map window and reconfigure its position */ void bar::map_window() { + auto geom = m_connection.get_geometry(m_screen->root); auto w = m_opts.width + m_opts.offset_x; auto h = m_opts.height + m_opts.offset_y; auto x = m_opts.x; @@ -682,6 +687,10 @@ void bar::map_window() { h += m_opts.margins.b; } + if (m_opts.bottom && m_opts.monitor->y + m_opts.monitor->h < m_screensize.h) { + h += m_screensize.h - (m_opts.monitor->y + m_opts.monitor->h); + } + m_window.map_checked(); m_window.reconfigure_struts(w, h, x, m_opts.bottom); m_window.reconfigure_pos(x, y);