-
Notifications
You must be signed in to change notification settings - Fork 0
/
xmonad_xfce_laptop.hs
120 lines (101 loc) · 4.37 KB
/
xmonad_xfce_laptop.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
-------------------------------------------------------------------------------
-- Configuration for using xmonad inside xfce4.
-- Credits: Johannes 'wulax' Sjölund and Øyvind 'Mr.Elendig' Heggstad
-- https://gist.github.com/jsjolund/94f6821b248ff79586ba
-------------------------------------------------------------------------------
import qualified Data.Map as M
import qualified XMonad.StackSet as W
import Control.Exception
import System.Exit
import XMonad
import XMonad.Actions.CycleWS
import XMonad.Config.Xfce
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.SetWMName
import XMonad.Layout.ComboP
import XMonad.Layout.ResizableTile
conf = ewmh xfceConfig
{ manageHook = pbManageHook <+> manageDocks
<+> manageHook xfceConfig
, handleEventHook = ewmhDesktopsEventHook
, borderWidth = 3
, focusedBorderColor= "#93E0E3"
, normalBorderColor = "#444444"
, workspaces = map show [1 .. 9 :: Int]
, modMask = mod4Mask
, keys = myKeys
}
-- Main --
main :: IO ()
main =
xmonad $ conf
{ startupHook = startupHook conf
, logHook = ewmhDesktopsLogHook
}
-- ManageHook --
pbManageHook :: ManageHook
pbManageHook = composeAll $ concat
[ [ manageDocks ]
, [ manageHook defaultConfig ]
, [ isDialog --> doCenterFloat ]
, [ isFullscreen --> doFullFloat ]
]
-- Keyboard --
myKeys :: XConfig Layout -> M.Map (KeyMask, KeySym) (X ())
myKeys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
-- launching and killing programs
[ ((modMask, xK_Return ), spawn "terminator")
, ((modMask, xK_o ), spawn "xfrun4")
, ((modMask, xK_f ), spawn "thunar")
, ((modMask, xK_c ), kill)
, ((modMask, xK_b ), sendMessage ToggleStruts)
-- layouts
, ((modMask, xK_space ), sendMessage NextLayout)
, ((modMask .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
-- floating layer stuff
, ((modMask, xK_t ), withFocused $ windows . W.sink)
-- refresh
, ((modMask, xK_n ), refresh)
-- focus
, ((modMask, xK_Tab ), windows W.focusDown)
, ((modMask, xK_j ), windows W.focusDown)
, ((modMask, xK_k ), windows W.focusUp)
, ((modMask, xK_m ), windows W.focusMaster)
, ((modMask, xK_Right ), nextWS)
, ((modMask, xK_Left ), prevWS)
, ((modMask .|. shiftMask, xK_Right ), shiftToNext >> nextWS)
, ((modMask .|. shiftMask, xK_Left ), shiftToPrev >> prevWS)
-- swapping
, ((modMask .|. shiftMask, xK_Return ), windows W.swapMaster)
, ((modMask .|. shiftMask, xK_j ), windows W.swapDown)
, ((modMask .|. shiftMask, xK_k ), windows W.swapUp)
, ((modMask, xK_s ), sendMessage $ SwapWindow)
-- increase or decrease number of windows in the master area
, ((modMask, xK_comma ), sendMessage (IncMasterN 1))
, ((modMask, xK_period ), sendMessage (IncMasterN (-1)))
-- resizing
, ((modMask, xK_h ), sendMessage Shrink)
, ((modMask, xK_l ), sendMessage Expand)
, ((modMask .|. shiftMask, xK_h ), sendMessage MirrorShrink)
, ((modMask .|. shiftMask, xK_l ), sendMessage MirrorExpand)
-- quit, or restart
, ((modMask .|. shiftMask, xK_q ), spawn "xmonad --recompile; xmonad --restart")
, ((modMask, xK_q ), spawn "xfce4-session-logout")
, ((modMask .|. shiftMask, xK_z ), spawn "xscreensaver-command --lock")
]
++
-- mod-[1..9] %! Switch to workspace N
-- mod-shift-[1..9] %! Move client to workspace N
[ ((m .|. modMask, k), windows $ f i)
| (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]
]
++
-- mod-[w,e] %! switch to twinview screen 1/2
-- mod-shift-[w,e] %! move window to screen 1/2
[ ((m .|. modMask, key), screenWorkspace sc >>= flip whenJust (windows . f))
| (key, sc) <- zip [xK_w, xK_e] [0..]
, (f, m) <- [(W.view, 0), (W.shift, shiftMask)]
]