[statusbar] Add position_get() function for statusbars

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-05-27 16:04:05 +02:00
parent 785c41f089
commit c3d16391f5
2 changed files with 19 additions and 5 deletions

View File

@ -95,8 +95,13 @@ mydebugbar = statusbar.new({ position = "off", name = "mydebugbar",
fg = "white", bg = "black" }) fg = "white", bg = "black" })
mydebugbar:widget_add(mydebugbox) mydebugbar:widget_add(mydebugbox)
mydebugbar:add(1) mydebugbar:add(1)
awesome.key({ modkey }, "d", function () mydebugbar:position_set("bottom") end) awesome.key({ modkey }, "d", function ()
awesome.key({ modkey, "Control" }, "d", function () mydebugbar:position_set("off") end) if mydebugbar:position_get() == "off" then
mydebugbar:position_set("bottom")
else
mydebugbar:position_set("off")
end
end)
-- }}} -- }}}
-- {{{ Mouse bindings -- {{{ 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" }, "k", function () awful.screen.focus(-1) end)
awesome.key({ modkey, "Control" }, "space", function () awful.client.togglefloating() 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 -- Layout manipulation
awesome.key({ modkey }, "l", function () awful.tag.incmwfact(0.05) end) awesome.key({ modkey }, "l", function () awful.tag.incmwfact(0.05) end)
awesome.key({ modkey }, "h", function () awful.tag.incmwfact(-0.05) end) awesome.key({ modkey }, "h", function () awful.tag.incmwfact(-0.05) end)

View File

@ -348,6 +348,17 @@ luaA_statusbar_position_set(lua_State *L)
return 0; 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 static int
luaA_statusbar_align_set(lua_State *L) luaA_statusbar_align_set(lua_State *L)
{ {
@ -504,6 +515,7 @@ const struct luaL_reg awesome_statusbar_meta[] =
{ {
{ "widget_add", luaA_statusbar_widget_add }, { "widget_add", luaA_statusbar_widget_add },
{ "position_set", luaA_statusbar_position_set }, { "position_set", luaA_statusbar_position_set },
{ "position_get", luaA_statusbar_position_get },
{ "align_set", luaA_statusbar_align_set }, { "align_set", luaA_statusbar_align_set },
{ "add", luaA_statusbar_add }, { "add", luaA_statusbar_add },
{ "remove", luaA_statusbar_remove }, { "remove", luaA_statusbar_remove },