guest@dotshare [~/groups/wms/xmonad] $ ls XMonad/ | cat

XMonad (scrot, raw, dl)

PaulS Feb 01, 2015 (wms/xmonad)

SCROT

  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
import XMonad
import Data.Monoid
import System.Exit
import Text.Regex.Posix ((=~))
import XMonad.Util.EZConfig(additionalKeysP)
import qualified XMonad.StackSet as W
import XMonad.Actions.Navigation2D
import XMonad.Actions.WorkspaceNames
import qualified Data.Map        as M
import XMonad.Util.Scratchpad (scratchpadSpawnAction, scratchpadManageHook, scratchpadFilterOutWorkspace)
import XMonad.Hooks.UrgencyHook
import XMonad.Hooks.ManageHelpers
import XMonad.Util.Run (hPutStrLn, spawnPipe, runInTerm)
import XMonad.Prompt
import XMonad.Prompt.Shell
import XMonad.Prompt.Theme
import XMonad.Layout.BinarySpacePartition hiding (Swap)
import qualified XMonad.Layout.BinarySpacePartition as BSP
import XMonad.Layout.EqualSpacing
import XMonad.Layout.Gaps
import XMonad.Layout.Mosaic
import XMonad.Layout.MosaicAlt
import XMonad.Layout.MouseResizableTile
import XMonad.Layout.MultiToggle
import XMonad.Layout.MultiToggle.Instances
import XMonad.Layout.NoBorders
import XMonad.Layout.Renamed
import XMonad.Layout.Simplest
import XMonad.Layout.SubLayouts
import XMonad.Layout.Tabbed
import Data.Ratio ((%))
import XMonad.Actions.Search
import XMonad.Util.NamedScratchpad
import qualified XMonad.Prompt         as P
import qualified XMonad.Actions.Submap as SM
import qualified XMonad.Actions.Search as S
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Actions.UpdatePointer
import XMonad.Util.WorkspaceCompare
import System.IO 

myStartupHook = startup
startup = do
          spawn "setxkbmap gb"
main = do
        status <- spawnPipe myDzenStatus
        conky  <- spawnPipe myDzenConky 
        xmonad $ withNavigation2DConfig defaultNavigation2DConfig 
               $ withUrgencyHook NoUrgencyHook 
               $ defaultConfig
	   { terminal = myTerminal
           , normalBorderColor  = "#3f3f3f"
           , workspaces         = myWorkspaces
           , focusedBorderColor = "#f0dfaf"
           , logHook            = updatePointer (Relative 0.95 0.95) <+> myLogHook status
           , modMask            = mod4Mask
           , layoutHook         = myLayoutHook
           , focusFollowsMouse  = myFocusFollowsMouse
           , manageHook         = myManageHook <+> manageHook defaultConfig 
           , startupHook        = myStartupHook
           , keys               = \c -> myKeys c
           }

q ~? x = fmap (=~ x) q
myTerminal          = "xterm"
myFocusFollowsMouse = True
myBorderWidth       = 1
altMask             = mod1Mask

myWorkspaces = clickable . (map dzenEscape) $ ["1","2","3","4","5"]
  where clickable l = [ "^ca(1,xdotool key super+" ++ show (n) ++ ")" ++ ws ++ "^ca()" |
                        (i,ws) <- zip [1..] l,
                        let n = i ]

myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
    [ ((modm .|. shiftMask, xK_Return ), spawn $ XMonad.terminal conf)
    , ((modm,               xK_p      ), spawn "lighthouse | sh")
    , ((modm,               xK_b      ), spawn "firefox-developer-edition")
    , ((modm,               xK_c      ), spawn "dwb")
    , ((modm,               xK_f      ), spawn "firefox")
    , ((modm,               xK_t      ), spawn "xterm -name ranger -e ranger")
    , ((modm,               xK_m      ), spawn "xterm -name mutt -e mutt")
    , ((modm .|.shiftMask,  xK_m      ), spawn "xterm -name mpsyt -e mpsyt")         
    , ((modm,               xK_Escape ), spawn "pygtk-shutdown-systemd")
    , ((modm .|. shiftMask, xK_n      ), spawn "mpd && xterm -name ncmpcpp -e ncmpcpp") 
    , ((modm .|. shiftMask, xK_s      ), scratchpadSpawnAction defaultConfig { terminal = myTerminal })
    , ((modm,               xK_a      ), shellPrompt paulXPConfig)  
    , ((modm .|. shiftMask, xK_c      ), kill)
    , ((modm,               xK_Return ), spawn myTerminal)
    , ((modm,               xK_space  ), sendMessage NextLayout)
    , ((modm .|. shiftMask, xK_space  ), setLayout $ XMonad.layoutHook conf)
    , ((modm,               xK_n      ), refresh)
    , ((0,               0x1008ff11   ), spawn "dvol.sh -d 2")
    , ((0,               0x1008ff13   ), spawn "dvol.sh -i 2")
    , ((0,               0x1008ff14   ), spawn "mpc toggle")
    , ((modm .|. shiftMask,   xK_l    ), sendMessage $ ExpandTowards R)
    , ((modm .|. shiftMask,   xK_h    ), sendMessage $ ExpandTowards L)
    , ((modm .|. shiftMask,   xK_j    ), sendMessage $ ExpandTowards D)
    , ((modm .|. shiftMask,   xK_k    ), sendMessage $ ExpandTowards U)
    , ((modm,                 xK_Down ), windows W.focusDown)
    , ((modm,                 xK_Up   ), windows W.focusUp)
    , ((modm .|. altMask,   xK_m      ), windows W.swapMaster)
    , ((modm,               xK_s      ), sendMessage $ BSP.Swap)
    , ((modm .|. shiftMask, xK_q      ), io (exitWith ExitSuccess))
    , ((modm .|. shiftMask, xK_r      ), spawn "xmonad --recompile && xmonad --restart")
    ]
     
     ++
     
     [((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_w, xK_e, xK_r] [0..]
     , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]

paulXPConfig = defaultXPConfig
       {     font        = "xft:M+1m:size=14"
           , bgColor     = "snow1"
           , fgColor     = "#505050"
           , fgHLight    = "#505050"
           , bgHLight    = "snow1"
           , promptBorderWidth = 1
           , position    = Bottom
           , height      = 20
           , historySize = 32 
           , defaultText = []
       }

myLayoutHook = smartBorders $ avoidStruts $ myLayouts
myLayouts    = mkToggle (single FULL) (myLayout3 ||| myLayout1 ||| myLayout2)
    where myMRT     = mouseResizableTile { draggerType = FixedDragger 0 8 }
          myBSP     = emptyBSP
          myLayout1 = renamed [Replace "|"] $ myMRT 
          myLayout2 = renamed [Replace "-"] $ myMRT { isMirrored = True }
          myLayout3 = renamed [Replace "B"] $ equalSpacing 36 6 1 1 $ myBSP
          myFull    = renamed [Replace "O"] $ Full
myLayout1    = mouseResizableTile { draggerType = FixedDragger 0 8 }
myLayout2    = myLayout1 { isMirrored = True } 

myManageHook = composeAll 
    [ className =? "MPlayer"                   --> doFloat
    , className =? "smplayer"                  --> doFloat
    , className =? "Gimp"                      --> doFloat
    , className =? "Pygtk-shutdown-systemd"    --> doFloat
    , resource  =? "lighthouse"                --> doFloat
    , className =? "Dwb"                       --> doShift (myWorkspaces !! 0)
    , className =? "Firefox-developer-edition" --> doShift (myWorkspaces !! 4)
    , className =? "firefox"                   --> doShift (myWorkspaces !! 4)
    , className =? "chromium"                  --> doShift (myWorkspaces !! 4)
    , resource  =? "ncmpcpp"                   --> doShift (myWorkspaces !! 1)
    , resource  =? "gedit"                     --> doShift (myWorkspaces !! 5)
    , resource  =? "ranger"                    --> doShift (myWorkspaces !! 2)
    , resource  =? "mutt"                      --> doShift (myWorkspaces !! 1)
    , className ~? "^libreoffice"              --> doShift (myWorkspaces !! 6)
    , className ~? "libreoffice-writer"        --> doShift (myWorkspaces !! 6)
    , resource  =? "desktop_window"            --> doIgnore
    , resource  =? "kdesktop"                  --> doIgnore 
    ] <+> manageScratchPad

manageScratchPad :: ManageHook
manageScratchPad = scratchpadManageHook (W.RationalRect l t w h)  
  where  
    role = stringProperty "WM_WINDOW_ROLE"
    h = 0.25     -- terminal height, 10%
    w = 0.4      -- terminal width, 100% 
    t = 0.30 - h -- distance from top edge 
    l = 0.97 - w    -- distance from left edge

myLogHook h  = dynamicLogWithPP $ myDzenPP { ppOutput = hPutStrLn h }
myDzenStatus = "dzen2 -w '500' -y '880' -ta 'l'" ++ myDzenStyle
myDzenConky  = "conky -c ~/.conkyrc-monsterwm | dzen2 -y '880' -x '500' -w '1100' -ta 'r'" ++ myDzenStyle
myDzenStyle  = " -h '20' -fg '#777777' -bg '#3f3f3f' -fn 'M+1m:size=14'"
myDzenPP = dzenPP
     { ppCurrent = dzenColor "#3399ff" "" . wrap " " " "
     , ppSort            = fmap (namedScratchpadFilterOutWorkspace .) (ppSort defaultPP)
     , ppHidden = dzenColor "#dddddd" "" . wrap " " " "
     , ppHiddenNoWindows = dzenColor "#777777" "" . wrap " " " "
     , ppUrgent = dzenColor "#ff0000" "" . wrap " " " "
     , ppSep = " "
     , ppLayout = dzenColor "#aaaaaa" "" . wrap "^ca(1,xdotool key super+space)· " " ·^ca()"
     , ppTitle = dzenColor "#ffffff" ""
                   . wrap "^ca(1,xdotool key super+k)^ca(2,xdotool key super+shift+c)"
                   " ^ca()^ca()" . shorten 50 . dzenEscape
     }

CLICK TO VIEW

x