diff --git a/lib/wibox/init.lua b/lib/wibox/init.lua index 9715a93ee..170f16aad 100644 --- a/lib/wibox/init.lua +++ b/lib/wibox/init.lua @@ -265,6 +265,7 @@ local function setup_signals(w) clone_signal("property::cursor") clone_signal("property::height") clone_signal("property::ontop") + clone_signal("property::desktop") clone_signal("property::opacity") clone_signal("property::struts") clone_signal("property::visible") diff --git a/objects/drawin.c b/objects/drawin.c index 3bbd93179..7d63af31e 100644 --- a/objects/drawin.c +++ b/objects/drawin.c @@ -504,6 +504,7 @@ luaA_drawin_geometry(lua_State *L) LUA_OBJECT_EXPORT_PROPERTY(drawin, drawin_t, ontop, lua_pushboolean) +LUA_OBJECT_EXPORT_PROPERTY(drawin, drawin_t, desktop, lua_pushboolean) LUA_OBJECT_EXPORT_PROPERTY(drawin, drawin_t, cursor, lua_pushstring) LUA_OBJECT_EXPORT_PROPERTY(drawin, drawin_t, visible, lua_pushboolean) @@ -584,16 +585,48 @@ luaA_drawin_get_height(lua_State *L, drawin_t *drawin) * \param drawin The drawin object. * \return The number of elements pushed on stack. */ -static int -luaA_drawin_set_ontop(lua_State *L, drawin_t *drawin) +void +drawin_set_ontop(lua_State *L, drawin_t *drawin, bool b) { - bool b = luaA_checkboolean(L, -1); if(b != drawin->ontop) { + if(b) + drawin_set_desktop(L, drawin, false); drawin->ontop = b; stack_windows(); luaA_object_emit_signal(L, -3, "property::ontop", 0); } +} + +/** Set the drawin on desktop status. + * \param L The Lua VM state. + * \param drawin The drawin object. + * \return The number of elements pushed on stack. + */ +void +drawin_set_desktop(lua_State *L, drawin_t *drawin, bool b) +{ + if(b != drawin->desktop) + { + if(b) + drawin_set_ontop(L, drawin, false); + drawin->desktop = b; + stack_windows(); + luaA_object_emit_signal(L, -3, "property::desktop", 0); + } +} + +static int +luaA_drawin_set_ontop(lua_State *L, drawin_t *drawin) +{ + drawin_set_ontop(L, drawin, luaA_checkboolean(L, -1)); + return 0; +} + +static int +luaA_drawin_set_desktop(lua_State *L, drawin_t *drawin) +{ + drawin_set_desktop(L, drawin, luaA_checkboolean(L, -1)); return 0; } @@ -797,6 +830,10 @@ drawin_class_setup(lua_State *L) (lua_class_propfunc_t) luaA_drawin_set_ontop, (lua_class_propfunc_t) luaA_drawin_get_ontop, (lua_class_propfunc_t) luaA_drawin_set_ontop); + luaA_class_add_property(&drawin_class, "desktop", + (lua_class_propfunc_t) luaA_drawin_set_desktop, + (lua_class_propfunc_t) luaA_drawin_get_desktop, + (lua_class_propfunc_t) luaA_drawin_set_desktop); luaA_class_add_property(&drawin_class, "cursor", (lua_class_propfunc_t) luaA_drawin_set_cursor, (lua_class_propfunc_t) luaA_drawin_get_cursor, diff --git a/objects/drawin.h b/objects/drawin.h index 2f8887d94..7f282e558 100644 --- a/objects/drawin.h +++ b/objects/drawin.h @@ -32,6 +32,8 @@ struct drawin_t WINDOW_OBJECT_HEADER /** Ontop */ bool ontop; + /** Desktop */ + bool desktop; /** Visible */ bool visible; /** Cursor */ @@ -49,7 +51,8 @@ ARRAY_FUNCS(drawin_t *, drawin, DO_NOTHING) drawin_t * drawin_getbywin(xcb_window_t); void drawin_refresh_pixmap_partial(drawin_t *, int16_t, int16_t, uint16_t, uint16_t); void luaA_drawin_systray_kickout(lua_State *); - +void drawin_set_ontop(lua_State *, drawin_t *, bool); +void drawin_set_desktop(lua_State *, drawin_t *, bool); void drawin_class_setup(lua_State *); extern lua_class_t drawin_class; diff --git a/stack.c b/stack.c index 17213fde5..ef685483a 100644 --- a/stack.c +++ b/stack.c @@ -167,6 +167,13 @@ stack_refresh() xcb_window_t next = XCB_NONE; + foreach(drawin, globalconf.drawins) + if ((*drawin)->desktop) + { + stack_window_above((*drawin)->window, next); + next = (*drawin)->window; + } + /* stack desktop windows */ for(window_layer_t layer = WINDOW_LAYER_DESKTOP; layer < WINDOW_LAYER_BELOW; layer++) foreach(node, globalconf.stack) @@ -175,7 +182,7 @@ stack_refresh() /* first stack not ontop drawin window */ foreach(drawin, globalconf.drawins) - if(!(*drawin)->ontop) + if(!(*drawin)->ontop && !(*drawin)->desktop) { stack_window_above((*drawin)->window, next); next = (*drawin)->window;