1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | -- Libraries {{{
import Control.Monad
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.EwmhDesktops (fullscreenEventHook)
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.UrgencyHook
import XMonad.Util.EZConfig (additionalKeys)
import XMonad.Util.Run (spawnPipe, safeSpawn)
import XMonad.Util.SpawnOnce (spawnOnce)
import XMonad.Layout
import XMonad.Layout.PerWorkspace
import XMonad.Layout.NoBorders
import XMonad.Layout.Spacing
import XMonad.Layout.MultiToggle
import XMonad.Layout.MultiToggle.Instances
import XMonad.Layout.Renamed
import Graphics.X11.ExtraTypes.XF86
import System.IO
import XMonad.Actions.CycleWS
-- }}}
-- Main module {{{
main = do
wsPanel <- spawnPipe wsBar
statsPanel <- spawnPipe statsBar
xmonad
$ docks
$ withUrgencyHook NoUrgencyHook
$ defaultConfig
-- Simple stuff
{ modMask = modm
, terminal = term
, focusFollowsMouse = mouseFocus
, borderWidth = bdrSize
, normalBorderColor = bdrNormal
, focusedBorderColor = bdrFocus
, workspaces = workspaces'
-- Lets hook up
, handleEventHook = eventHook
, logHook = logHook' wsPanel
, layoutHook = layoutHook'
, manageHook = manageHook'
, startupHook = startupHook'
} `additionalKeys` keyboard
---- Simple stuff
modm = mod4Mask
term = "urxvt"
mouseFocus = False
workspaces' = myWorkspaces
keyboard = myKeys
----- Appearance
bdrSize = 5
bdrNormal = bgColor
bdrFocus = fgColor
font = "Misc Termsyn.Icons:size=13"
monitorSize = 1366
monitor n = show(round(monitorSize * n))
----- WHAT COLOR?
bgColor = "#383644"
fgColor = "#FCEBDB"
wsBgColor = "#B79288"
wsFgColor = "#FFFFFF"
hintColor = "#AA3355"
layoutColor = "#9D3E58"
---- Panel
leftBarSize = monitor 0.7
rightBarSize = monitor 0.3
leftBarPos = "0"
rightBarPos = leftBarSize
barHeight = "26"
wsBar =
"dzen2 -dock -ta l \
\ -w '" ++ leftBarSize ++ "' \
\ -h '" ++ barHeight ++ "' \
\ -x '" ++ leftBarPos ++ "' \
\ -fn '" ++ font ++ "'"
statsPanel =
"dzen2 -dock -ta r \
\ -w '" ++ rightBarSize ++ "' \
\ -h '" ++ barHeight ++ "' \
\ -x '" ++ rightBarPos ++ "' \
\ -fn '" ++ font ++ "'"
statusConfig = "conky -c ~/.xmonad/status.conf"
statsBar = statusConfig ++ " | " ++ statsPanel
---- Hooks
eventHook = fullscreenEventHook
layoutHook' = myLayoutHook
logHook' = myLogHook
manageHook' = myManageHook
startupHook' = myStartupHook
-- }}}
-- Log Hook {{{
myLogHook h =
dynamicLogWithPP $
dzenPP
{ ppOutput = hPutStrLn h
, ppCurrent = dzenColor (fg) (bg) . pad
, ppVisible = pad
, ppHidden = pad
, ppUrgent = dzenColor (fg) (hint) . pad
, ppSep = ""
, ppOrder = \(ws:l:t:_) -> [l, ws]
, ppLayout = dzenColor (fg) (layoutBg) . pad . pad .
( \t -> case t of
"Tall" -> "þ"
"Mirror Tall" -> "ü"
"Full" -> "ÿ"
_ -> t
)
}
where
bg = wsBgColor
fg = wsFgColor
hint = hintColor
layoutBg = layoutColor
-- }}}
-- Workspaces {{{
myWorkspaces = ws $ ["TERM", "INET", "DEV", "ENT", "PLAY", "TOOL"]
where
ws l =
[ "^ca(1,xdotool key super+" ++ show n ++ ") " ++ ws ++ " ^ca()"
| (i, ws) <- zip [1 ..] l
, let n = i
]
-- }}}
-- Layout Hook {{{
myLayoutHook =
avoidStruts
$ smartBorders
$ mkToggle (NOBORDERS ?? FULL ?? EOT)
$ standardLayout
where
standardLayout =
renamed [CutWordsLeft 2] $
smartSpacingWithEdge 8 $ layoutHook defaultConfig
-- }}}
-- Manage Hook {{{
myManageHook =
composeAll . concat $
[ [ className =? c --> doShift (w !! 1) | c <- inetApp ]
, [ className =? c --> doShift (w !! 2) | c <- devApp ]
, [ className =? c --> doShift (w !! 3) | c <- entApp ]
, [ className =? c --> doShift (w !! 4) | c <- playApp ]
, [ className =? c --> doFloat | c <- floatingApp ]
, [ className =? c --> doIgnore | c <- ignoreApp ]
, [ isDialog --> doCenterFloat ]
, [ isRole --> doCenterFloat ]
, [ manageDocks ]
, [ manageHook def ]
]
where
w = workspaces'
isRole = stringProperty "WM_WINDOW_ROLE" =? "popup"
inetApp = ["Chromium"]
devApp =
[ "SecureCRT", "GNS3", "VirtualBox Manager"
, "VirtualBox Machine", "jetbrains-studio"
, "Code", "oni"
]
entApp = ["MPlayer", "smplayer", "mpv", "Gimp"]
playApp = ["player", "Genymotion"]
floatingApp = ["SecureCRT", "TeamViewer", "Xmessage"]
ignoreApp = ["desktop", "desktop_window", "stalonetray", "trayer"]
-- }}}
-- Startup Hook {{{
myStartupHook = do
spawnOnce "./.fehbg"
spawnOnce "xsetroot -cursor_name left_ptr"
spawnOnce "setxkbmap -option 'altwin:swap_alt_win'"
spawnOnce "compton --config /dev/null -bGC"
spawnOnce "xclip"
-- }}}
-- Keymapping {{{
-- /usr/include/X11/keysymdef.h
myKeys =
[ ((m, xK_b), spawn "chromium")
, ((m, xK_p), spawn dmenu)
, ((m, xK_s), sendMessage ToggleStruts)
, ((m, xK_BackSpace), focusUrgent)
, ((m, xK_equal), toggleWS)
, ((m, xK_grave), toggleWS)
-- , ((m, xK_Caps_Lock), sendMessage $ Toggle FULL)
, ((0, xF86XK_AudioLowerVolume), spawn "ponymix decrease 10")
, ((0, xF86XK_AudioRaiseVolume), spawn "ponymix increase 10")
, ((0, xF86XK_AudioMute), spawn "ponymix toggle")
, ((0, xF86XK_MonBrightnessDown), spawn "xbacklight -10")
, ((0, xF86XK_MonBrightnessUp), spawn "xbacklight +10")
, ((0, xK_Print), spawn "maim -s | xclip -selection clipboard -t image/png")
]
where
m = modm
s = shiftMask
dmenu =
"dmenu_run -i \
\ -fn '" ++ fn ++ "' \
\ -w '" ++ w ++ "' \
\ -h '" ++ h ++ "' \
\ -x '" ++ x ++ "' \
\ -nb '" ++ nb ++ "' \
\ -sb '" ++ sb ++ "'"
where
w = monitor 0.3
x = monitor 0.7
h = "26"
fn = font
nb = bgColor
sb = "#9D3E58"
-- }}}
|
x
Notes
The belated spring…
Repo rshier/xmonad