[xmonad] Hook on changing workspace event?
Brent Yorgey
byorgey at seas.upenn.edu
Wed Oct 20 09:41:39 EDT 2010
On Wed, Oct 20, 2010 at 11:14:54PM +1100, Владимир Байраковский wrote:
> Hi!
>
> Is there any hook or something else to execute some action (function)
> on every workspace changing event?
Yes, it is called logHook, since it is often used for outputting
logging/status bar information. But it can equally well be used for
other things as well.
> I want xmonad to remove current workspace right after I leav it if
> it is empty.
This should not be too hard. In fact, I think you don't even need the
logHook for this. Just
import XMonad.Actions.DynamicWorkspaces
and change your workspace-switching keybindings to call
removeWorkspace before actually switching. removeWorkspace removes
the current workspace if it contains no windows, and does nothing
otherwise.
Also, depending on what you want, this may not even be necessary:
would it suffice for your needs to have your status bar display only
non-empty workspaces (this is what I do) instead of actually
*removing* empty workspaces? There may be good reasons for actually
removing empty workspaces, it depends on what you want, but I thought
it was worth asking.
-Brent
More information about the xmonad
mailing list