summaryrefslogtreecommitdiffstats
path: root/source/x11-helper.c
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2017-02-11 16:53:37 +0100
committerDave Davenport <qball@gmpclient.org>2017-02-11 16:53:37 +0100
commitc3865215748013b03fbe7ad8ba4a939b38636c0b (patch)
tree416a1acf33d8ff9fd011efb9a9b74c33a344ccf0 /source/x11-helper.c
parent98c625feab597454166880b58bfbcb92b1b0f25f (diff)
Add an window manager detection function to startup.
current_window_manager now is an enum of known window managers.
Diffstat (limited to 'source/x11-helper.c')
-rw-r--r--source/x11-helper.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/source/x11-helper.c b/source/x11-helper.c
index 93ec2842..fff0e23d 100644
--- a/source/x11-helper.c
+++ b/source/x11-helper.c
@@ -44,6 +44,7 @@
#include "xcb.h"
#include "settings.h"
#include "helper.h"
+#include "x11-helper.h"
#include <rofi.h>
/** Checks if the if x and y is inside rectangle. */
@@ -54,6 +55,9 @@
/** Log domain for this module */
#define LOG_DOMAIN "X11Helper"
+
+WindowManager current_window_manager = WM_EWHM;
+
/**
* Structure holding xcb objects needed to function.
*/
@@ -919,3 +923,20 @@ void x11_disable_decoration ( xcb_window_t window )
xcb_atom_t ha = netatoms[_MOTIF_WM_HINTS];
xcb_change_property ( xcb->connection, XCB_PROP_MODE_REPLACE, window, ha, ha, 32, 5, &hints );
}
+
+void x11_helper_discover_window_manager ( void )
+{
+ xcb_ewmh_get_utf8_strings_reply_t wtitle;
+ xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_name_unchecked(&(xcb->ewmh), xcb_stuff_get_root_window ( xcb ) );
+ if ( xcb_ewmh_get_wm_name_reply(&(xcb->ewmh), cookie, &wtitle, (void *)0))
+ {
+ if ( wtitle.strings_len > 0 ){
+ if ( g_strcmp0(wtitle.strings, "i3") == 0 ){
+ current_window_manager = WM_I3;
+ } else if ( g_strcmp0 ( wtitle.strings, "awesome" ) == 0 ){
+ current_window_manager = WM_AWESOME;
+ }
+ }
+ xcb_ewmh_get_utf8_strings_reply_wipe(&wtitle);
+ }
+}