Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- xmonad.hs: Configuration file for xmonad
- -- Core
- import XMonad
- import qualified XMonad.StackSet as W
- import System.IO (hPutStrLn)
- import System.Exit
- import qualified Data.Map as M
- import XMonad.Util.EZConfig
- -- Util
- import XMonad.Util.NamedScratchpad (NamedScratchpad(NS), namedScratchpadManageHook, namedScratchpadAction, customFloating)
- import XMonad.Util.Run (safeSpawn, unsafeSpawn, runInTerm, spawnPipe)
- import XMonad.Util.SpawnOnce
- -- Hooks
- import XMonad.Hooks.EwmhDesktops
- import XMonad.Hooks.DynamicLog
- import XMonad.Hooks.ManageDocks
- import XMonad.Hooks.Place (placeHook, withGaps, smart)
- import XMonad.Hooks.InsertPosition
- import XMonad.Hooks.ManageHelpers
- import XMonad.Hooks.FloatNext (floatNextHook, toggleFloatNext, toggleFloatAllNew)
- import XMonad.Hooks.WorkspaceByPos
- -- Actions
- import XMonad.Actions.Promote
- import XMonad.Actions.FloatSnap
- import XMonad.Actions.FloatKeys
- -- Layouts
- import XMonad.Layout.Spacing (spacing)
- import XMonad.Layout.NoBorders
- import XMonad.Layout.Gaps
- import XMonad.Layout.ResizableTile
- import XMonad.Layout.OneBig
- import XMonad.Layout.AutoMaster
- import XMonad.Layout.Circle
- import XMonad.Layout.Grid
- import XMonad.Layout.Spiral
- import XMonad.Layout.NoBorders
- import XMonad.Layout.Mosaic
- import XMonad.Layout.TwoPane
- import XMonad.Layout.CenteredMaster
- import XMonad.Layout.Tabbed
- import XMonad.Layout.DragPane
- import XMonad.Layout.IM
- -- Constants
- myModMask = mod4Mask
- myFocusFollowsMouse = False
- myClickJustFocuses = False
- myBorderWidth = 2
- myTerminal = "urxvt"
- myNormalBorderColor = "#000000"
- myFocusedBorderColor = "#51c4d4"
- myBackgroundColor = "#fe8e38"
- myForegroundColor = "#c7c9cb"
- -- Workspaces
- myWorkspaces :: [String]
- myWorkspaces = [ "W", "M", "F", "T", "C"]
- -- My Layouts
- myLayout = gaps [(U,16),(L,0),(R,0)]
- $ spacing 0
- $ lessBorders OnlyFloat
- $ tiled ||| Mirror tiled ||| Full
- where
- tiled = Tall nmaster delta ratio
- nmaster = 1
- ratio = 1/2
- delta = 3/100
- -- Window rules
- myManageHook = composeAll
- [ isFullscreen --> doFloat
- , className =? "mpv" --> doFullFloat
- ]
- -- MyBar
- myBar = "xmobar"
- -- Event handling
- myEventHook = ewmhDesktopsEventHook
- -- Status bars and logging
- myLogHook = return ()
- -- Startup hook
- myStartupHook = return ()
- main do
- xmonad =<< xmobar myConfig
- myConfig = ewmh $ def {
- terminal = myTerminal,
- focusFollowsMouse = myFocusFollowsMouse,
- clickJustFocuses = myClickJustFocuses,
- borderWidth = myBorderWidth,
- modMask = myModMask,
- workspaces = myWorkspaces,
- normalBorderColor = myNormalBorderColor,
- focusedBorderColor = myFocusedBorderColor,
- keys = myKeys,
- layoutHook = myLayout,
- manageHook = myManageHook <+> fullscreenEventHook,
- handleEventHook = myEventHook,
- logHook = myLogHook,
- startupHook = myStartupHook
- }
- -- Keybindings
- myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
- [ ((mod1Mask, 0xff61), spawn "scrot -s -e 'mv $f ~/Pictures/Screenshots/ 2>/dev/null'")
- , ((0, 0xff61), spawn "scrot -e 'mv $f ~/Pictures/Screenshots/ 2>/dev/null'" )
- , ((0, 0x1008ff13), spawn "amixer -q set Master 2dB+")
- , ((0, 0x1008ff11), spawn "amixer -q set Master 2dB-")
- , ((0, 0x1008ff12), spawn "amixer -q set Master toggleMute")
- , ((modm, xK_a), spawn "urxvt -e ncmpcpp")
- , ((modm .|. shiftMask, xK_b), spawn "urxvt -e vim ~/.xmobarrc")
- , ((modm .|. shiftMask, xK_e), spawn "eject /dev/sr0")
- , ((modm, xK_e), spawn "thunderbird" )
- , ((modm, xK_f), spawn "pcmanfm" )
- , ((modm, xK_p), spawn "dmenu_run" )
- , ((modm .|. shiftMask, xK_p), spawn "gmrun" )
- , ((modm, xK_q), spawn "xmonad --recompile && xmonad --restart && killall xmobar && xmobar")
- , ((modm, xK_r), spawn "urxvt -e ranger" )
- , ((modm, xK_s), spawn "subl" )
- , ((modm, xK_v), spawn "viewnior" )
- , ((modm, xK_w), spawn "vivaldi-stable" )
- , ((modm .|. shiftMask, xK_x), spawn "urxvt -e vim ~/.xmonad/xmonad.hs")
- , ((modm .|. shiftMask, xK_c), kill)
- , ((modm, xK_d), sendMessage Expand )
- , ((modm, xK_g), sendMessage Shrink )
- , ((modm, xK_j), windows W.focusDown)
- , ((modm .|. shiftMask, xK_j), windows W.swapDown )
- , ((modm, xK_k), windows W.focusUp )
- , ((modm .|. shiftMask, xK_k), windows W.swapUp )
- , ((modm, xK_m), windows W.focusMaster)
- , ((modm, xK_n), refresh)
- , ((modm .|. shiftMask, xK_q), io (exitWith ExitSuccess))
- , ((modm .|. shiftMask, xK_t), withFocused $ windows . W.sink)
- , ((modm, xK_t), spawn $ XMonad.terminal conf)
- , ((modm, xK_Tab), windows W.focusDown)
- , ((modm, xK_space), sendMessage NextLayout)
- , ((modm .|. shiftMask, xK_space), setLayout $ XMonad.layoutHook conf)
- , ((modm, xK_comma), sendMessage (IncMasterN 1))
- , ((modm, xK_Return), windows W.swapMaster)
- , ((modm, xK_period), sendMessage (IncMasterN (-1)))
- ]
- ++
- [ ((m .|. modm, k), windows $ f i)
- | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
- , (f, m) <- [(W.greedyView, 0)
- , (W.shift, shiftMask) ]]
- ++
- [((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
- | (key, sc) <- zip [xK_u, xK_o, xK_i] [0..]
- , (f, m) <- [(W.view, 0),
- (W.shift, shiftMask)]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement