Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- XMonad configuration for use with KDE SC 4
- -- Features:
- -- * KDE integration (including minimizing via panel and floating plasma)
- -- * Switching between Tall and Fullscreen with M-f
- -- * Toggling Dock with M-<SPC>
- -- * Smart borders (i.e. only when needed)
- -- * Restoring tiling with M-a
- -- * Meta is "Super" or "Windows"
- -- TODO: Handle workspaces better
- -- TODO: Integrate krunner, too
- -- TODO: Improve floating (resizing, maybe even decorations)
- import XMonad
- -- KDE integration
- import XMonad.Config.Kde -- this also does the ewmh stuff
- import XMonad.Hooks.ManageDocks
- import XMonad.Hooks.SetWMName -- needed for java stuff
- -- Layouts and layout modifiers
- import XMonad.Layout.Fullscreen
- import XMonad.Layout.Minimize
- import XMonad.Hooks.Minimize
- import XMonad.Layout.NoBorders
- -- Helpers
- import XMonad.Util.EZConfig
- import XMonad.Hooks.ManageHelpers -- needed for isFullscreen and doFullFloat
- import XMonad.Actions.WithAll -- needed for sinkAll (i.e. restore tiling)
- import qualified XMonad.StackSet as W
- import qualified Data.Map as M
- -- Some layouts to try out
- -- import XMonad.Layout.MosaicAlt
- import XMonad.Layout.IM
- import Data.Ratio ((%))
- import XMonad.Layout.Magnifier
- -- Some layouts I've tried and rejected
- -- import XMonad.Layout.Circle -- Wastes lots of screenspace
- -- import XMonad.Layout.Accordion -- Unusable with more than 5 windows
- -- import XMonad.Layout.HintedTile -- Can't see a difference (Defines Tall - needs hiding in XMonad)
- -- import XMonad.Layout.Spiral -- Not resizable (bummer, since it's quite good)
- -- import XMonad.Layout.MagicFocus -- Broken with KDE
- -- import XMonad.Layout.Tabbed -- Better served with a panel at the side of the screen (more features and less screen waste on a widescreen)
- -- import XMonad.Layout.ToggleLayouts -- Not needed
- --import XMonad.Layout.WindowSwitcherDecoration -- If only I could figure out how to use it without buttons
- --import XMonad.Layout.DraggingVisualizer
- --import XMonad.Layout.Decoration -- needed for wsd without buttons
- --import XMonad.Layout.DecorationAddons -- needed for wsd with buttons
- --import XMonad.Util.Themes
- main = do
- xmonad $ kde4Config
- {
- -- TODO: Does order matter?
- modMask = mod4Mask
- , startupHook = setWMName "LG3D" <+> startupHook kde4Config
- , manageHook = manageHook kde4Config <+> myManageHook <+> manageDocks
- , layoutHook = myLayout
- , handleEventHook = handleEventHook kde4Config <+> docksEventHook <+> minimizeEventHook
- , borderWidth = 1
- , mouseBindings = myMouseBindings
- , normalBorderColor = myNormalBorderColor
- , focusedBorderColor = myFocusedBorderColor
- } `additionalKeysP`
- [ ("M-m", withFocused minimizeWindow)
- , ("M-n", sendMessage RestoreNextMinimizedWin)
- , ("M-a", sinkAll) -- "retile"
- , ("M-c", kill)
- , ("M-x", kill)
- , ("M-f", sendMessage ToggleStruts)
- , ("M-b", spawn "firefox")
- , ("M-e", spawn "dolphin")
- -- This is done by KDE for now (as a dbus call bound to a global hotkey)
- -- , ("M1-C-l", spawn "dbus-send --session --dest=org.freedesktop.ScreenSaver --type=method_call /ScreenSaver -- org.freedesktop.ScreenSaver.Lock")
- ]
- myNormalBorderColor = "#000033"
- myFocusedBorderColor = "#ffff00"
- myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $
- -- mod-button1 (Left), Set the window to floating mode and move by dragging
- [ ((modm, button1), (\w -> focus w >> mouseMoveWindow w
- >> windows W.shiftMaster))
- -- mod-button2 (Middle) or mod-shift-button1, Set the window to floating mode and resize by dragging
- , ((modm, button2), (\w -> focus w >> mouseResizeWindow w
- >> windows W.shiftMaster))
- , ((modm .|. shiftMask, button1), (\w -> focus w >> mouseResizeWindow w
- >> windows W.shiftMaster))
- -- mod-button3 (Right), Swap the window with the master
- , ((modm, button3), (\w -> focus w >> windows W.swapMaster))
- -- you may also bind events to the mouse scroll wheel (button4 and button5)
- ]
- myManageHook = composeAll . concat $
- [ [ className =? c --> doFloat | c <- classFloats]
- , [ title =? t --> doFloat | t <- titleFloats]
- , [ isFullscreen --> doFullFloat ]
- ]
- where classFloats = ["MPlayer", "Gimp", "plasma-desktop", "Plasma-desktop", "plasma", "Plasma", "krunner", "yakuake", "Yakuake", "ksplashsimple", "ksplashqml", "ksplashx"]
- titleFloats = []
- -- TODO: Find spiral with resizable master
- myLayout = modifiers (all)
- where tiled = Tall nmaster delta ratio
- nmaster = 1
- delta = 1/100
- ratio = 2/3
- fullfull = fullscreenFull Full
- im = withIM(1%5) (ClassName "Skype") $ withIM (1%5) (ClassName "Ktp-text-ui") tiled
- -- When I want fullscreen, I usually don't want the panel
- -- TODO: Find a way to set avoidStruts to false (i.e. allow fullfull to toggle struts but have it disabled by default)
- all = avoidStruts(tiled) ||| avoidStruts(im) ||| avoidStrutsOn [] fullfull
- modifiers x = minimize(smartBorders(x))
- --ws l = windowSwitcherDecorationWithButtons shrinkText defaultThemeWithButtons (draggingVisualizer l)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement