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

Fix finding active desktop!

This commit is contained in:
Dave Davenport 2016-02-09 21:25:29 +01:00
parent 9b12f69fec
commit 289795b22a
6 changed files with 29 additions and 13 deletions

View file

@ -55,6 +55,7 @@ int window_get_cardinal_prop ( Display *display, Window w, Atom atom, unsigned l
X ( _NET_WM_WINDOW_TYPE_NORMAL ), \ X ( _NET_WM_WINDOW_TYPE_NORMAL ), \
X ( _NET_WM_STATE_FULLSCREEN ), \ X ( _NET_WM_STATE_FULLSCREEN ), \
X ( _NET_WM_DESKTOP ), \ X ( _NET_WM_DESKTOP ), \
X ( _NET_DESKTOP_VIEWPORT ), \
X ( CLIPBOARD ), \ X ( CLIPBOARD ), \
X ( UTF8_STRING ), \ X ( UTF8_STRING ), \
X ( _NET_WM_WINDOW_OPACITY ) X ( _NET_WM_WINDOW_OPACITY )

View file

@ -1568,7 +1568,8 @@ MenuState *menu ( Mode *sw,
state->top_offset = state->border * 1 + state->line_height + 2 + config.line_margin * 2; state->top_offset = state->border * 1 + state->line_height + 2 + config.line_margin * 2;
// Move indicator to end. // Move indicator to end.
widget_move ( WIDGET ( state->case_indicator ), state->border + textbox_get_width ( state->prompt_tb ) + entrybox_width, state->border ); widget_move ( WIDGET ( state->case_indicator ), state->border + textbox_get_width ( state->prompt_tb ) + entrybox_width,
state->border );
textbox_text ( state->case_indicator, get_matching_state () ); textbox_text ( state->case_indicator, get_matching_state () );
state->message_tb = NULL; state->message_tb = NULL;

View file

@ -265,6 +265,20 @@ void monitor_active ( Display *display, workarea *mon )
} }
fprintf ( stderr, "Failed to find selected monitor.\n" ); fprintf ( stderr, "Failed to find selected monitor.\n" );
} }
// Get the current desktop.
unsigned long current_desktop = 0;
if ( window_get_cardinal_prop ( display, root, netatoms[_NET_CURRENT_DESKTOP], &current_desktop, 1 ) ) {
unsigned long desktops = 0;
if ( window_get_cardinal_prop ( display, root, netatoms[_NET_NUMBER_OF_DESKTOPS], &desktops, 1 ) ) {
unsigned long deskg[desktops * 2];
if ( window_get_cardinal_prop ( display, root, netatoms[_NET_DESKTOP_VIEWPORT], &deskg[0], desktops * 2 ) ) {
if ( current_desktop < desktops ) {
monitor_dimensions ( display, screen, deskg[current_desktop * 2], deskg[current_desktop * 2 + 1], mon );
return;
}
}
}
}
if ( window_get_prop ( display, root, netatoms[_NET_ACTIVE_WINDOW], &type, &count, &id, sizeof ( Window ) ) if ( window_get_prop ( display, root, netatoms[_NET_ACTIVE_WINDOW], &type, &count, &id, sizeof ( Window ) )
&& type == XA_WINDOW && count > 0 ) { && type == XA_WINDOW && count > 0 ) {
XWindowAttributes attr; XWindowAttributes attr;