From: Rui Guo Date: Mon, 22 Jun 2009 09:02:03 +0000 (+0800) Subject: Enable stuffing a window. X-Git-Url: https://repo.or.cz/w/screen-lua.git/commitdiff_plain/db1fd76c844c65fd0aa60ab2337869379cbb6070 Enable stuffing a window. I would like to be able to stuff background windows without temporarily switch the for layer. --- diff --git a/src/lua.c b/src/lua.c index f36d4da..6373061 100644 --- a/src/lua.c +++ b/src/lua.c @@ -429,8 +429,24 @@ window_get_monitor_status(lua_State *L) return 1; } +static int +window_stuff(lua_State *L) +{ + unsigned int len; + struct layer *oldflayer = flayer; + struct win *w = check_window(L, 1); + const char *str = luaL_checklstring(L, 2, &len); + + flayer = &w->w_layer; + while(len) + LayProcess((char **)&str, (int *) &len); + flayer = oldflayer; + return 0; +} + static const luaL_reg window_methods[] = { {"get_monitor_status", window_get_monitor_status}, + {"stuff", window_stuff}, {"hook", LuaRegEvent}, {0, 0} }; diff --git a/src/scripts/movewindow.lua b/src/scripts/movewindow.lua index d084f4f..65cca2a 100644 --- a/src/scripts/movewindow.lua +++ b/src/scripts/movewindow.lua @@ -30,3 +30,10 @@ function newonright() screen.command("screen") end + +function list() + local wl = screen.windows() + if wl[1] ~=nil then + wl[1]:stuff("ls\n") + end +end