fix: Positioning in awesomeWM
Since polybar sets WM_NORMAL_HINTS, awesomeWM for some reason no longer respect the position set by polybar before mapping. reconfiguring the window position once again after mapping the window, again positions it correctly.
This commit is contained in:
parent
4556a4a7a8
commit
8173eaf90a
@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Fixed
|
### Fixed
|
||||||
- `format-offset` being ignored ([`#2643`](https://github.com/polybar/polybar/pull/2643))
|
- `format-offset` being ignored ([`#2643`](https://github.com/polybar/polybar/pull/2643))
|
||||||
- Negative struts (`margin-bottom`, `margin-top`) being ignored ([`#2642`](https://github.com/polybar/polybar/issues/2642), [`#2644`](https://github.com/polybar/polybar/pull/2644))
|
- Negative struts (`margin-bottom`, `margin-top`) being ignored ([`#2642`](https://github.com/polybar/polybar/issues/2642), [`#2644`](https://github.com/polybar/polybar/pull/2644))
|
||||||
|
- Positioning in awesomeWM ([`#2651`](https://github.com/polybar/polybar/pull/2651))
|
||||||
|
|
||||||
## [3.6.1] - 2022-03-05
|
## [3.6.1] - 2022-03-05
|
||||||
### Build
|
### Build
|
||||||
@ -166,8 +167,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Fixed
|
### Fixed
|
||||||
- Empty color values are no longer treated as invalid and no longer produce an error.
|
- Empty color values are no longer treated as invalid and no longer produce an error.
|
||||||
|
|
||||||
[Unreleased]: https://github.com/polybar/polybar/compare/3.6.1...HEAD
|
[Unreleased]: https://github.com/polybar/polybar/compare/3.6.0...HEAD
|
||||||
[3.6.1]: https://github.com/polybar/polybar/releases/tag/3.6.1
|
|
||||||
[3.6.0]: https://github.com/polybar/polybar/releases/tag/3.6.0
|
[3.6.0]: https://github.com/polybar/polybar/releases/tag/3.6.0
|
||||||
[3.5.7]: https://github.com/polybar/polybar/releases/tag/3.5.7
|
[3.5.7]: https://github.com/polybar/polybar/releases/tag/3.5.7
|
||||||
[3.5.6]: https://github.com/polybar/polybar/releases/tag/3.5.6
|
[3.5.6]: https://github.com/polybar/polybar/releases/tag/3.5.6
|
||||||
|
@ -65,6 +65,8 @@ class bar : public xpp::event::sink<evt::button_press, evt::expose, evt::propert
|
|||||||
void reconfigure_wm_hints();
|
void reconfigure_wm_hints();
|
||||||
void broadcast_visibility();
|
void broadcast_visibility();
|
||||||
|
|
||||||
|
void map_window();
|
||||||
|
|
||||||
void trigger_click(mousebtn btn, int pos);
|
void trigger_click(mousebtn btn, int pos);
|
||||||
|
|
||||||
void handle(const evt::client_message& evt) override;
|
void handle(const evt::client_message& evt) override;
|
||||||
|
@ -452,14 +452,8 @@ void bar::show() {
|
|||||||
try {
|
try {
|
||||||
m_log.info("Showing bar window");
|
m_log.info("Showing bar window");
|
||||||
m_sig.emit(visibility_change{true});
|
m_sig.emit(visibility_change{true});
|
||||||
/**
|
map_window();
|
||||||
* First reconfigures the window so that WMs that discard some information
|
|
||||||
* when unmapping have the correct window properties (geometry etc).
|
|
||||||
*/
|
|
||||||
reconfigure_window();
|
|
||||||
m_connection.map_window_checked(m_opts.window);
|
|
||||||
m_connection.flush();
|
m_connection.flush();
|
||||||
m_visible = true;
|
|
||||||
parse(string{m_lastinput}, true);
|
parse(string{m_lastinput}, true);
|
||||||
} catch (const exception& err) {
|
} catch (const exception& err) {
|
||||||
m_log.err("Failed to map bar window (err=%s", err.what());
|
m_log.err("Failed to map bar window (err=%s", err.what());
|
||||||
@ -630,6 +624,25 @@ void bar::broadcast_visibility() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void bar::map_window() {
|
||||||
|
/**
|
||||||
|
* First reconfigures the window so that WMs that discard some information
|
||||||
|
* when unmapping have the correct window properties (geometry etc).
|
||||||
|
*/
|
||||||
|
reconfigure_window();
|
||||||
|
|
||||||
|
m_log.trace("bar: Map window");
|
||||||
|
m_connection.map_window_checked(m_opts.window);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Required by AwesomeWM. AwesomeWM does not seem to respect polybar's position if WM_NORMAL_HINTS are set before
|
||||||
|
* mapping. Additionally updating the window position after mapping seems to fix that.
|
||||||
|
*/
|
||||||
|
reconfigure_pos();
|
||||||
|
|
||||||
|
m_visible = true;
|
||||||
|
}
|
||||||
|
|
||||||
void bar::trigger_click(mousebtn btn, int pos) {
|
void bar::trigger_click(mousebtn btn, int pos) {
|
||||||
tags::action_t action = m_action_ctxt->has_action(btn, pos);
|
tags::action_t action = m_action_ctxt->has_action(btn, pos);
|
||||||
|
|
||||||
@ -883,10 +896,8 @@ void bar::start() {
|
|||||||
m_connection.ensure_event_mask(m_opts.window, XCB_EVENT_MASK_STRUCTURE_NOTIFY);
|
m_connection.ensure_event_mask(m_opts.window, XCB_EVENT_MASK_STRUCTURE_NOTIFY);
|
||||||
|
|
||||||
m_log.info("Bar window: %s", m_connection.id(m_opts.window));
|
m_log.info("Bar window: %s", m_connection.id(m_opts.window));
|
||||||
reconfigure_window();
|
|
||||||
|
|
||||||
m_log.trace("bar: Map window");
|
map_window();
|
||||||
m_connection.map_window_checked(m_opts.window);
|
|
||||||
|
|
||||||
// With the mapping, the absolute position of our window may have changed (due to re-parenting for example).
|
// With the mapping, the absolute position of our window may have changed (due to re-parenting for example).
|
||||||
// Notify all components that depend on the absolute bar position (such as the background manager).
|
// Notify all components that depend on the absolute bar position (such as the background manager).
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "x11/icccm.hpp"
|
#include "x11/icccm.hpp"
|
||||||
|
|
||||||
#include "x11/atoms.hpp"
|
#include "x11/atoms.hpp"
|
||||||
|
|
||||||
POLYBAR_NS
|
POLYBAR_NS
|
||||||
@ -33,14 +34,14 @@ namespace icccm_util {
|
|||||||
bool get_wm_urgency(xcb_connection_t* c, xcb_window_t w) {
|
bool get_wm_urgency(xcb_connection_t* c, xcb_window_t w) {
|
||||||
xcb_icccm_wm_hints_t hints;
|
xcb_icccm_wm_hints_t hints;
|
||||||
if (xcb_icccm_get_wm_hints_reply(c, xcb_icccm_get_wm_hints(c, w), &hints, NULL)) {
|
if (xcb_icccm_get_wm_hints_reply(c, xcb_icccm_get_wm_hints(c, w), &hints, NULL)) {
|
||||||
if(xcb_icccm_wm_hints_get_urgency(&hints) == XCB_ICCCM_WM_HINT_X_URGENCY)
|
if (xcb_icccm_wm_hints_get_urgency(&hints) == XCB_ICCCM_WM_HINT_X_URGENCY)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_wm_size_hints(xcb_connection_t* c, xcb_window_t w, int x, int y, int width, int height) {
|
void set_wm_size_hints(xcb_connection_t* c, xcb_window_t w, int x, int y, int width, int height) {
|
||||||
xcb_size_hints_t hints;
|
xcb_size_hints_t hints{};
|
||||||
|
|
||||||
xcb_icccm_size_hints_set_size(&hints, false, width, height);
|
xcb_icccm_size_hints_set_size(&hints, false, width, height);
|
||||||
xcb_icccm_size_hints_set_min_size(&hints, width, height);
|
xcb_icccm_size_hints_set_min_size(&hints, width, height);
|
||||||
@ -50,6 +51,6 @@ namespace icccm_util {
|
|||||||
|
|
||||||
xcb_icccm_set_wm_size_hints(c, w, XCB_ATOM_WM_NORMAL_HINTS, &hints);
|
xcb_icccm_set_wm_size_hints(c, w, XCB_ATOM_WM_NORMAL_HINTS, &hints);
|
||||||
}
|
}
|
||||||
}
|
} // namespace icccm_util
|
||||||
|
|
||||||
POLYBAR_NS_END
|
POLYBAR_NS_END
|
||||||
|
Loading…
Reference in New Issue
Block a user