mirror of
https://github.com/lbonn/rofi
synced 2024-11-23 12:23:02 +00:00
Use xcb_ewmh_get_supporting_wm to get window to get wm name on
This commit is contained in:
parent
a579c86c1f
commit
97be4e9c72
1 changed files with 17 additions and 10 deletions
|
@ -926,17 +926,24 @@ void x11_disable_decoration ( xcb_window_t window )
|
|||
|
||||
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_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 ( xcb ) );
|
||||
|
||||
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_log ( LOG_DOMAIN, G_LOG_LEVEL_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;
|
||||
}
|
||||
}
|
||||
xcb_ewmh_get_utf8_strings_reply_wipe(&wtitle);
|
||||
}
|
||||
xcb_ewmh_get_utf8_strings_reply_wipe(&wtitle);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue