Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
131 lines (120 sloc) 4.78 KB
import Graphics.X11.ExtraTypes.XF86
import System.Taffybar.Hooks.PagerHints (pagerHints)
import XMonad
import XMonad.Actions.CycleWS (nextWS, prevWS)
import XMonad.Actions.PhysicalScreens (sendToScreen, viewScreen)
import XMonad.Actions.Warp (banish, Corner(..))
import XMonad.Hooks.EwmhDesktops (ewmh, fullscreenEventHook)
import XMonad.Hooks.ManageDocks (avoidStruts, manageDocks, ToggleStruts(..))
import XMonad.Hooks.SetWMName (setWMName)
import XMonad.Layout.Gaps
import XMonad.Layout.LayoutCombinators (JumpToLayout(..))
import XMonad.Layout.NoBorders (smartBorders)
import XMonad.Layout.Renamed (renamed, Rename(..))
import XMonad.Layout.Spacing (smartSpacing)
import XMonad.Layout.ThreeColumns
import XMonad.Util.EZConfig (additionalKeys)
main :: IO ()
main =
xmonad $ ewmh $ pagerHints $ def
{ modMask = winKey
, borderWidth = 2
, terminal = show Terminal
, manageHook = manageDocks
, handleEventHook = handleEventHook def <+> fullscreenEventHook
, startupHook = setWMName "LG3D"
, layoutHook =
renamed [CutWordsLeft 2] $
gaps gapSpec $ avoidStruts $ smartBorders $ smartSpacing 6 $
(tall ||| mirror ||| three ||| full)
}
`additionalKeys`
[ ((shiftWin, xK_e), start Emacs)
, ((shiftWin, xK_m), start MailCheck)
, ((shiftWin, xK_o), start Office)
, ((shiftWin, xK_t), start Tmux)
, ((shiftWin, xK_w), start Browser)
, ((shiftWin, xK_x), start Mixer)
, ((shiftWin, xK_z), start Suspend)
, ((shiftWin, xK_backslash), start Xinerama)
, ((shiftWin, xK_Delete), start KillWin)
, ((shiftWin, xK_quoteleft), start Invert)
, ((0, xF86XK_MonBrightnessDown), start $ Bright LT)
, ((0, xF86XK_MonBrightnessUp), start $ Bright GT)
, ((0, xF86XK_AudioLowerVolume), start $ Volume LT)
, ((0, xF86XK_AudioRaiseVolume), start $ Volume GT)
, ((0, xF86XK_AudioMute), start $ Volume EQ)
, ((winKey, xK_apostrophe), start $ ScreenCap False)
, ((shiftWin, xK_apostrophe), start $ ScreenCap True)
, ((winKey, xK_d), sendMessage ToggleStruts)
, ((winKey, xK_backslash), banish UpperRight)
, ((winKey, xK_z), start Lock)
, ((winKey, xK_Down), nextWS)
, ((winKey, xK_Up), prevWS)
, ((winKey, xK_bracketleft), viewScreen 0)
, ((winKey, xK_bracketright), viewScreen 1)
, ((shiftWin, xK_bracketleft), sendToScreen 0)
, ((shiftWin, xK_bracketright), sendToScreen 1)
, ((altWin, xK_1), sendMessage $ JumpToLayout "Tall")
, ((altWin, xK_2), sendMessage $ JumpToLayout "Wide")
, ((altWin, xK_3), sendMessage $ JumpToLayout "Three")
, ((altWin, xK_4), sendMessage $ JumpToLayout "Full")
, ((winKey, xK_g), sendMessage ToggleGaps)
, ((altWin, xK_Prior), sendMessage $ IncGap gapDelta L)
, ((altWin, xK_Left), sendMessage $ DecGap gapDelta L)
, ((altWin, xK_Up), sendMessage $ IncGap gapDelta D)
, ((altWin, xK_Down), sendMessage $ DecGap gapDelta D)
, ((altWin, xK_Next), sendMessage $ IncGap gapDelta R)
, ((altWin, xK_Right), sendMessage $ DecGap gapDelta R)
, ((altWin, xK_bracketleft), sendMessage $ IncGap gapDelta U)
, ((altWin, xK_bracketright), sendMessage $ DecGap gapDelta U)
]
where
winKey = mod4Mask
shiftWin = winKey .|. shiftMask
altWin = winKey .|. mod1Mask
start = spawn . show
gapSpec = [(U,10), (D,120), (L,20), (R,20)]
gapDelta = 10
growDelta = 1/100
tall = Tall 1 growDelta (1/2)
mirror = renamed [Replace "Wide"] $ Mirror tall
three = renamed [CutRight 3] $ ThreeColMid 1 growDelta (1/2)
full = Full
data App
= Browser
| Emacs
| KillWin
| MailCheck
| Mixer
| Office
| Suspend
| Terminal
| Tmux
| Xinerama
| Bright Ordering
| Volume Ordering
| Lock
| ScreenCap Bool
| Invert
instance Show App where
show Browser = "chromium"
show Emacs = "emacsclient -c -n"
show KillWin = "xkill"
show MailCheck = "notmuch new"
show Mixer = show Terminal ++ " -e alsamixer"
show Office = "libreoffice"
show Suspend = "systemctl suspend"
show Terminal = "termite"
show Tmux = show Terminal ++ " -e tmux"
show Xinerama = "arandr"
show(Bright GT) = "light -A 3"
show(Bright LT) = "light -U 3"
show(Bright EQ) = "true"
show(Volume GT) = "amixer -D pulse sset Master 3%+"
show(Volume LT) = "amixer -D pulse sset Master 3%-"
show(Volume EQ) = "amixer -D pulse sset Master toggle"
show Lock = "xautolock -locknow"
show(ScreenCap False) = "xfce4-screenshooter -r -s ~/tmp"
show(ScreenCap True) = "xfce4-screenshooter -f -s ~/tmp"
show Invert = "xcalib -i -a"