Copyright | Bruce Forte (2017) |
---|---|
License | BSD-style (see LICENSE) |
Maintainer | Bruce Forte |
Stability | unstable |
Portability | unportable |
Safe Haskell | None |
Language | Haskell2010 |
Named scratchpads that can be mutually exclusive.
Synopsis
- mkXScratchpads :: [(String, String, Query Bool)] -> ManageHook -> ExclusiveScratchpads
- xScratchpadsManageHook :: ExclusiveScratchpads -> ManageHook
- scratchpadAction :: ExclusiveScratchpads -> String -> X ()
- hideAll :: ExclusiveScratchpads -> X ()
- resetExclusiveSp :: ExclusiveScratchpads -> X ()
- setNoexclusive :: ExclusiveScratchpads -> Window -> X ()
- resizeNoexclusive :: ExclusiveScratchpads -> Window -> X ()
- floatMoveNoexclusive :: ExclusiveScratchpads -> Window -> X ()
- data ExclusiveScratchpad = XSP {}
- type ExclusiveScratchpads = [ExclusiveScratchpad]
- nonFloating :: ManageHook
- defaultFloating :: ManageHook
- customFloating :: RationalRect -> ManageHook
Usage
For this module to work properly, you need to use XMonad.Layout.BoringWindows and XMonad.Layout.Minimize, please refer to the documentation of these modules for more information on how to configure them.
To use this module, put the following in your ~/.xmonad/xmonad.hs
:
import XMonad.Utils.ExclusiveScratchpads import XMonad.ManageHook (title,appName) import qualified XMonad.StackSet as W
Add exclusive scratchpads, for example:
exclusiveSps = mkXScratchpads [ ("htop", "urxvt -name htop -e htop", title =? "htop") , ("xclock", "xclock", appName =? "xclock") ] $ customFloating $ W.RationalRect (1/4) (1/4) (1/2) (1/2)
The scratchpads don't have to be exclusive, you can create them like this (see ExclusiveScratchpad
):
regularSps = [ XSP "term" "urxvt -name scratchpad" (appName =? "scratchpad") defaultFloating [] ]
Create a list that contains all your scratchpads like this:
scratchpads = exclusiveSps ++ regularSps
Add the hooks to your managehook (see XMonad.Doc.Extending), eg.:
manageHook = myManageHook <+> xScratchpadsManageHook scratchpads
And finally add some keybindings (see XMonad.Doc.Extending):
, ((modMask, xK_h), scratchpadAction scratchpads "htop") , ((modMask, xK_c), scratchpadAction scratchpads "xclock") , ((modMask, xK_t), scratchpadAction scratchpads "term") , ((modMask, xK_h), hideAll scratchpads)
Now you can get your scratchpads by pressing the corresponding keys, if you
have the htop
scratchpad on your current screen and you fetch the xclock
scratchpad then htop
gets hidden.
If you move a scratchpad it still gets hidden when you fetch a scratchpad of the same family, to change that behaviour and make windows not exclusive anymore when they get resized or moved add these mouse bindings (see XMonad.Doc.Extending):
, ((mod4Mask, button1), floatMoveNoexclusive scratchpads) , ((mod4Mask, button3), resizeNoexclusive scratchpads)
To reset a moved scratchpad to the original position that you set with its hook,
call resetExclusiveSp
when it is in focus. For example if you want to extend
Mod-Return to reset the placement when a scratchpad is in focus but keep the
default behaviour for tiled windows, set these key bindings:
, ((modMask, xK_Return), windows W.swapMaster >> resetExclusiveSp scratchpads)
Note: This is just an example, in general you can add more than two exclusive scratchpads and multiple families of such.
:: [(String, String, Query Bool)] | List of |
-> ManageHook | The common |
-> ExclusiveScratchpads |
Create ExclusiveScratchpads
from [(name,cmd,query)]
with a common hook
xScratchpadsManageHook Source #
:: ExclusiveScratchpads | List of exclusive scratchpads from
which a |
-> ManageHook |
Create ManageHook
from ExclusiveScratchpads
Keyboard related
:: ExclusiveScratchpads | List of exclusive scratchpads |
-> String | Name of the scratchpad to toggle |
-> X () |
Pop up/hide the scratchpad by name and possibly hide its exclusive
:: ExclusiveScratchpads | List of exclusive scratchpads |
-> X () |
Hide all ExclusiveScratchpads
on the current screen
:: ExclusiveScratchpads | List of exclusive scratchpads |
-> X () |
If the focused window is a scratchpad, the scratchpad gets reset to the original placement specified with the hook and becomes exclusive again
Mouse related
:: ExclusiveScratchpads | List of exclusive scratchpads |
-> Window | Window which should be made not exclusive anymore |
-> X () |
Make a window not exclusive anymore
:: ExclusiveScratchpads | List of exclusive scratchpads |
-> Window | Window which should be resized |
-> X () |
Resize window, make it not exclusive anymore
:: ExclusiveScratchpads | List of exclusive scratchpads |
-> Window | Window which should be moved |
-> X () |
Float and drag the window, make it not exclusive anymore
Types
data ExclusiveScratchpad Source #
type ExclusiveScratchpads = [ExclusiveScratchpad] Source #
Hooks
nonFloating :: ManageHook Source #
Manage hook that makes the window non-floating
defaultFloating :: ManageHook Source #
Manage hook that makes the window floating with the default placement
:: RationalRect |
|
-> ManageHook |
Manage hook that makes the window floating with custom placement