diff --git a/client.c b/client.c index a655fe87..d6c013d0 100644 --- a/client.c +++ b/client.c @@ -256,6 +256,7 @@ focus(Client *c, Bool selscreen, int screen) XSetInputFocus(globalconf.display, RootWindow(globalconf.display, get_phys_screen(screen)), RevertToPointerRoot, CurrentTime); + ewmh_update_net_active_window(get_phys_screen(screen)); } /** Manage a new client diff --git a/ewmh.c b/ewmh.c index 6f68dd58..2e788a59 100644 --- a/ewmh.c +++ b/ewmh.c @@ -25,6 +25,7 @@ #include "ewmh.h" #include "util.h" #include "tag.h" +#include "focus.h" extern AwesomeConf globalconf; @@ -33,6 +34,7 @@ static Atom net_client_list; static Atom net_number_of_desktops; static Atom net_current_desktop; static Atom net_desktop_names; +static Atom net_active_window; static Atom net_wm_name; static Atom net_wm_icon; @@ -52,6 +54,7 @@ static AtomItem AtomNames[] = { "_NET_NUMBER_OF_DESKTOPS", &net_number_of_desktops }, { "_NET_CURRENT_DESKTOP", &net_current_desktop }, { "_NET_DESKTOP_NAMES", &net_desktop_names }, + { "_NET_ACTIVE_WINDOW", &net_active_window }, { "_NET_WM_NAME", &net_wm_name }, { "_NET_WM_ICON", &net_wm_icon }, @@ -86,6 +89,7 @@ ewmh_set_supported_hints(int phys_screen) atom[i++] = net_number_of_desktops; atom[i++] = net_current_desktop; atom[i++] = net_desktop_names; + atom[i++] = net_active_window; atom[i++] = net_wm_name; atom[i++] = net_wm_icon; @@ -165,7 +169,21 @@ ewmh_update_net_desktop_names(int phys_screen) } XChangeProperty(globalconf.display, RootWindow(globalconf.display, phys_screen), - net_desktop_names, utf8_string, 8, PropModeReplace, (unsigned char *)buf, len); + net_desktop_names, utf8_string, 8, PropModeReplace, (unsigned char *) buf, len); +} + +void +ewmh_update_net_active_window(int phys_screen) +{ + Window win; + Tag **curtags = get_current_tags(phys_screen); + Client *sel = focus_get_latest_client_for_tags(phys_screen, curtags); + p_delete(&curtags); + + win = sel ? sel->win : None; + + XChangeProperty(globalconf.display, RootWindow(globalconf.display, phys_screen), + net_active_window, XA_WINDOW, 32, PropModeReplace, (unsigned char *) &win, 1); } // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/ewmh.h b/ewmh.h index 1f8ae4b3..ae66418e 100644 --- a/ewmh.h +++ b/ewmh.h @@ -28,6 +28,7 @@ void ewmh_update_net_client_list(int); void ewmh_update_net_numbers_of_desktop(int); void ewmh_update_net_current_desktop(int); void ewmh_update_net_desktop_names(int); +void ewmh_update_net_active_window(int); #endif // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80