Personal tools

Xmonad/Config archive/Gwern's xmonad.hs

From HaskellWiki

< Xmonad | Config archive(Difference between revisions)
Jump to: navigation, search
(Xmonad/Config archive/Gwern's Config.hs moved to Xmonad/Config archive/Gwern's Config.hs (0.4): outdated)
 
(upload .5 version)
Line 1: Line 1:
#redirect [[Xmonad/Config archive/Gwern's Config.hs (0.4)]]
+
<haskell>
  +
import XMonad (XConfig(layoutHook, keys, modMask, focusedBorderColor,
  +
normalBorderColor, terminal, defaultGaps, XConfig),
  +
Layout(..))
  +
import XMonad.StackSet as W (W.focusUp, W.focusDown)
  +
import Graphics.X11
  +
import XMonad.Config (defaultConfig)
  +
import XMonad.Core (xmonad)
  +
import XMonad.Layouts (Full(..), Mirror(..), Tall(..), (|||))
  +
import XMonad.Operations (kill, windows, sendMessage)
  +
import XMonad.Layout.NoBorders (smartBorders)
  +
import XMonad.Layout.Tabbed (tabbed, defaultTConf, shrinkText)
  +
import XMonad.Layout.WindowNavigation (Navigate(Go), Direction(..))
  +
import XMonad.Prompt (XPPosition(Top),
  +
XPConfig(historySize, height, position, promptBorderWidth, fgColor, bgColor, font),
  +
defaultXPConfig)
  +
import XMonad.Prompt.Shell (shellPrompt, prompt, safePrompt)
  +
import XMonad.Util.Run (safeSpawn, unsafeSpawn, runInTerm)
  +
import XMonad.Util.XSelection (safePromptSelection)
  +
import Data.Map as M (M.fromList, M.union)
  +
import Data.Bits (Bits((.|.)))
  +
  +
main :: IO ()
  +
main = xmonad $ gwernConfig
  +
  +
gwernConfig :: XConfig
  +
gwernConfig = defaultConfig
  +
{ defaultGaps = [(0,0,0,0)]
  +
, terminal = "urxvtc"
  +
, normalBorderColor = "#dddddd"
  +
, focusedBorderColor = "#ff0000"
  +
, modMask = mod4Mask
  +
, keys = \c -> mykeys c `M.union` keys defaultConfig c
  +
, layoutHook = Layout (smartBorders (tiled ||| Mirror tiled ||| Full ||| tabbed shrinkText defaultTConf)) }
  +
where
  +
tiled = Tall 1 0.03 0.5
  +
  +
greenXPConfig :: XPConfig
  +
greenXPConfig = defaultXPConfig { font = "9x15bold,xft:Bitstream Vera Sans Mono"
  +
, bgColor = "black"
  +
, fgColor = "green"
  +
, promptBorderWidth = 0
  +
, position = Top
  +
, height = 16
  +
, historySize = 256 }
  +
  +
mykeys (XConfig {modMask = modm}) = M.fromList $
  +
[ ((modm .|. shiftMask, xK_p ), shellPrompt greenXPConfig)
  +
, ((modm, xK_k ), kill ) -- %! Move focus to the previous WindowSet
  +
, ((modm, xK_n ), windows W.focusUp)
  +
, ((modm, xK_p ), windows W.focusDown)
  +
  +
, ((modm .|. shiftMask, xK_b ), safePromptSelection "firefox")
  +
, ((modm .|. shiftMask, xK_c ), prompt ((terminal gwernConfig) ++ " -e") greenXPConfig)
  +
, ((modm .|. shiftMask, xK_d ), runInTerm "elinks")
  +
, ((modm .|. shiftMask, xK_e ), prompt "emacsclient -a emacs" greenXPConfig)
  +
, ((modm .|. shiftMask, xK_g ), safePromptSelection "google")
  +
, ((modm .|. shiftMask, xK_t ), safePromptSelection "wikipedia")
  +
, ((modm .|. shiftMask, xK_y ), safePromptSelection "wayback")
  +
, ((modm, xK_Print ), unsafeSpawn "import -quality 90 -window root png:$HOME/xwd-$(date +%s)$$.png")
  +
, ((modm, xK_b ), safePrompt "firefox" greenXPConfig)
  +
, ((modm, xK_c ), unsafeSpawn (terminal gwernConfig))
  +
, ((modm, xK_d ), safeSpawn "firefox" "")
  +
, ((modm, xK_e ), unsafeSpawn "emacs")
  +
, ((modm, xK_g ), safePrompt "google" greenXPConfig)
  +
, ((modm, xK_t ), safePrompt "wikipedia" greenXPConfig)
  +
, ((modm, xK_y ), safePrompt "wayback" greenXPConfig)
  +
, ((modm, xK_i ), runInTerm "sh -c 'screen -r irssi'")
  +
, ((modm, xK_m ), runInTerm "sh -c 'mutt'")
  +
, ((modm, xK_r ), runInTerm "sh -c 'screen -r rtorrent'")
  +
  +
-- Extension-provided key bindings
  +
, ((modm, xK_Right), sendMessage $ Go R)
  +
, ((modm, xK_Left), sendMessage $ Go L)
  +
, ((modm, xK_Up), sendMessage $ Go U)
  +
, ((modm, xK_Down), sendMessage $ Go D)
  +
]
  +
</haskell>
  +
[[Category: XMonad configuration]]

Revision as of 22:57, 6 November 2007

import XMonad (XConfig(layoutHook, keys, modMask, focusedBorderColor,
                      normalBorderColor, terminal, defaultGaps, XConfig),
              Layout(..))
import XMonad.StackSet as W (W.focusUp, W.focusDown)
import Graphics.X11
import XMonad.Config (defaultConfig)
import XMonad.Core (xmonad)
import XMonad.Layouts (Full(..), Mirror(..), Tall(..), (|||))
import XMonad.Operations (kill, windows, sendMessage)
import XMonad.Layout.NoBorders (smartBorders)
import XMonad.Layout.Tabbed (tabbed, defaultTConf, shrinkText)
import XMonad.Layout.WindowNavigation (Navigate(Go), Direction(..))
import XMonad.Prompt (XPPosition(Top),
                     XPConfig(historySize, height, position, promptBorderWidth, fgColor, bgColor, font),
                     defaultXPConfig)
import XMonad.Prompt.Shell (shellPrompt, prompt, safePrompt)
import XMonad.Util.Run (safeSpawn, unsafeSpawn, runInTerm)
import XMonad.Util.XSelection (safePromptSelection)
import Data.Map as M (M.fromList, M.union)
import Data.Bits (Bits((.|.)))
 
main :: IO ()
main = xmonad $ gwernConfig
 
gwernConfig :: XConfig
gwernConfig = defaultConfig
        { defaultGaps = [(0,0,0,0)]
        , terminal = "urxvtc"
        , normalBorderColor  = "#dddddd"
        , focusedBorderColor = "#ff0000"
        , modMask = mod4Mask
        , keys = \c -> mykeys c `M.union` keys defaultConfig c
        , layoutHook = Layout (smartBorders (tiled ||| Mirror tiled ||| Full ||| tabbed shrinkText defaultTConf)) }
 where
    tiled   = Tall 1 0.03 0.5
 
    greenXPConfig :: XPConfig
    greenXPConfig = defaultXPConfig { font        = "9x15bold,xft:Bitstream Vera Sans Mono"
                                    , bgColor     = "black"
                                    , fgColor     = "green"
                                    , promptBorderWidth = 0
                                    , position    = Top
                                    , height      = 16
                                    , historySize = 256 }
 
    mykeys (XConfig {modMask = modm}) = M.fromList $
                                        [ ((modm .|. shiftMask, xK_p     ), shellPrompt greenXPConfig)
                                        , ((modm,               xK_k     ), kill  ) -- %! Move focus to the previous WindowSet
                                        , ((modm,               xK_n     ), windows W.focusUp)
                                        , ((modm,               xK_p     ), windows W.focusDown)
 
                                        , ((modm .|. shiftMask, xK_b     ), safePromptSelection "firefox")
                                        , ((modm .|. shiftMask, xK_c     ), prompt ((terminal gwernConfig) ++ " -e") greenXPConfig)
                                        , ((modm .|. shiftMask, xK_d     ), runInTerm "elinks")
                                        , ((modm .|. shiftMask, xK_e     ), prompt "emacsclient -a emacs" greenXPConfig)
                                        , ((modm .|. shiftMask, xK_g     ), safePromptSelection "google")
                                        , ((modm .|. shiftMask, xK_t     ), safePromptSelection "wikipedia")
                                        , ((modm .|. shiftMask, xK_y     ), safePromptSelection "wayback")
                                        , ((modm,               xK_Print ), unsafeSpawn "import -quality 90 -window root png:$HOME/xwd-$(date +%s)$$.png")
                                        , ((modm,               xK_b     ), safePrompt "firefox" greenXPConfig)
                                        , ((modm,               xK_c     ), unsafeSpawn (terminal gwernConfig))
                                        , ((modm,               xK_d     ), safeSpawn "firefox" "")
                                        , ((modm,               xK_e     ), unsafeSpawn  "emacs")
                                        , ((modm,               xK_g     ), safePrompt "google" greenXPConfig)
                                        , ((modm,               xK_t     ), safePrompt "wikipedia" greenXPConfig)
                                        , ((modm,               xK_y     ), safePrompt "wayback" greenXPConfig)
                                        , ((modm, xK_i                   ), runInTerm "sh -c 'screen -r irssi'")
                                        , ((modm, xK_m                   ), runInTerm  "sh -c 'mutt'")
                                        , ((modm, xK_r                   ), runInTerm "sh -c 'screen -r rtorrent'")
 
                                        -- Extension-provided key bindings
                                        , ((modm, xK_Right), sendMessage $ Go R)
                                        , ((modm, xK_Left), sendMessage $ Go L)
                                        , ((modm, xK_Up), sendMessage $ Go U)
                                        , ((modm, xK_Down), sendMessage $ Go D)
                                        ]