1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00

xcb: Hide WM discover function

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
This commit is contained in:
Quentin Glidic 2017-06-01 15:08:20 +02:00
parent 48a80e3f82
commit e576bc441c
No known key found for this signature in database
GPG key ID: AC203F96E2C34BB7
2 changed files with 27 additions and 31 deletions

View file

@ -185,8 +185,4 @@ typedef enum
*/
extern WindowManager current_window_manager;
/**
* discover the window manager.
*/
void x11_helper_discover_window_manager ( void );
#endif

View file

@ -799,6 +799,33 @@ static void x11_create_frequently_used_atoms ( void )
}
}
static void x11_helper_discover_window_manager ( void )
{
xcb_window_t wm_win = 0;
xcb_get_property_cookie_t cc = xcb_ewmh_get_supporting_wm_check_unchecked ( &xcb->ewmh,
xcb_stuff_get_root_window () );
if ( xcb_ewmh_get_supporting_wm_check_reply ( &xcb->ewmh, cc, &wm_win, NULL ) ) {
xcb_ewmh_get_utf8_strings_reply_t wtitle;
xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_name_unchecked ( &( xcb->ewmh ), wm_win );
if ( xcb_ewmh_get_wm_name_reply ( &( xcb->ewmh ), cookie, &wtitle, (void *) 0 ) ) {
if ( wtitle.strings_len > 0 ) {
g_debug ( "Found window manager: %s", wtitle.strings );
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;
}
else if ( g_strcmp0 ( wtitle.strings, "Openbox" ) == 0 ) {
current_window_manager = WM_OPENBOX;
}
}
xcb_ewmh_get_utf8_strings_reply_wipe ( &wtitle );
}
}
}
gboolean display_setup ( GMainLoop *main_loop, NkBindings *bindings )
{
// Get DISPLAY, first env, then argument.
@ -1089,30 +1116,3 @@ 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_window_t wm_win = 0;
xcb_get_property_cookie_t cc = xcb_ewmh_get_supporting_wm_check_unchecked ( &xcb->ewmh,
xcb_stuff_get_root_window () );
if ( xcb_ewmh_get_supporting_wm_check_reply ( &xcb->ewmh, cc, &wm_win, NULL ) ) {
xcb_ewmh_get_utf8_strings_reply_t wtitle;
xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_name_unchecked ( &( xcb->ewmh ), wm_win );
if ( xcb_ewmh_get_wm_name_reply ( &( xcb->ewmh ), cookie, &wtitle, (void *) 0 ) ) {
if ( wtitle.strings_len > 0 ) {
g_debug ( "Found window manager: %s", wtitle.strings );
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;
}
else if ( g_strcmp0 ( wtitle.strings, "Openbox" ) == 0 ) {
current_window_manager = WM_OPENBOX;
}
}
xcb_ewmh_get_utf8_strings_reply_wipe ( &wtitle );
}
}
}