Recent Posts
SQL | 0 sec ago
None | 1 sec ago
None | 24 sec ago
Java | 32 sec ago
C++ | 38 sec ago
PHP | 49 sec ago
Email | 49 sec ago
None | 52 sec ago
None | 1 min ago
C++ | 1 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
Learn a little bit about the new Pastebin.com on our help page. hide message
By ethan on the 5th of Jul 2009 07:25:43 AM Download | Raw | Embed | Report
  1. import XMonad
  2. import XMonad.Config.Gnome
  3. import XMonad.Layout.ResizableTile
  4. import XMonad.Hooks.ManageDocks
  5. import XMonad.Hooks.EwmhDesktops
  6.  
  7. import qualified XMonad.StackSet as W
  8. import qualified Data.Map        as M
  9.  
  10. myLogHook :: X ()
  11. myLogHook = ewmhDesktopsLogHook
  12.  
  13. myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
  14.  
  15.     -- launch a terminal
  16.     [ ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
  17.  
  18.     -- launch dmenu
  19.     , ((modm,               xK_p     ), gnomeRun)
  20.  
  21.     -- close focused window
  22.     , ((modm .|. shiftMask, xK_q     ), kill)
  23.  
  24.      -- Rotate through the available layout algorithms
  25.     , ((modm,               xK_space ), sendMessage NextLayout)
  26.  
  27.     --  Reset the layouts on the current workspace to default
  28.     , ((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
  29.  
  30.     -- Resize viewed windows to the correct size
  31.     --, ((modm,               xK_n     ), refresh)
  32.  
  33.     -- Move focus to the next window
  34.     --, ((modm,               xK_Tab   ), windows W.focusDown)
  35.  
  36.     -- Move focus to the previous window
  37.     , ((modm,               xK_Tab     ), windows W.focusUp  )
  38.  
  39.     -- Move focus to the master window
  40.     , ((modm,               xK_m     ), windows W.focusMaster  )                                                                                                                                      
  41.  
  42.     -- Swap the focused window and the master window                                                                                                                                                  
  43.     , ((modm,               xK_Return), windows W.swapMaster)                                                                                                                                          
  44.  
  45.     -- Swap the focused window with the next window                                                                                                                                                    
  46.     , ((modm .|. shiftMask, xK_j     ), windows W.swapDown  )                                                                                                                                          
  47.  
  48.     -- Swap the focused window with the previous window                                                                                                                                                
  49.     , ((modm .|. shiftMask, xK_k     ), windows W.swapUp    )                                                                                                                                          
  50.  
  51.     -- Shrink the master area                                                                                                                                                                          
  52.     , ((modm,               xK_e     ), sendMessage Shrink)                                                                                                                                            
  53.  
  54.     -- Expand the master area                                                                                                                                                                          
  55.     , ((modm,               xK_n     ), sendMessage Expand)                                                                                                                                            
  56.  
  57.     -- Push window back into tiling                                                                                                                                                                    
  58.     , ((modm,               xK_t     ), withFocused $ windows . W.sink)                                                                                                                                
  59.  
  60.     -- Increment the number of windows in the master area                                                                                                                                              
  61.     , ((modm              , xK_comma ), sendMessage (IncMasterN 1))                                                                                                                                    
  62.  
  63.     -- Deincrement the number of windows in the master area                                                                                                                                            
  64.     , ((modm              , xK_period), sendMessage (IncMasterN (-1)))                                                                                                                                
  65.  
  66.     -- toggle the status bar gap                                                                                                                                                                      
  67.     -- TODO, update this binding with avoidStruts , ((modm , xK_b ), sendMessage ToggleStruts)                                                                                                        
  68.  
  69.     -- Quit xmonad                                                                                                                                                                                    
  70.     , ((modm .|. shiftMask, xK_q), spawn "gnome-session-save --kill")                                                                                                                                  
  71.  
  72.     -- Restart xmonad                                                                                                                                                                                  
  73.     , ((modm              , xK_r     ), restart "xmonad" True)                                                                                                                                        
  74.  
  75.     -- Added for the ResizableTile layouts                                                                                                                                                            
  76.     , ((modm            , xK_o     ), sendMessage MirrorShrink)                                                                                                                                      
  77.     , ((modm            , xK_i     ), sendMessage MirrorExpand)                                                                                                                                      
  78.  
  79.     -- To kill Firefox
  80.     , ((modm              , xK_6     ), spawn "kill -9 firefox")
  81.     ]
  82.     ++                                                                                                                                                                                                
  83.  
  84.     --                                                                                                                                                                                                
  85.        --   , mod-[1..3], Switch to workspace N
  86.        --   , mod-shift-[1..3], Move client to workspace N
  87.    
  88.     [((m .|. modm, k), windows $ f i)
  89.         | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_3]
  90.         , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
  91.  
  92.     --
  93.     -- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3
  94.     -- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3
  95.     --
  96. --    [((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
  97. --        | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
  98. --        , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
  99.  
  100.  
  101. myLayouts = ewmhDesktopsLayout $ avoidStruts $ tiled' ||| Mirror tiled' ||| Full
  102.   where
  103.       -- The default number of windows in the master pane
  104.       nmaster  = 1
  105.       -- Default proportion of screen occupied by master pane
  106.       ratio    = 1/2
  107.       -- Percent of screen to increment by when resizing panes
  108.       delta    = 3/100
  109.       -- Shorthand for ResizableTall
  110.       tiled'   = ResizableTall nmaster delta ratio []
  111.  
  112.  
  113. main = do xmonad $ gnomeConfig
  114.             { modMask = mod4Mask
  115.             , borderWidth = 0
  116.             , XMonad.workspaces = map show [1..3]
  117.             , focusFollowsMouse = True
  118.             , keys = myKeys
  119.             , logHook = myLogHook
  120.             , layoutHook = myLayouts
  121.             }
Submit a correction or amendment below. Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: