Copyright | Brandon S Allbery KF8NH <allbery.b@gmail.com> |
---|---|
License | BSD |
Maintainer | Brandon S Allbery KF8NH |
Stability | unstable |
Portability | unportable |
Safe Haskell | None |
Language | Haskell2010 |
A more flexible and general compositing interface than FadeInactive. Windows can be selected and opacity specified by means of FadeHooks, which are very similar to ManageHooks and use the same machinery.
Synopsis
- fadeWindowsLogHook :: FadeHook -> X ()
- type FadeHook = Query Opacity
- data Opacity
- idFadeHook :: FadeHook
- opaque :: FadeHook
- solid :: FadeHook
- transparent :: FadeHook
- invisible :: FadeHook
- transparency :: Rational -> FadeHook
- translucence :: Rational -> FadeHook
- fadeBy :: Rational -> FadeHook
- opacity :: Rational -> FadeHook
- fadeTo :: Rational -> FadeHook
- fadeWindowsEventHook :: Event -> X All
- doS :: Monoid m => m -> Query m
- isFloating :: Query Bool
- isUnfocused :: Query Bool
Usage
To use this module, make sure your xmonad
core supports generalized
ManageHook
s (check the type of idHook
; if it's ManageHook
then
your xmonad
is too old) and then add fadeWindowsLogHook
to your
logHook
and fadeWindowsEventHook
to your handleEventHook
:
, logHook = fadeWindowsLogHook myFadeHook , handleEventHook = fadeWindowsEventHook {- ... -} myFadeHook = composeAll [ opaque , isUnfocused --> transparency 0.2 ]
The above is like FadeInactive with a fade value of 0.2.
FadeHook
s do not accumulate; instead, they compose from right to
left like ManageHook
s, so in the above example myFadeHook
will
render unfocused windows at 4/5 opacity and the focused window as
opaque. This means that, in particular, the order in the above
example is important.
The opaque
hook above is optional, by the way, as any unmatched
window will be opaque by default. If you want to make all windows a
bit transparent by default, you can replace opaque
with something
like
transparency 0.93
at the top of myFadeHook
.
This module is best used with XMonad.Hooks.ManageHelpers, which
exports a number of Queries that can be used in either ManageHook
or FadeHook
.
Note that you need a compositing manager such as xcompmgr
,
dcompmgr
, or cairo-compmgr
for window fading to work. If you
aren't running a compositing manager, the opacity will be recorded
but won't take effect until a compositing manager is started.
For more detailed instructions on editing the logHook
see
the tutorial.
For more detailed instructions on editing the handleEventHook
,
see:
XMonad.Doc.Extending (which sadly doesnt exist at the time of writing...)
WARNING: This module is very good at triggering bugs in compositing managers. Symptoms range from windows not being repainted until the compositing manager is restarted or the window is unmapped and remapped, to the machine becoming sluggish until the compositing manager is restarted (at which point a popup/dialog will suddenly appear; apparently it's getting into a tight loop trying to fade the popup in). I find it useful to have a key binding to restart the compositing manager; for example,
main = xmonad $ def {
{- ... -}
}
additionalKeysP
[("M-S-4",spawn "killall xcompmgr; sleep 1; xcompmgr -cCfF &")]
{- ... -}
]
(See XMonad.Util.EZConfig for additionalKeysP
.)
The logHook
for window fading
fadeWindowsLogHook :: FadeHook -> X () Source #
A logHook
to fade windows under control of a FadeHook
, which is
similar to but not identical to ManageHook
.
The FadeHook
type FadeHook = Query Opacity Source #
A FadeHook is similar to a ManageHook, but records window opacity.
Predefined FadeHook
s
transparent :: FadeHook Source #
Render a window fully transparent.
invisible :: FadeHook Source #
An alias for transparent
.
:: Rational | The window's transparency as a fraction.
|
-> FadeHook |
Specify a window's transparency.
translucence :: Rational -> FadeHook Source #
An alias for transparency
.
:: Rational | The opacity of a window as a fraction.
|
-> FadeHook |
Specify a window's opacity; this is the inverse of transparency
.
handleEventHook
for mapped/unmapped windows
fadeWindowsEventHook :: Event -> X All Source #
A handleEventHook
to handle fading and unfading of newly mapped
or unmapped windows; this avoids problems with layouts such as
Full
or XMonad.Layout.Tabbed. This hook may
also be useful with XMonad.Hooks.FadeInactive.
doF
for simple hooks
doS :: Monoid m => m -> Query m Source #
Like doF
, but usable with ManageHook
-like hooks that
aren't Query
wrapped around transforming functions (Endo
).
Useful Query
s for FadeHook
s
isFloating :: Query Bool Source #
A Query to determine if a window is floating.
isUnfocused :: Query Bool Source #
Returns True if the window doesn't have the focus.