Custom commands script changes

Selection commands now apply only over active layout if user in layout
space.