import XMonad import Control.Monad.Trans.Class import Control.Monad.Reader import XMonad.Hooks.ManageDocks (docks) import System.Directory (getHomeDirectory) import System.FilePath (()) import XMonad.Hooks.EwmhDesktops (ewmh) import XMonad.Hooks.ManageHelpers (isFullscreen, doFullFloat) import XMonad.Layout.Fullscreen (fullscreenEventHook) import System.Environment (setEnv) import Data.Monoid import Internal.XMobarLog import Internal.Keys import Internal.Layout import Internal.Logger import Internal.DMenu (menuCommandString) import Internal.Intercept import XMonad.Actions.WithAll (withAll) import qualified XMonad as X import qualified XMonad.StackSet as W main = do -- Execute some commands. homeDir <- getHomeDirectory let fp = homeDir ".xmonad" "startup" setEnv "SUDO_ASKPASS" "/usr/bin/ssh-askpass" setEnv "ROFI" menuCommandString xmobar <- spawnXMobar (=<<) X.xmonad $ applyKeys $ ewmh $ docks $ windowHooks (composeAll [ className =? "Google-chrome" --> composeAll [ -- The geniuses that made chrome decided that Ctrl+W should kill -- the current tab! This makes it consistent with the rest of the -- world ... ctrl+w deletes the last word (ctrl+backspace). rebindKey (controlMask, xK_w) (controlMask, xK_BackSpace), rebindKey (controlMask, xK_h) (0, xK_BackSpace) ] ]) $ def { terminal = "alacritty" , modMask = mod3Mask , borderWidth = 2 , keys = const mempty , focusedBorderColor = "#ff6c00" , normalBorderColor = "#404040" , layoutHook = myLayout , startupHook = spawn fp , manageHook = composeAll [ isFullscreen --> doFullFloat , className =? "Tilda" --> doFloat , className =? "yakuake" --> doFloat , className =? "MPlayer" --> doFloat , title =? "Event Tester" --> doFloat , title =? "Floating Term" --> doCenterFloat , title =? "Notes" --> doCenterFloat , title =? "xmessage" --> doCenterFloat , title =? "gxmessage" --> doCenterFloat , title =? "Volume Control" --> doCenterFloat , className =? "mpv" --> doFloat , className =? "gnubby_ssh_prompt" --> doFloat ] , workspaces = map return (['0'..'9'] ++ ['a'..'z']) , handleEventHook = composeAll [fullscreenEventHook, interceptHook, remapHook] , focusFollowsMouse = False , clickJustFocuses = False , logHook = xMobarLogHook xmobar } doCenterFloat :: ManageHook doCenterFloat = ask >>= \w -> doF . W.float w . centerRect . snd =<< liftX (floatLocation w) centerRect :: W.RationalRect -> W.RationalRect centerRect (W.RationalRect x y w h) = W.RationalRect ((1 - w) / 2) ((1 - h) / 2) w h windowHooks :: WindowHook -> XConfig l -> XConfig l windowHooks (Query readerT) config = do config { startupHook = do withAll $ \w -> runReaderT readerT w startupHook config, manageHook = mappend (Query readerT >> return (Endo id)) (manageHook config) }