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 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | -------------------------------------------------------------------------------
-- __ ____ __ _ --
-- \ \/ / \/ | ___ _ __ __ _ __| | --
-- \ /| |\/| |/ _ \| '_ \ / _` |/ _` | --
-- / \| | | | (_) | | | | (_| | (_| | --
-- /_/\_\_| |_|\___/|_| |_|\__,_|\__,_| --
-- --
-------------------------------------------------------------------------------
-- written by Shotaro Fujimoto (https://github.com/ssh0) --
-- modified and repaired by Ogis (https://github.com/Minda1975) --
-------------------------------------------------------------------------------
-- Import modules {{{
-------------------------------------------------------------------------------
import qualified Data.Map as M
import Control.Monad (liftM2) -- myManageHookShift
import Data.Monoid
import System.IO -- for xmobar
import XMonad
import qualified XMonad.StackSet as W -- myManageHookShift
import XMonad.Actions.CopyWindow
import XMonad.Actions.CycleWS
import qualified XMonad.Actions.FlexibleResize as Flex -- flexible resize
import XMonad.Actions.FloatKeys
import XMonad.Actions.UpdatePointer
import XMonad.Actions.WindowGo
import XMonad.Actions.DwmPromote -- zoom swap dwm style
import XMonad.Hooks.DynamicLog -- for xmobar
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.ManageDocks -- avoid xmobar area
import XMonad.Hooks.ManageHelpers
import XMonad.Layout
import XMonad.Layout.DragPane -- see only two window
import XMonad.Layout.Gaps
import XMonad.Layout.LayoutScreens
import XMonad.Layout.NoBorders -- In Full mode, border is no use
import XMonad.Layout.PerWorkspace -- Configure layouts on a per-workspace
import XMonad.Layout.ResizableTile -- Resizable Horizontal border
import XMonad.Layout.Simplest
import XMonad.Layout.SimplestFloat
import XMonad.Layout.Spacing -- this makes smart space around windows
import XMonad.Layout.ToggleLayouts -- Full window at any time
import XMonad.Layout.TwoPane
import XMonad.Layout.Renamed
import XMonad.Layout.ThreeColumns
import XMonad.Layout.Grid
import XMonad.Prompt
import XMonad.Prompt.Window -- pops up a prompt with window names
import XMonad.Util.EZConfig -- removeKeys, additionalKeys
import XMonad.Util.Run
import XMonad.Util.Run(spawnPipe) -- spawnPipe, hPutStrLn
import XMonad.Util.SpawnOnce
import Graphics.X11.ExtraTypes.XF86
--------------------------------------------------------------------------- }}}
-- local variables {{{
-------------------------------------------------------------------------------
myWorkspaces = ["1", "2", "3", "4", "5"]
modm = mod4Mask
-- Original Color Setting
--colorBlue = "#868bae"
--colorGreen = "#00d700"
--colorRed = "#ff005f"
--colorGray = "#666666"
--colorWhite = "#bdbdbd"
--colorNormalbg = "#1c1c1c"
--colorfg = "#a8b6b8"
-- Soft Color Setting
colorBlue = "#477ab3"
colorGreen = "#52ad91"
colorRed = "#52ad91"
colorGray = "#4d4d4d"
colorWhite = "#ffffff"
colorNormalbg = "#1b1b1b"
colorfg = "#ffffff"
-- Border width
borderwidth = 0
-- Border color
mynormalBorderColor = "#333333"
--myfocusedBorderColor = "#585858"
myfocusedBorderColor = "#cca8c9"
-- Float window control width
moveWD = borderwidth
resizeWD = 2*borderwidth
-- gapwidth
gapwidth = 9
gwU = 1
gwD = 0
gwL = 42
gwR = 42
--------------------------------------------------------------------------- }}}
-- main {{{
-------------------------------------------------------------------------------
main :: IO ()
main = do
wsbar <- spawnPipe myWsBar
xmonad $ ewmh def
{ borderWidth = borderwidth
, terminal = "urxvt"
, focusFollowsMouse = True
, normalBorderColor = mynormalBorderColor
, focusedBorderColor = myfocusedBorderColor
, manageHook = myManageHookShift <+>
myManageHookFloat <+>
manageDocks
, layoutHook = avoidStruts $ ( toggleLayouts (noBorders Full)
-- $ onWorkspace "3" simplestFloat
$ myLayout
)
-- xmobar setting
, logHook = myLogHook wsbar >> updatePointer (0.5,0.5) (0,0)
, handleEventHook = fullscreenEventHook <+> docksEventHook
, workspaces = myWorkspaces
, modMask = modm
, mouseBindings = newMouse
}
-------------------------------------------------------------------- }}}
-- Define keys to remove {{{
------------------------------------------------------------------------
`removeKeysP`
[
-- Unused gmrun binding
"M-S-p",
-- Unused close window binding
"M-S-c",
"M-S-<Return>"
]
-------------------------------------------------------------------- }}}
-- Keymap: window operations {{{
------------------------------------------------------------------------
`additionalKeysP`
[
-- Shrink / Expand the focused window
("M-," , sendMessage Shrink)
, ("M-." , sendMessage Expand)
, ("M-z" , sendMessage MirrorShrink)
, ("M-a" , sendMessage MirrorExpand)
-- Close the focused window
, ("M-S-c" , kill1)
-- Toggle layout (Fullscreen mode)
, ("M-f" , sendMessage ToggleLayout)
--, ("M-S-f" , withFocused (keysMoveWindow (-borderwidth,-borderwidth)))
-- toggle layout (simplest float)
, ("M-u" , sendMessage (Toggle "Simplest"))
-- Move the focused window
, ("M-C-<R>", withFocused (keysMoveWindow (moveWD, 0)))
, ("M-C-<L>", withFocused (keysMoveWindow (-moveWD, 0)))
, ("M-C-<U>", withFocused (keysMoveWindow (0, -moveWD)))
, ("M-C-<D>", withFocused (keysMoveWindow (0, moveWD)))
-- Resize the focused window
, ("M-s" , withFocused (keysResizeWindow (-resizeWD, resizeWD) (0.5, 0.5)))
, ("M-i" , withFocused (keysResizeWindow (resizeWD, resizeWD) (0.5, 0.5)))
-- Increase / Decrese the number of master pane
, ("M-S-;" , sendMessage $ IncMasterN 1)
, ("M--" , sendMessage $ IncMasterN (-1))
-- Go to the next / previous workspace
, ("M-<R>" , nextWS )
, ("M-<L>" , prevWS )
, ("M-l" , nextWS )
, ("M-h" , prevWS )
-- Shift the focused window to the next / previous workspace
, ("M-S-<R>", shiftToNext)
, ("M-S-<L>", shiftToPrev)
, ("M-S-l" , shiftToNext)
, ("M-S-h" , shiftToPrev)
-- CopyWindow
, ("M-v" , windows copyToAll)
, ("M-S-v" , killAllOtherCopies)
-- Move the focus down / up
, ("M-<D>" , windows W.focusDown)
, ("M-<U>" , windows W.focusUp)
, ("M-j" , windows W.focusDown)
, ("M-k" , windows W.focusUp)
-- Swap the focused window down / up
, ("M-S-j" , windows W.swapDown)
, ("M-S-k" , windows W.swapUp)
, ("M-S-<D>" , windows W.swapDown)
, ("M-S-<U>" , windows W.swapUp)
-- Shift the focused window to the master window
, ("M-S-m" , windows W.shiftMaster)
-- Search a window and focus into the window
, ("M-g" , windowPromptGoto myXPConfig)
-- Search a window and bring to the current workspace
, ("M-b" , windowPromptBring myXPConfig)
-- Move the focus to next screen (multi screen)
, ("M-<Tab>", nextScreen)
-- Now we have more than one screen by dividing a single screen
, ("M-C-<Space>", layoutScreens 2 (TwoPane 0.5 0.5))
, ("M-C-S-<Space>", rescreen)
]
-------------------------------------------------------------------- }}}
-- Keymap: moving workspace by number {{{
------------------------------------------------------------------------
`additionalKeys`
[ ((modm .|. m, k), windows $ f i)
| (i, k) <- zip myWorkspaces
[ xK_exclam, xK_at, xK_numbersign
, xK_dollar, xK_percent, xK_asciicircum
, xK_ampersand, xK_asterisk, xK_parenleft
, xK_parenright
]
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]
]
-------------------------------------------------------------------- }}}
-- Keymap: custom commands {{{
------------------------------------------------------------------------
`additionalKeysP`
[
-- Zoomswap dwm like
("M-<Return>", dwmpromote)
-- Launch audio player
, ("M-w", spawn "audacious")
-- Launch ebook reader)
, ("C-<Tab>", spawn "fbreader")
-- Launch terminal
, ("M-S-<Return>", spawn "urxvt")
-- Launch file manager
, ("M-S-f", spawn "pcmanfm")
-- Launch web browser
, ("M-S-w", spawn "/home/mindaugas/Documents/Browser/firefox/firefox")
-- Launch dmenu for launching applicatiton
, ("M-p", spawn "/home/mindaugas/.scripts/emenu_run")
, ("M-r", spawn "/home/mindaugas/.scripts/emenu_run")
-- Toggle workspace
, ("M-<Tab>", toggleWS)
-- Play / Pause media keys
--, ("<XF86AudioPlay>" , spawn "ncmpcpp toggle")
--, ("<XF86HomePage>" , spawn "ncmpcpp toggle")
--, ("S-<F6>" , spawn "ncmpcpp toggle")
--, ("S-<XF86AudioPlay>", spawn "streamradio pause")
--, ("S-<XF86HomePage>" , spawn "streamradio pause")
-- Volume setting media keys
--, ("<XF86AudioRaiseVolume>", spawn "sound_volume_change_wrapper.sh +")
--, ("<XF86AudioLowerVolume>", spawn "sound_volume_change_wrapper.sh -")
--, ("<XF86AudioMute>" , spawn "sound_volume_change_wrapper.sh m")
-- Brightness Keys
--, ("<XF86MonBrightnessUp>" , spawn "xbacklight + 5 -time 100 -steps 1")
--, ("<XF86MonBrightnessDown>", spawn "xbacklight - 5 -time 100 -steps 1")
-- Take a screenshot (whole window)
, ("<Print>", spawn "scrot")
]
--------------------------------------------------------------------------- }}}
-- myLayout: Handle Window behaveior {{{
-------------------------------------------------------------------------------
--myLayout = spacing gapwidth $ gaps [(U, gwU),(D, gwD),(L, gwL),(R, gwR)]
-- $ (ResizableTall 1 (1/204) (119/204) [])
-- ||| (TwoPane (1/204) (119/204))
-- ||| Simplest
myLayout = tiled ||| mtiled ||| full ||| threecol ||| grid
where
nmaster = 1 -- Default number of windows in master pane
delta = 2/100 -- Percentage of the screen to increment when resizing
ratio = 5/8 -- Defaul proportion of the screen taken up by main pane
rt = spacing 5 $ ResizableTall nmaster delta ratio []
tiled = renamed [Replace "T"] $ smartBorders rt
mtiled = renamed [Replace "Bs"] $ smartBorders $ Mirror rt
full = renamed [Replace "M"] $ noBorders Full
threecol = renamed [Replace "3c"] $ ThreeColMid 1 (3/100) (1/2)
grid = renamed [Replace "G"] $ GridRatio (3/3)
--------------------------------------------------------------------------- }}}
-- myManageHookShift: some window must created there {{{
-------------------------------------------------------------------------------
myManageHookShift = composeAll
-- if you want to know className, type "$ xprop|grep CLASS" on shell
[ className =? "Gimp" --> mydoShift "3"
]
where mydoShift = doF . liftM2 (.) W.greedyView W.shift
--------------------------------------------------------------------------- }}}
-- myManageHookFloat: new window will created in Float mode {{{
-------------------------------------------------------------------------------
myManageHookFloat = composeAll
[ className =? "Gimp" --> doFloat
, className =? "SMPlayer" --> doFloat
, className =? "mpv" --> doCenterFloat
, className =? "feh" --> doCenterFloat
, className =? "Audacious" --> doCenterFloat
--, className =? "Thunar" --> doCenterFloat
, className =? "Websearch" --> doCenterFloat
, title =? "urxvt_float" --> doSideFloat SC
, isFullscreen --> doFullFloat
, isDialog --> doCenterFloat
, stringProperty "WM_NAME" =? "LINE" --> (doRectFloat $ W.RationalRect 0.60 0.1 0.39 0.82)
, stringProperty "WM_NAME" =? "Google Keep" --> (doRectFloat $ W.RationalRect 0.3 0.1 0.4 0.82)
, stringProperty "WM_NAME" =? "tmptex.pdf - 1/1 (96 dpi)" --> (doRectFloat $ W.RationalRect 0.29 0.25 0.42 0.5)
, stringProperty "WM_NAME" =? "Figure 1" --> doCenterFloat
]
--------------------------------------------------------------------------- }}}
-- myLogHook: loghock settings {{{
-------------------------------------------------------------------------------
myLogHook h = dynamicLogWithPP $ wsPP { ppOutput = hPutStrLn h }
--------------------------------------------------------------------------- }}}
-- myWsBar: xmobar setting {{{
-------------------------------------------------------------------------------
myWsBar = "xmobar $HOME/.xmonad/xmobarrc"
wsPP = xmobarPP { ppOrder = \(ws:l:t:_) -> [ws,l,t]
, ppCurrent = xmobarColor colorRed colorNormalbg . \s -> "●"
, ppUrgent = xmobarColor colorGray colorNormalbg . \s -> "●"
, ppVisible = xmobarColor colorRed colorNormalbg . \s -> "⦿"
, ppHidden = xmobarColor colorGray colorNormalbg . \s -> "●"
, ppHiddenNoWindows = xmobarColor colorGray colorNormalbg . \s -> "○"
, ppTitle = xmobarColor colorRed colorNormalbg
, ppOutput = putStrLn
, ppWsSep = " "
, ppSep = " "
}
--------------------------------------------------------------------------- }}}
-- myXPConfig: XPConfig {{{
myXPConfig = def
{ font = "xft:Iosevka Slab:size=10:antialias=true"
, fgColor = colorfg
, bgColor = colorNormalbg
, borderColor = colorNormalbg
, height = 35
, promptBorderWidth = 0
, autoComplete = Just 100000
, bgHLight = colorNormalbg
, fgHLight = colorRed
, position = Bottom
}
--------------------------------------------------------------------------- }}}
-- newMouse: Right click is used for resizing window {{{
-------------------------------------------------------------------------------
myMouse x = [ ((modm, button3), (\w -> focus w >> Flex.mouseResizeWindow w)) ]
newMouse x = M.union (mouseBindings def x) (M.fromList (myMouse x))
--------------------------------------------------------------------------- }}}
-- vim: ft=haskell
|
x
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 | -- vim: ft=haskell
Config { font = "xft:Iosevka Slab:size=10:antialias=true"
, bgColor = "#1b1b1b" --"#1d1f21" --"#1c1c1c"
, fgColor = "#737373"
, position = Top
--, position = TopSize C 100 35 -- use this if only using one monitor
--, position = Static { xpos = 0 , ypos = 0, width = 1920, height = 24 } --manually position bar to display on left monitor
, lowerOnStart = False
, allDesktops = True
, overrideRedirect = False
, border = BottomBM 0
, borderColor = "#4e4e4e"
, commands = [ Run Network "enp8s0" [ "-t" , "■<rx> □<tx> "
, "-L" , "40"
, "-H" , "200"
, "-m" , "3"
, "--normal" , "#b0bdbd"
, "--high" , "#86ae86"
] 10
, Run MultiCpu [ "-t" , "■ <total0>.<total1>.<total2>.<total3> "
, "-L" , "40"
, "-H" , "85"
, "-m" , "2"
, "--normal" , "#b0bdbd"
, "--high" , "#ae8686"
] 10
, Run Memory [ "-t" , "□ <usedratio>% "
, "-L" , "40"
, "-H" , "90"
, "-m" , "2"
, "--normal" , "#b0bdbd"
, "--high" , "#ae8686"
] 10
, Run Date "%a %m/%d %H:%M" "date" 10
, Run StdinReader
]
, sepChar = "%"
, alignSep = "}{"
, template = " %StdinReader% }{ %multicpu%%memory%%enp8s0%<fc=#52ad91>%date%</fc> "
}
|
x
Notes
My latest Xmonad and xmobar config, witch works with .012 version of Xmonad. Bar is simple, yet functional. Only making its presence known when activity exists. Fonts- Iosevka Slab. Also, all my files you can find on my github repo https://github.com/Minda1975/xmonad