mirror of
https://github.com/lbonn/rofi
synced 2024-11-10 22:34:34 +00:00
Only switch to the desktop first if we are on AweSome WM
This commit is contained in:
parent
c386521574
commit
a579c86c1f
2 changed files with 33 additions and 40 deletions
|
@ -264,11 +264,11 @@ void x11_disable_decoration ( xcb_window_t window );
|
|||
|
||||
typedef enum {
|
||||
/** Default EWHM compatible window manager */
|
||||
WM_EWHM,
|
||||
WM_EWHM = 0,
|
||||
/** I3 Window manager */
|
||||
WM_I3,
|
||||
WM_I3 = 1,
|
||||
/** Awesome window manager */
|
||||
WM_AWESOME
|
||||
WM_AWESOME = 2
|
||||
} WindowManager;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
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;
|
||||
}
|
||||
|
||||
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 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 );
|
||||
}
|
||||
}
|
||||
|
||||
// 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 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,
|
||||
|
|
Loading…
Reference in a new issue