mirror of
https://github.com/polybar/polybar.git
synced 2024-12-16 14:17:24 -05:00
fix: Bottom strut relative to screen
This commit is contained in:
parent
ffe76b0556
commit
70a5f1d41e
3 changed files with 17 additions and 1 deletions
|
@ -36,7 +36,7 @@ class bar : public xpp::event::sink<evt::button_press, evt::expose, evt::propert
|
|||
const bar_settings settings() const;
|
||||
|
||||
void parse(string data, bool force = false);
|
||||
int i = 0;
|
||||
|
||||
protected:
|
||||
void flush();
|
||||
void refresh_window();
|
||||
|
@ -86,6 +86,8 @@ int i = 0;
|
|||
throttle_util::throttle_t m_throttler;
|
||||
|
||||
xcb_screen_t* m_screen;
|
||||
rect m_screensize{};
|
||||
|
||||
xcb_visualtype_t* m_visual;
|
||||
|
||||
window m_window{m_connection, m_connection.generate_id()};
|
||||
|
|
|
@ -13,6 +13,11 @@ enum class attribute { NONE = 0, o = 2, u = 4 };
|
|||
enum class mousebtn { NONE = 0, LEFT, MIDDLE, RIGHT, SCROLL_UP, SCROLL_DOWN };
|
||||
enum class gc { NONE = 0, BG, FG, OL, UL, BT, BB, BL, BR };
|
||||
|
||||
struct rect {
|
||||
uint16_t w{0};
|
||||
uint16_t h{0};
|
||||
};
|
||||
|
||||
enum class strut {
|
||||
LEFT = 0,
|
||||
RIGHT,
|
||||
|
|
|
@ -64,6 +64,10 @@ void bar::bootstrap(bool nodraw) {
|
|||
|
||||
m_screen = m_connection.screen();
|
||||
|
||||
auto geom = m_connection.get_geometry(m_screen->root);
|
||||
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);
|
||||
|
|
Loading…
Reference in a new issue