-
Notifications
You must be signed in to change notification settings - Fork 0
/
xmonad.hs
171 lines (134 loc) · 5.39 KB
/
xmonad.hs
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
import Control.Concurrent (forkIO, threadDelay)
import Control.Monad (forever)
import System.Exit
import System.IO
import System.Posix.Process (getProcessID)
import System.Posix.Signals (sigTERM, signalProcess)
import Graphics.X11.ExtraTypes.XF86
import Graphics.X11.Types
import XMonad
import XMonad.Actions.CycleWS
import XMonad.Actions.GridSelect
import XMonad.Actions.Volume
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.EwmhDesktops as EWMH
import XMonad.Hooks.FadeInactive
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.SetWMName
import XMonad.Layout.AutoMaster
import XMonad.Layout.Column
import XMonad.Layout.Renamed
import XMonad.Layout.Accordion
import XMonad.Layout.Maximize
import XMonad.Layout.Spacing
-- import XMonad.Layout.Spiral
import XMonad.Layout.Fullscreen as Fullscreen
import XMonad.Layout.NoBorders
import XMonad.Layout.Spiral
import XMonad.Layout.Tabbed
import XMonad.Layout.ThreeColumns
import XMonad.Util.EZConfig (additionalKeys)
import XMonad.Util.Run (spawnPipe)
import XMonad.Config.Kde
import qualified Data.Map as M
import qualified XMonad.StackSet as W
import System.Environment (setEnv)
myTerminal = "urxvtc"
myModMask = mod4Mask
-- Colors for text and backgrounds of each tab when in "Tabbed" layout.
tabConfig = defaultTheme {
activeBorderColor = "#7C7C7C",
activeTextColor = "#CEFFAC",
activeColor = "#000000",
inactiveBorderColor = "#7C7C7C",
inactiveTextColor = "#EEEEEE",
inactiveColor = "#000000"
}
-- Color of current window title in xmobar.
xmobarTitleColor = "#FFB6B0"
-- Color of current workspace in xmobar.
xmobarCurrentWorkspaceColor = "#CEFFAC"
myLayout = smartSpacing 10 $ maximize $ avoidStruts (
autoMasterLayout Accordion |||
tabs |||
Tall 1 (3/100) (1/2) |||
Column 1.6
-- spiral (6/7) |||
-- magnifier (Column 1.5) |||
-- threeCol |||
-- Full
)
where threeCol = ThreeColMid 1 (3/100) (1/2)
tabs = tabbed shrinkText tabConfig
autoMasterLayout otherLayout = renamed [Replace "Auto Master"] (autoMaster 1 (1/100) otherLayout)
myManageHook = composeAll [
className =? "kmix" --> doFloat
, className =? "plasma-desktop" --> doFloat
, className =? "Plasma-desktop" --> doFloat
, className =? "plasmashell" --> doFloat
]
myGSConfig = defaultGSConfig
rofi = "rofi -show run -fg '#505050' -bg '#000000' -hlfg '#ffb964' -hlbg '#000000' -hide-scrollbar"
myKeys conf@(XConfig {XMonad.modMask = modm}) =
M.fromList [
((modm , xK_p) , spawn rofi)
, ((modm .|. mod1Mask , xK_Return), withFocused (sendMessage . maximizeRestore))
, ((modm , xK_Right), nextWS)
, ((modm , xK_Left) , prevWS)
, ((modm .|. shiftMask , xK_Right), shiftToNext >> nextWS)
, ((modm .|. shiftMask , xK_Left) , shiftToPrev >> prevWS)
, ((modm , xK_g) , goToSelected myGSConfig)
, ((modm , xK_d) , spawn "emacsclient -c")
, ((modm , xK_b) , spawn "google-chrome-stable")
, ((modm .|. shiftMask , xK_b) , spawn "feh --no-fehbg --randomize --bg-scale ~/Backgrounds")
, ((modm , xK_f) , sendMessage ToggleStruts)
, ((noModMask, xF86XK_MonBrightnessUp) , spawn "xbacklight +20")
, ((noModMask, xF86XK_MonBrightnessDown) , spawn "xbacklight -20")
, ((noModMask, xF86XK_AudioRaiseVolume) , spawn "amixer set 'Master' 1%+")
, ((noModMask, xF86XK_AudioLowerVolume) , spawn "amixer set 'Master' 1%-")
, ((noModMask, xF86XK_AudioMute) , spawn "amixer set 'Master' toggle")
, ((mod1Mask .|. controlMask, xK_l), spawn "xdg-screensaver lock")
]
configuration =
let cfg = defaultConfig
in cfg {
-- simple stuff
terminal = myTerminal
, modMask = myModMask
-- hooks, layouts
, layoutHook = avoidStruts $ smartBorders $ myLayout
, manageHook = manageDocks <+> manageHook cfg
, startupHook = ewmhDesktopsStartup >> ewmhDesktopsLogHook
, handleEventHook = Fullscreen.fullscreenEventHook <+> EWMH.fullscreenEventHook <+> ewmhDesktopsEventHook <+> docksEventHook <+> handleEventHook cfg
-- , handleEventHook = mconcat [ docksEventHook, handleEventHook cfg ]
-- key bindings
, keys = myKeys <+> keys cfg
}
tray = unwords [
"trayer"
, "--edge top"
, "--align center"
, "--expand true"
, "--width 10 --height 15"
, "--transparent true"
, "--alpha 0"
, "--tint 0x000000"
, "--SetDockType true"
, "--SetPartialStrut true"
]
main = do
xmobarProc <- spawnPipe "xmobar ~/.xmobar.hs"
spawn tray
-- fix java applications for jdk 6,7
-- https://wiki.haskell.org/Xmonad/Frequently_asked_questions#Preferred_Method
setEnv "_JAVA_AWT_WM_NONREPARENTING" "1"
xmonad $ ewmh configuration {
logHook = (fadeInactiveLogHook 0.8) >> (dynamicLogWithPP $ xmobarPP {
ppOutput = \s -> hPutStrLn xmobarProc s
, ppTitle = xmobarColor xmobarTitleColor "" . shorten 100
, ppCurrent = xmobarColor xmobarCurrentWorkspaceColor ""
, ppSep = " "
})
, borderWidth = 3
}