github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

anderstornvig / config-files

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 2
    • 0
  • Source
  • Commits
  • Network (0)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Tree: c478113

click here to add a description

click here to add a homepage

  • Branches (1)
    • master
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Various config files primarily for Linux stuff — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Added ALSA keyboard control 
anderstornvig (author)
Fri May 15 14:47:39 -0700 2009
commit  c478113553a8d6d3ec9577d6cdc83cdaa68af358
tree    6e7f527e1caa2fb7b443fb09e68cce3026bbc80d
parent  3b7b501f8dd12f79a4312d2035cefb2d7c2d34e1
config-files / .xmonad / xmonad.hs .xmonad/xmonad.hs
100644 243 lines (196 sloc) 9.07 kb
edit raw blame history
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
{- xmonad.hs
- Author: Øyvind 'Mr.Elendig' Heggstad <mrelendig AT har-ikkje DOT net>
- Modified by: Anders Tornvig <anderstornvig AT gmail DOT com>
- Version: 0.0.9
-}
 
-------------------------------------------------------------------------------
-- Imports --
-- stuff
import XMonad
import qualified XMonad.StackSet as W
import qualified Data.Map as M
import System.Exit
import Graphics.X11.Xlib
import IO (Handle, hPutStrLn)
 
-- utils
import XMonad.Util.Run (spawnPipe, safeSpawn)
import XMonad.Util.NamedWindows (getName)
 
-- hooks
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.DynamicLog
 
-- layouts
import XMonad.Layout.NoBorders
import XMonad.Layout.ResizableTile
import XMonad.Layout.Spiral
 
-- prompt
import XMonad.Prompt
import XMonad.Prompt.RunOrRaise
import XMonad.Prompt.Shell
import XMonad.Prompt.Ssh
import XMonad.Prompt.Workspace
 
-- float actions
import XMonad.Actions.FloatKeys
 
-- notifications
import XMonad.Hooks.UrgencyHook
 
 
-------------------------------------------------------------------------------
-- Main --
main = do
       h <- spawnPipe "xmobar"
       xmonad $ withUrgencyHook LibNotifyUrgencyHook defaultConfig
              { workspaces = workspaces'
              , modMask = modMask'
              , borderWidth = borderWidth'
              , normalBorderColor = normalBorderColor'
              , focusedBorderColor = focusedBorderColor'
              , terminal = terminal'
              , keys = keys'
              , logHook = logHook' h
              , layoutHook = layoutHook'
              , manageHook = manageHook'
              }
 
-------------------------------------------------------------------------------
-- Hooks --
manageHook' :: ManageHook
manageHook' = (doF W.swapDown) <+> manageHook defaultConfig <+> manageDocks
 
logHook' :: Handle -> X ()
logHook' h = dynamicLogWithPP $ customPP { ppOutput = hPutStrLn h }
 
layoutHook' = customLayout
 
 
data LibNotifyUrgencyHook = LibNotifyUrgencyHook deriving (Read, Show)
 
instance UrgencyHook LibNotifyUrgencyHook where
    urgencyHook LibNotifyUrgencyHook w = do
        name <- getName w
        ws <- gets windowset
        whenJust (W.findTag w ws) (flash name)
        where flash name index = safeSpawn "notify-send" (show name ++ " requests your attention on workspace " ++ index)
 
 
-------------------------------------------------------------------------------
-- Looks --
-- bar
customPP :: PP
customPP = defaultPP { ppCurrent = xmobarColor "#AFAF87" "" . wrap "<" ">"
                     , ppTitle = shorten 80
                     , ppSep = "<fc=#AFAF87> | </fc>"
                     , ppHiddenNoWindows = xmobarColor "#AFAF87" ""
                     , ppUrgent = xmobarColor "#FFFFAF" "" . wrap "[" "]"
                     }
 
-- borders
borderWidth' :: Dimension
borderWidth' = 1
 
normalBorderColor', focusedBorderColor' :: String
normalBorderColor' = "#333333"
focusedBorderColor' = "#AFAF87"
 
-- workspaces
workspaces' :: [WorkspaceId]
workspaces' = ["1", "2", "3", "4", "5", "6", "7", "8", "9"]
 
-- layouts
customLayout = avoidStruts $ smartBorders tiled ||| smartBorders (Mirror tiled) ||| noBorders Full ||| spiral (6/7)
  where
    tiled = ResizableTall 1 (2/100) (1/2) []
 
-------------------------------------------------------------------------------
-- Terminal --
terminal' :: String
terminal' = "urxvt"
 
-------------------------------------------------------------------------------
-- Keys/Button bindings --
-- modmask
modMask' :: KeyMask
modMask' = mod4Mask
 
 
-- The prompt config
myXPConfig :: XPConfig
myXPConfig = defaultXPConfig
    { position = Bottom
        , promptBorderWidth = 0
        , font = "-*-terminus-*-*-*-*-10-*-*-*-*-*-*"
        , height = 14
        , bgColor = "#2A2733"
        , fgColor = "#AA9DCF"
        , bgHLight = "#6B6382"
        , fgHLight = "#4A4459"
}
 
 
-- keys
keys' :: XConfig Layout -> M.Map (KeyMask, KeySym) (X ())
keys' conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
    -- launching and killing programs
    [ ((modMask, xK_Return), spawn $ XMonad.terminal conf)
    , ((modMask, xK_p ), spawn "exe=`dmenu_path | dmenu` && eval \"exec $exe\"")
-- , ((modMask .|. shiftMask, xK_p ), spawn "gmrun")
    , ((modMask .|. shiftMask, xK_c ), kill)
    , ((modMask .|. shiftMask, xK_m ), spawn "claws-mail")
 
    -- layouts
    , ((modMask, xK_space ), sendMessage NextLayout)
    , ((modMask .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
    , ((modMask, xK_b ), sendMessage ToggleStruts)
 
    -- 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)
 
    -- swapping
    , ((modMask .|. shiftMask, xK_Return), windows W.swapMaster)
    , ((modMask .|. shiftMask, xK_j ), windows W.swapDown )
    , ((modMask .|. shiftMask, xK_k ), windows W.swapUp )
 
    -- 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)
 
    -- mpd controls
    , ((modMask .|. controlMask, xK_h ), spawn "mpc prev")
    , ((modMask .|. controlMask, xK_t ), spawn "mpc pause")
    , ((modMask .|. controlMask, xK_n ), spawn "mpc play")
    , ((modMask .|. controlMask, xK_s ), spawn "mpc next")
    , ((modMask .|. controlMask, xK_g ), spawn "mpc seek -2%")
    , ((modMask .|. controlMask, xK_c ), spawn "mpc volume -4")
    , ((modMask .|. controlMask, xK_r ), spawn "mpc volume +4")
    , ((modMask .|. controlMask, xK_l ), spawn "mpc seek +2%")
 
    -- Alsa keyboard control
    -- XF86AudioMute
    , ((0 , 0x1008ff12), spawn "amixer -q set PCM toggle")
    -- XF86AudioLowerVolume
    , ((0 , 0x1008ff11), spawn "amixer -q set PCM 2- unmute")
    -- XF86AudioRaiseVolume
    , ((0 , 0x1008ff13), spawn "amixer -q set PCM 2+ unmute")
 
    -- quit, or restart
    , ((modMask .|. shiftMask, xK_q ), io (exitWith ExitSuccess))
    , ((modMask , xK_q ), restart "xmonad" True)
 
    -- Prompts
    , ((modMask, xK_g ), runOrRaisePrompt myXPConfig)
    
 
    -- float
    , ((modMask, xK_Left), withFocused (keysMoveWindow (-20,0))) -- move float left
    , ((modMask, xK_Right), withFocused (keysMoveWindow (20,0))) -- move float right
    , ((modMask, xK_Up), withFocused (keysMoveWindow (0,-20))) -- move float up
    , ((modMask, xK_Down), withFocused (keysMoveWindow (0,20))) -- move float down
 
    , ((modMask .|. shiftMask, xK_Left), withFocused (keysResizeWindow (-20,0) (0,0))) --shrink float at right
    , ((modMask .|. shiftMask, xK_Right), withFocused (keysResizeWindow (20,0) (0,0))) --expand float at right
    , ((modMask .|. shiftMask, xK_Down), withFocused (keysResizeWindow (0,20) (0,0))) --expand float at bottom
    , ((modMask .|. shiftMask, xK_Up), withFocused (keysResizeWindow (0,-20) (0,0))) --shrink float at bottom
 
    , ((modMask .|. controlMask, xK_Left), withFocused (keysResizeWindow (20,0) (1,0))) --expand float at left
    , ((modMask .|. controlMask, xK_Right), withFocused (keysResizeWindow (-20,0) (1,0))) --shrink float at left
    , ((modMask .|. controlMask, xK_Up), withFocused (keysResizeWindow (0,20) (0,1))) --expand float at top
    , ((modMask .|. controlMask, xK_Down), withFocused (keysResizeWindow (0,-20) (0,1))) --shrink float at top
 
    
    ]
    ++
-- Propmpts here
    --[ --(modMask, runOrRaisePrompt myXPConfig)
    {-, ("M-p M-p", runOrRaisePrompt myXPConfig)
, ("M-p t", prompt ("urxvt -e") myXPConfig)
, ("M-p M-t", prompt ("urxvt -e") myXPConfig)
, ("M-p s", sshPrompt myXPConfig)
, ("M-p M-s", sshPrompt myXPConfig)
, ("M-p w", workspacePrompt myXPConfig (windows . W.view))
, ("M-p S-w", workspacePrompt myXPConfig (windows . W.shift))
, ("M-p M-w", workspacePrompt myXPConfig (windows . W.view))
, ("M-p M-S-w", workspacePrompt myXPConfig (windows . W.shift))-}
    --]
 
    -- 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)]]
 
-------------------------------------------------------------------------------
 
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server