mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-25 13:55:34 -05: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 {
|
typedef enum {
|
||||||
/** Default EWHM compatible window manager */
|
/** Default EWHM compatible window manager */
|
||||||
WM_EWHM,
|
WM_EWHM = 0,
|
||||||
/** I3 Window manager */
|
/** I3 Window manager */
|
||||||
WM_I3,
|
WM_I3 = 1,
|
||||||
/** Awesome window manager */
|
/** Awesome window manager */
|
||||||
WM_AWESOME
|
WM_AWESOME = 2
|
||||||
} WindowManager;
|
} WindowManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -578,44 +578,37 @@ static ModeMode window_mode_result ( Mode *sw, int mretv, G_GNUC_UNUSED char **i
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rofi_view_hide ();
|
rofi_view_hide ();
|
||||||
// Get the current desktop.
|
if ( current_window_manager == WM_AWESOME )
|
||||||
unsigned int current_desktop = 0;
|
{
|
||||||
xcb_get_property_cookie_t c = xcb_ewmh_get_current_desktop ( &xcb->ewmh, xcb->screen_nbr );
|
// Get the desktop of the client to switch to
|
||||||
if ( !xcb_ewmh_get_current_desktop_reply ( &xcb->ewmh, c, ¤t_desktop, NULL ) ) {
|
uint32_t wmdesktop = 0;
|
||||||
current_desktop = 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
|
// Activate the window
|
||||||
xcb_ewmh_request_change_active_window ( &xcb->ewmh, xcb->screen_nbr, rmpd->ids->array[selected_line],
|
xcb_ewmh_request_change_active_window ( &xcb->ewmh, xcb->screen_nbr, rmpd->ids->array[selected_line],
|
||||||
XCB_EWMH_CLIENT_SOURCE_TYPE_OTHER,
|
XCB_EWMH_CLIENT_SOURCE_TYPE_OTHER,
|
||||||
|
|
Loading…
Reference in a new issue