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 qualified Data.Map as Map import Text.Printf import Rahm.Desktop.Swallow import Rahm.Desktop.Common import Rahm.Desktop.XMobarLog import Rahm.Desktop.Keys import Rahm.Desktop.Layout import Rahm.Desktop.Logger import Rahm.Desktop.DMenu (menuCommandString) import Rahm.Desktop.RebindKeys import Rahm.Desktop.Hooks.WindowChange import Rahm.Desktop.History import qualified XMonad as X import qualified Rahm.Desktop.StackSet as W main = do putStrLn "Welcome To RDE!" -- Execute some commands. homeDir <- getHomeDirectory let fp = homeDir ".xmonad" "startup" setEnv "SUDO_ASKPASS" "/usr/bin/ssh-askpass" setEnv "ROFI" menuCommandString xmobar <- spawnXMobar count <- fromIntegral . screenCount <$> openDisplay "" (=<<) X.xmonad $ applyKeys $ withLocationChangeHook historyHook $ ewmh $ docks $ 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 ] -- This config uses dynamic workspaces, but I have to seed XMonad -- with something. However, this configuration only supports 36 -- monitors on boot. If you need more than 36 monitors, you'll have to -- configure those ones after starting XMonad. , workspaces = map return (take count $ ['0'..'9'] ++ ['a'..'z']) , handleEventHook = composeAll [ fullscreenEventHook, remapHook, swallowHook] , focusFollowsMouse = False , clickJustFocuses = False , logHook = xMobarLogHook xmobar } changeHook :: Location -> Location -> X () changeHook l1 l2 = logs Info "Change %s -> %s" (show l1) (show l2) 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 withWindowSet $ mapM_ (runReaderT readerT) . W.allWindows startupHook config, manageHook = mappend (Query readerT >> return (Endo id)) (manageHook config) }