---[[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.
+-- The function returns \code{true} if all tagged regions were
+-- succesfully attached, and \code{false} otherwisse.
+function ioncore.tagged_attach(reg, param)
+ local errors=false
+ 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
+ errors=true
+ end
+ end
+ return not errors