As with most things in xmonad, use <+> to combine them. (In this case, >> will also work, as will the equivalent do notation.)windows (W.view "1") <+> spawn "/usr/local/bin/xscreensaver-command -lock"
(The above assumes: import qualified XMonad.StackSet as W)