[statusbar] Add position_get() function for statusbars
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
785c41f089
commit
c3d16391f5
|
@ -95,8 +95,13 @@ mydebugbar = statusbar.new({ position = "off", name = "mydebugbar",
|
|||
fg = "white", bg = "black" })
|
||||
mydebugbar:widget_add(mydebugbox)
|
||||
mydebugbar:add(1)
|
||||
awesome.key({ modkey }, "d", function () mydebugbar:position_set("bottom") end)
|
||||
awesome.key({ modkey, "Control" }, "d", function () mydebugbar:position_set("off") end)
|
||||
awesome.key({ modkey }, "d", function ()
|
||||
if mydebugbar:position_get() == "off" then
|
||||
mydebugbar:position_set("bottom")
|
||||
else
|
||||
mydebugbar:position_set("off")
|
||||
end
|
||||
end)
|
||||
-- }}}
|
||||
|
||||
-- {{{ Mouse bindings
|
||||
|
@ -167,9 +172,6 @@ awesome.key({ modkey, "Control" }, "j", function () awful.screen.focus(1) end)
|
|||
awesome.key({ modkey, "Control" }, "k", function () awful.screen.focus(-1) end)
|
||||
awesome.key({ modkey, "Control" }, "space", function () awful.client.togglefloating() end)
|
||||
|
||||
-- Statubar manipulation
|
||||
awesome.key({ modkey }, "b", function () mystatusbar:position_set("off") end)
|
||||
|
||||
-- Layout manipulation
|
||||
awesome.key({ modkey }, "l", function () awful.tag.incmwfact(0.05) end)
|
||||
awesome.key({ modkey }, "h", function () awful.tag.incmwfact(-0.05) end)
|
||||
|
|
12
statusbar.c
12
statusbar.c
|
@ -348,6 +348,17 @@ luaA_statusbar_position_set(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/** Get the statusbar position.
|
||||
* \return The statusbar position.
|
||||
*/
|
||||
static int
|
||||
luaA_statusbar_position_get(lua_State *L)
|
||||
{
|
||||
statusbar_t **sb = luaL_checkudata(L, 1, "statusbar");
|
||||
lua_pushstring(L, position_to_str((*sb)->position));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
luaA_statusbar_align_set(lua_State *L)
|
||||
{
|
||||
|
@ -504,6 +515,7 @@ const struct luaL_reg awesome_statusbar_meta[] =
|
|||
{
|
||||
{ "widget_add", luaA_statusbar_widget_add },
|
||||
{ "position_set", luaA_statusbar_position_set },
|
||||
{ "position_get", luaA_statusbar_position_get },
|
||||
{ "align_set", luaA_statusbar_align_set },
|
||||
{ "add", luaA_statusbar_add },
|
||||
{ "remove", luaA_statusbar_remove },
|
||||
|
|
Loading…
Reference in New Issue