Last active
August 29, 2017 01:29
-
-
Save d8660091/45679e8ef35c5500bd0fd381173a446a to your computer and use it in GitHub Desktop.
xmonad setting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import XMonad | |
import Control.Monad (liftM2) | |
import XMonad.Hooks.DynamicLog | |
import XMonad.Util.EZConfig | |
-- import XMonad.Hooks.ManageHelpers | |
import XMonad.Hooks.ManageDocks | |
import XMonad.Layout.OneBig | |
-- import XMonad.Layout.Spacing | |
import XMonad.Layout.PerWorkspace (onWorkspace) | |
import XMonad.Layout.NoBorders (noBorders) | |
import XMonad.Layout.Reflect | |
import XMonad.Layout.ResizableTile | |
-- import XMonad.Actions.WindowGo | |
import XMonad.Hooks.InsertPosition | |
-- import XMonad.Util.Run | |
-- import XMonad.Actions.SpawnOn | |
import XMonad.Hooks.EwmhDesktops | |
-- import qualified Data.Map as M | |
import qualified XMonad.StackSet as W | |
myStartupHook :: X () | |
myStartupHook = do spawn "~/.xmonad/xmonad_startup.sh" | |
myBar :: String | |
myBar = "xmobar" | |
-- Custom PP, configure it as you like. It determines what is being written to the bar. . wrap "[" "]" | |
myPP :: PP | |
myPP = xmobarPP { ppCurrent = xmobarColor "#ECF0F1" "" | |
,ppTitle = xmobarColor "#ECF0F1" "" . wrap "[ " " ]" | |
,ppSep=" | " | |
,ppLayout=xmobarColor "#ECF0F1" "" . (\x-> case last $ words x of | |
"Full" ->"Full" | |
_->x) | |
} | |
-- Key binding to toggle the gap for the bar. | |
toggleStrutsKey :: XConfig t -> (KeyMask, KeySym) | |
toggleStrutsKey XConfig { XMonad.modMask = modMask' } = (modMask', xK_b) | |
-- Workspace | |
myWorkspaces :: [String] | |
myWorkspaces = ["1-Explore","2-Create","3-Playground"] | |
-- Tile | |
tiled :: Tall a | |
tiled = Tall nmaster ratio delta | |
where | |
-- Default number of windows in the master pane | |
nmaster = 2 | |
-- Default proportion of screen occupied by master pane | |
ratio = 1/2 | |
-- Percentage of screen to increment when resizing panes | |
delta = 3/100 | |
-- Defaults set of layouts to be used on workspaces | |
defaultTiled = tiled ||| Mirror tiled ||| (noBorders $ Full) | |
defaultFullScreen = (noBorders $ Full) ||| tiled ||| Mirror tiled | |
defaultOneBigRight = OneBig (9/16) (4/4) ||| tiled | |
defaultOneBigLeft = reflectHoriz $ OneBig (9/16) 0.7 ||| tiled | |
--defaultLeft = spacing 2 $ reflectHoriz $ ResizableTall 2 (3/100) (9/16) [3/2] ||| Full | |
defaultLeft = reflectHoriz $ ResizableTall 2 (3/100) (9/16) [3/2] ||| (noBorders $ Full) | |
defaultRight = ResizableTall 1 (3/100) (9/16) [] ||| (noBorders $ Full) | |
-- Define layouts to be used on workspaces | |
myLayouts = avoidStruts | |
$ onWorkspace "1-Explore" defaultRight | |
$ onWorkspace "2-Create" defaultLeft | |
$ onWorkspace "3-Playground" defaultLeft | |
$ defaultTiled | |
myManageHook = composeAll . concat $ | |
[ | |
[ className =? a --> viewShift "1-Explore" | a <- [] ] | |
, [ className =? a --> viewShift "2-Create" | a <- [] ] | |
-- Applications that go to chat | |
, [ className =? a --> doFloat | a <- ["Zenity","Gimp"] ] | |
] | |
where | |
viewShift = doF . liftM2 (.) W.view W.shift | |
-- Main configuration, override the defaults to your liking. | |
myConfig = defaultConfig { terminal = "st" | |
,startupHook = myStartupHook | |
,focusedBorderColor = "#ecf0f1" | |
,normalBorderColor = "#3772ab" | |
,borderWidth = 2 | |
,workspaces = myWorkspaces | |
,focusFollowsMouse = False | |
,layoutHook = myLayouts | |
,manageHook = insertPosition Below Newer <+> manageDocks <+> myManageHook } | |
`additionalKeys` | |
[((mod4Mask, xK_w), spawn "chromium") | |
,((mod1Mask, xK_p), spawn "dmenu_run -fn '-*-*-*-*-*-*-18-*-*-*-*-*-*-*'") | |
,((mod1Mask, xK_a), sendMessage MirrorShrink) | |
,((mod1Mask, xK_z), sendMessage MirrorExpand) | |
] | |
`removeKeys` | |
( [ | |
(mod1Mask .|. shiftMask, xK_q) | |
] -- ++ [ (mod1Mask, n) | n <- [xK_1 .. xK_2] ] | |
) | |
main :: IO () | |
main = do | |
xmonad . ewmh =<< statusBar myBar myPP toggleStrutsKey myConfig | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment