diff options
author | Dave Davenport <qball@gmpclient.org> | 2017-02-11 17:12:07 +0100 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2017-02-11 17:12:07 +0100 |
commit | a579c86c1fbb9428f31199a04fc4ced8e554ab3f (patch) | |
tree | 9a70030cf927a8da8e306859a5c5df34e146ed95 /source | |
parent | c3865215748013b03fbe7ad8ba4a939b38636c0b (diff) |
Only switch to the desktop first if we are on AweSome WM
Diffstat (limited to 'source')
-rw-r--r-- | source/dialogs/window.c | 63 |
1 files changed, 28 insertions, 35 deletions
diff --git a/source/dialogs/window.c b/source/dialogs/window.c index f427aa2a..319558e5 100644 --- a/source/dialogs/window.c +++ b/source/dialogs/window.c @@ -578,44 +578,37 @@ static ModeMode window_mode_result ( Mode *sw, int mretv, G_GNUC_UNUSED char **i } else { rofi_view_hide (); - // Get the current desktop. - unsigned int current_desktop = 0; - xcb_get_property_cookie_t c = xcb_ewmh_get_current_desktop ( &xcb->ewmh, xcb->screen_nbr ); - if ( !xcb_ewmh_get_current_desktop_reply ( &xcb->ewmh, c, ¤t_desktop, NULL ) ) { - current_desktop = 0; - } - - // Get the desktop of the client to switch to - uint32_t wmdesktop = 0; - xcb_get_property_cookie_t cookie; - xcb_get_property_reply_t *r; - - cookie = xcb_get_property ( xcb->connection, - 0, - rmpd->ids->array[selected_line], - xcb->ewmh._NET_WM_DESKTOP, - XCB_ATOM_CARDINAL, - 0, - 1 ); - r = xcb_get_property_reply ( xcb->connection, cookie, NULL ); - if ( r && r->type == XCB_ATOM_CARDINAL ) { - wmdesktop = *( (uint32_t *) xcb_get_property_value ( r ) ); - } - if ( r && r->type != XCB_ATOM_CARDINAL ) { - // Assume the client is on all desktops. - wmdesktop = current_desktop; - } - free ( r ); + if ( current_window_manager == WM_AWESOME ) + { + // Get the desktop of the client to switch to + uint32_t wmdesktop = 0; + xcb_get_property_cookie_t cookie; + xcb_get_property_reply_t *r; + // Get the current desktop. + unsigned int current_desktop = 0; + xcb_get_property_cookie_t c = xcb_ewmh_get_current_desktop ( &xcb->ewmh, xcb->screen_nbr ); + if ( !xcb_ewmh_get_current_desktop_reply ( &xcb->ewmh, c, ¤t_desktop, NULL ) ) { + current_desktop = 0; + } - // If we have to switch the desktop, do - if ( wmdesktop != current_desktop ) { - xcb_ewmh_request_change_current_desktop ( &xcb->ewmh, - xcb->screen_nbr, + cookie = xcb_get_property ( xcb->connection, 0, rmpd->ids->array[selected_line], + xcb->ewmh._NET_WM_DESKTOP, XCB_ATOM_CARDINAL, 0, 1 ); + r = xcb_get_property_reply ( xcb->connection, cookie, NULL ); + if ( r && r->type == XCB_ATOM_CARDINAL ) { + wmdesktop = *( (uint32_t *) xcb_get_property_value ( r ) ); + } + if ( r && r->type != XCB_ATOM_CARDINAL ) { + // Assume the client is on all desktops. + wmdesktop = current_desktop; + } + free ( r ); - wmdesktop, - XCB_CURRENT_TIME ); + // If we have to switch the desktop, do + if ( wmdesktop != current_desktop ) { + xcb_ewmh_request_change_current_desktop ( &xcb->ewmh, + xcb->screen_nbr, wmdesktop, XCB_CURRENT_TIME ); + } } - // Activate the window xcb_ewmh_request_change_active_window ( &xcb->ewmh, xcb->screen_nbr, rmpd->ids->array[selected_line], XCB_EWMH_CLIENT_SOURCE_TYPE_OTHER, |