-
Notifications
You must be signed in to change notification settings - Fork 0
/
xmonad.hs
134 lines (125 loc) · 5.21 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
import qualified Data.Map as M
import Data.Ratio
import XMonad
import XMonad.Util.Run (spawnPipe)
import XMonad.Layout.Combo
import XMonad.Layout.Grid
import XMonad.Layout.LayoutModifier
import XMonad.Layout.Named
import XMonad.Layout.NoBorders
import XMonad.Layout.PerWorkspace
import XMonad.Layout.Reflect
import XMonad.Layout.TwoPane
import XMonad.Layout.WindowNavigation
import XMonad.Layout.Circle
import XMonad.Layout.MosaicAlt
import XMonad.Layout.Spiral
import XMonad.Layout.Tabbed
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.SetWMName
import qualified XMonad.StackSet as W
import System.IO
import Control.Monad (liftM2)
import XMonad.Actions.CopyWindow
import XMonad.Actions.RotSlaves
import XMonad.Prompt
import XMonad.Prompt.Shell
import XMonad.Prompt.XMonad
main = do
_ <- spawnPipe myTrayRunner
_ <- spawnPipe myNetworkApplet
_ <- spawnPipe myScreenSaver
-- _ <- spawnPipe myBackgroundInstaller
xmproc <- spawnPipe myBar
xmonad $ docks def
{ modMask = mod4Mask -- Use Super instead of Alt
, workspaces = myWorkspaces
, terminal = "gnome-terminal"
, normalBorderColor = "black"
, focusedBorderColor = "grey"
, borderWidth = 2
, startupHook = setWMName "LG3D" -- для совместимости определёных приложений, java например(IntelliJ IDEA)
, manageHook = myManageHook
, layoutHook = avoidStruts myLayouts
, logHook = dynamicLogWithPP xmobarPP
{ ppOutput = hPutStrLn xmproc
, ppTitle = xmobarColor "green" "" . shorten 50
, ppCurrent = xmobarColor xmobarCurrentWorkspaceColor "" . wrap "[" "]"
, ppSep = " "
, ppWsSep = " "
{-
, ppLayout = (\ x -> case x of
"Spacing 6 Mosaic" -> "[:]"
"Spacing 6 Mirror Tall" -> "[M]"
"Spacing 6 Hinted Tabbed Simplest" -> "[T]"
"Spacing 6 Full" -> "[ ]"
_ -> x )
-}
, ppHiddenNoWindows = showNamedWorkspaces
}
, keys = myKeys <+> keys def
}
where showNamedWorkspaces wsId = if any (`elem` wsId) ['a'..'z']
then pad wsId
else ""
myBackgroundInstaller = "~/.xmonad/feh.sh"
myTrayRunner = "~/.xmonad/tray.sh"
myNetworkApplet = "nm-applet"
myScreenSaver = "xscreensaver -no-splash"
myBar = "xmobar ~/.xmonad/xmobar.hs"
-- Workspaces
termWorkspace = "term"
webWorkspace = "web"
imWorkspace = "im"
devWorkspace = "dev"
mediaWorkspace = "media"
myWorkspaces = [termWorkspace, webWorkspace, imWorkspace, devWorkspace, mediaWorkspace] ++ map show [6..9] ++ ["0", "-", "="]
xmobarCurrentWorkspaceColor = "green"
-- Layouts
basicLayout = Tall nmaster delta ratio where
nmaster = 1
delta = 3/100
ratio = 1/2
tallLayout = named "tall" $ avoidStruts $ basicLayout
wideLayout = named "wide" $ avoidStruts $ Mirror basicLayout
singleLayout = named "single" $ avoidStruts $ noBorders Full
circleLayout = named "circle" $ Circle
twoPaneLayout = named "two pane" $ TwoPane (2/100) (1/2)
mosaicLayout = named "mosaic" $ MosaicAlt M.empty
gridLayout = named "grid" $ Grid
spiralLayout = named "spiral" $ spiral (1 % 1)
myLayouts = tallLayout ||| wideLayout ||| singleLayout ||| circleLayout
||| mosaicLayout ||| gridLayout ||| spiralLayout
{-
mySDConfig = def { inactiveBorderColor = "gray"
, inactiveTextColor = "grey"}
myLayouts = Circle ||| mosaic 2 [3,2] ||| noBorders Full ||| dwmStyle shrinkText mySDConfig (tiled ||| Mirror tiled) ||| (noBorders simpleTabbed) ||| Accordion
where
tiled = Tall nmaster delta ratio
nmaster = 1
ratio = 2/3
delta = 3/100
-}
myManageHook = composeAll
[ className =? "MPlayer" --> doFloat
, className =? "feh" --> doFloat
, className =? "TelegramDesktop" --> doFloat -- >> moveTo imWorkspace
, className =? "Slack" --> moveTo imWorkspace
, className =? "Skype" --> moveTo imWorkspace
, className =? "Firefox" --> moveTo webWorkspace
, className =? "Google-chrome" --> moveTo webWorkspace
, className =? "Emacs" --> moveTo devWorkspace
, className =? "jetbrains-phpstorm" --> moveTo devWorkspace
, className =? "vscode" --> moveTo devWorkspace
, className =? "XClock" --> doIgnore
--, className =? "Emacs" --> (ask >>= doF . \w -> (\ws -> foldr ($) ws (copyToWss ["2:web","4:dev"] w) ) . W.shift "3:im" ) :: ManageHook
]
where moveTo = doF . liftM2 (.) W.greedyView W.shift
-- copyToWss ids win = map (copyWindow win) ids
myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList
[ ((modm, xK_F12), xmonadPrompt def)
, ((modm, xK_F2 ), shellPrompt def)
, ((modm, xK_Tab ), rotAllUp)
, ((modm .|. shiftMask, xK_Tab ), rotAllDown)
]