X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=ioncore%2Fioncore_misc.lua;h=17817659ff5a3af12f153570f443c37acdce2d54;hb=ae4260bb64817c11f9a7140324cd3e3ba113e297;hp=3b24b668e5ac2507f120e79199ae650a925aef2c;hpb=803afbc1cd633f6c025bcd9537e9b7e9aedadd0d;p=ion3.git diff --git a/ioncore/ioncore_misc.lua b/ioncore/ioncore_misc.lua index 3b24b66..1781765 100644 --- a/ioncore/ioncore_misc.lua +++ b/ioncore/ioncore_misc.lua @@ -3,10 +3,7 @@ -- -- Copyright (c) Tuomo Valkonen 2004-2007. -- --- Ion is free software; you can redistribute it and/or modify it under --- the terms of the GNU Lesser General Public License as published by --- the Free Software Foundation; either version 2.1 of the License, or --- (at your option) any later version. +-- See the included file LICENSE for details. -- local group_tmpl = { type="WGroupWS" } @@ -80,10 +77,24 @@ function ioncore.TR(s, ...) end ---[[DOC --- Run \var{cmd} with the environment variable DISPLAY set to point to the --- root window of the X screen \var{reg} is on. -function ioncore.exec_on(reg, cmd) - return ioncore.do_exec_rw(reg:rootwin_of(), cmd) +--DOC +-- Attach tagged regions to \var{reg}. The method of attach +-- depends on the types of attached regions and whether \var{reg} +-- implements \code{attach_framed} and \code{attach}. If \var{param} +-- is not set, the default of \verb!{switchto=true}! is used. +function ioncore.tagged_attach(reg, param) + if not param then + param={switchto=true} + end + local tagged=function() return ioncore.tagged_first(true) end + for r in tagged do + local fn=((not obj_is(r, "WWindow") and reg.attach_framed) + or reg.attach) + + if not (fn and fn(reg, r, param)) then + return false + end + end + return true end ---]] +