From 627d43dad2d94c92b44328e893376d0e35ecfaaa Mon Sep 17 00:00:00 2001
From: patrick96
Date: Mon, 19 Sep 2022 21:23:22 +0200
Subject: [PATCH] tray: Set _NET_SYSTEM_TRAY_ORIENTATION
---
include/x11/tray_manager.hpp | 1 +
src/components/renderer.cpp | 2 +-
src/x11/tray_manager.cpp | 11 +++++++++++
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/include/x11/tray_manager.hpp b/include/x11/tray_manager.hpp
index 391390f7..7d96e2d2 100644
--- a/include/x11/tray_manager.hpp
+++ b/include/x11/tray_manager.hpp
@@ -91,6 +91,7 @@ class tray_manager : public xpp::event::sinkvisual_id);
m_log.trace("renderer: Allocate colormap");
m_colormap = m_connection.generate_id();
diff --git a/src/x11/tray_manager.cpp b/src/x11/tray_manager.cpp
index 1f4bf802..4026edb7 100644
--- a/src/x11/tray_manager.cpp
+++ b/src/x11/tray_manager.cpp
@@ -131,6 +131,7 @@ void tray_manager::activate() {
try {
set_tray_colors();
+ set_tray_orientation();
} catch (const exception& err) {
m_log.err(err.what());
m_log.err("Cannot activate tray manager... failed to setup window");
@@ -350,6 +351,16 @@ void tray_manager::set_tray_colors() {
XCB_PROP_MODE_REPLACE, m_opts.selection_owner, _NET_SYSTEM_TRAY_COLORS, XCB_ATOM_CARDINAL, 32, 12, colors);
}
+/**
+ * Set the _NET_SYSTEM_TRAY_ORIENTATION atom
+ */
+void tray_manager::set_tray_orientation() {
+ const uint32_t orientation = _NET_SYSTEM_TRAY_ORIENTATION_HORZ;
+ m_log.trace("tray: Set _NET_SYSTEM_TRAY_ORIENTATION to 0x%x", orientation);
+ m_connection.change_property_checked(XCB_PROP_MODE_REPLACE, m_opts.selection_owner, _NET_SYSTEM_TRAY_ORIENTATION,
+ XCB_ATOM_CARDINAL, 32, 1, &orientation);
+}
+
/**
* Acquire the systray selection
*