xmonad.patch
changeset 38 e56829be0d34
equal deleted inserted replaced
37:8435b9bef8e6 38:e56829be0d34
       
     1 xmonad
       
     2 
       
     3 diff --git a/source/custom-x11/xmonad/FrugalBuild b/source/custom-x11/xmonad/FrugalBuild
       
     4 new file mode 100644
       
     5 index 0000000..a109bfe
       
     6 --- /dev/null
       
     7 +++ b/source/custom-x11/xmonad/FrugalBuild
       
     8 @@ -0,0 +1,36 @@
       
     9 +pkgname=xmonad
       
    10 +pkgver=0.7
       
    11 +pkgrel=1
       
    12 +pkgdesc="A lightweight X11 tiled window manager written in Haskell"
       
    13 +arch=(i686 x86_64)
       
    14 +url="http://xmonad.org/"
       
    15 +license=('BSD')
       
    16 +depends=('ghc' 'gmp' 'libxinerama' 'haskell-x11')
       
    17 +install='xmonad.install'
       
    18 +source=(http://hackage.haskell.org/packages/archive/$pkgname/$pkgver/$pkgname-$pkgver.tar.gz)
       
    19 +up2date="lynx -nolist -dump '$url'|grep -A5 'stable release'|grep -m1 '$pkgname'|sed 's/.*$pkgname \([0-9.]*\) .*/\1/'"
       
    20 +archs=(i686)
       
    21 +sha1sums=('cf3fb7662c92cadb9ea7bfdc916bbe5cc587ac86')
       
    22 +
       
    23 +build() {
       
    24 +  Fcd
       
    25 +
       
    26 +  runhaskell Setup.lhs configure --ghc --prefix=/usr \
       
    27 +             --libsubdir=\$compiler/site-local/\$pkgid || return 1
       
    28 +
       
    29 +  runhaskell Setup.lhs build || return 1
       
    30 +
       
    31 +  runhaskell Setup.lhs register --gen-script
       
    32 +  runhaskell Setup.lhs unregister --gen-script
       
    33 +  
       
    34 +  install -D -m744 register.sh $Fdestdir/usr/share/haskell/$pkgname/register.sh
       
    35 +  install -m744 unregister.sh $Fdestdir/usr/share/haskell/$pkgname/unregister.sh
       
    36 +  runhaskell Setup.lhs copy --destdir=$Fdestdir
       
    37 +  runhaskell util/GenerateManpage.hs
       
    38 +
       
    39 +  install -D -m644 man/xmonad.1 $Fdestdir/usr/man/man1/xmonad.1
       
    40 +
       
    41 +  install -d -m755 $Fdestdir/usr/share/xmonad
       
    42 +  install -m644 $startdir/examples/README $Fdestdir/usr/share/xmonad/
       
    43 +  install -m644 $startdir/examples/*.hs $Fdestdir/usr/share/xmonad/
       
    44 +}
       
    45 diff --git a/source/custom-x11/xmonad/examples/README b/source/custom-x11/xmonad/examples/README
       
    46 new file mode 100644
       
    47 index 0000000..ba16abb
       
    48 --- /dev/null
       
    49 +++ b/source/custom-x11/xmonad/examples/README
       
    50 @@ -0,0 +1,2 @@
       
    51 +This directory contains examples for ~/xmonad/xmonad.hs
       
    52 +
       
    53 diff --git a/source/custom-x11/xmonad/examples/vegai.hs b/source/custom-x11/xmonad/examples/vegai.hs
       
    54 new file mode 100644
       
    55 index 0000000..abcbf37
       
    56 --- /dev/null
       
    57 +++ b/source/custom-x11/xmonad/examples/vegai.hs
       
    58 @@ -0,0 +1,119 @@
       
    59 +-- DynamicLog require xmonad-contrib
       
    60 +
       
    61 +import XMonad
       
    62 +import XMonad.Hooks.DynamicLog
       
    63 +
       
    64 +import qualified XMonad.StackSet as W
       
    65 +import qualified Data.Map as M
       
    66 +import System.Exit
       
    67 +import Graphics.X11.Xlib
       
    68 +
       
    69 +main = xmonad $ defaultConfig 
       
    70 +                { workspaces = workspaces',
       
    71 +                  modMask = modMask',
       
    72 +                  borderWidth = borderWidth',
       
    73 +                  normalBorderColor = normalBorderColor',
       
    74 +                  focusedBorderColor = focusedBorderColor',
       
    75 +                  defaultGaps = defaultGaps',
       
    76 +                  terminal = terminal',
       
    77 +                  keys = keys', 
       
    78 +                  logHook = logHook'
       
    79 +                }
       
    80 +
       
    81 +workspaces' :: [WorkspaceId]
       
    82 +workspaces' = ["1-code", "2-test", "3-misc", "4-web", "5-mail", "6", "7", "8", "9-irc"]
       
    83 +
       
    84 +modMask' :: KeyMask
       
    85 +modMask' = mod4Mask
       
    86 +
       
    87 +borderWidth' :: Dimension
       
    88 +borderWidth' = 0
       
    89 +
       
    90 +normalBorderColor', focusedBorderColor' :: String
       
    91 +normalBorderColor'  = "#000000"
       
    92 +focusedBorderColor' = "#0f0f0f"
       
    93 +
       
    94 +
       
    95 +defaultGaps' :: [(Int,Int,Int,Int)]
       
    96 +defaultGaps' = [(15,0,0,0), (15,0,0,0)] -- 15 for default dzen font
       
    97 +
       
    98 +logHook' :: X ()
       
    99 +logHook' = dynamicLogXinerama
       
   100 +
       
   101 +terminal' :: String
       
   102 +terminal' = "urxvt"
       
   103 +
       
   104 +
       
   105 +
       
   106 +keys' :: XConfig Layout -> M.Map (KeyMask, KeySym) (X ())
       
   107 +keys' conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
       
   108 +    -- launching and killing programs
       
   109 +    [ ((modMask .|. shiftMask, xK_t), spawn $ XMonad.terminal conf) -- %! Launch terminal
       
   110 +    , ((modMask,               xK_p     ), spawn "exe=`dmenu_path | dmenu` && eval \"exec $exe\"") -- %! Launch dmenu
       
   111 +    , ((modMask .|. shiftMask, xK_p     ), spawn "gmrun") -- %! Launch gmrun
       
   112 +    , ((modMask .|. shiftMask, xK_c     ), kill) -- %! Close the focused window
       
   113 +    , ((modMask .|. shiftMask, xK_e     ), spawn "xemacs")
       
   114 +    , ((modMask .|. shiftMask, xK_w     ), spawn "swiftweasel")
       
   115 +    , ((modMask .|. shiftMask, xK_m     ), spawn "claws-mail")
       
   116 +
       
   117 +
       
   118 +    , ((modMask,               xK_space ), sendMessage NextLayout) -- %! Rotate through the available layout algorithms
       
   119 +    , ((modMask .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf) -- %!  Reset the layouts on the current workspace to default
       
   120 +
       
   121 +    , ((modMask,               xK_n     ), refresh) -- %! Resize viewed windows to the correct size
       
   122 +
       
   123 +    -- move focus up or down the window stack
       
   124 +    , ((modMask,               xK_Tab   ), windows W.focusDown) -- %! Move focus to the next window
       
   125 +    , ((modMask,               xK_j     ), windows W.focusDown) -- %! Move focus to the next window
       
   126 +    , ((modMask,               xK_k     ), windows W.focusUp  ) -- %! Move focus to the previous window
       
   127 +    , ((modMask,               xK_m     ), windows W.focusMaster  ) -- %! Move focus to the master window
       
   128 +
       
   129 +    -- mpd controls
       
   130 +    , ((modMask .|. controlMask,  xK_h     ), spawn "mpc prev")
       
   131 +    , ((modMask .|. controlMask,  xK_t     ), spawn "mpc pause")
       
   132 +    , ((modMask .|. controlMask,  xK_n     ), spawn "mpc play")
       
   133 +    , ((modMask .|. controlMask,  xK_s     ), spawn "mpc next")
       
   134 +
       
   135 +    , ((modMask .|. controlMask,  xK_g     ), spawn "mpc seek -2%")
       
   136 +    , ((modMask .|. controlMask,  xK_c     ), spawn "mpc volume -4")
       
   137 +    , ((modMask .|. controlMask,  xK_r     ), spawn "mpc volume +4")
       
   138 +    , ((modMask .|. controlMask,  xK_l     ), spawn "mpc seek +2%")
       
   139 +
       
   140 +
       
   141 +    -- modifying the window order
       
   142 +    , ((modMask,               xK_Return), windows W.swapMaster) -- %! Swap the focused window and the master window
       
   143 +    , ((modMask .|. shiftMask, xK_j     ), windows W.swapDown  ) -- %! Swap the focused window with the next window
       
   144 +    , ((modMask .|. shiftMask, xK_k     ), windows W.swapUp    ) -- %! Swap the focused window with the previous window
       
   145 +
       
   146 +    -- resizing the master/slave ratio
       
   147 +    , ((modMask,               xK_h     ), sendMessage Shrink) -- %! Shrink the master area
       
   148 +    , ((modMask,               xK_l     ), sendMessage Expand) -- %! Expand the master area
       
   149 +
       
   150 +    -- floating layer support
       
   151 +    , ((modMask,               xK_t     ), withFocused $ windows . W.sink) -- %! Push window back into tiling
       
   152 +
       
   153 +    -- increase or decrease number of windows in the master area
       
   154 +    , ((modMask              , xK_comma ), sendMessage (IncMasterN 1)) -- %! Increment the number of windows in the master area
       
   155 +    , ((modMask              , xK_period), sendMessage (IncMasterN (-1))) -- %! Deincrement the number of windows in the master area
       
   156 +
       
   157 +    -- toggle the status bar gap
       
   158 +    , ((modMask              , xK_b     ), modifyGap (\i n -> let x = (XMonad.defaultGaps conf ++ repeat (0,0,0,0)) !! i in if n == x then (0,0,0,0) else x)) -- %! Toggle the status bar gap
       
   159 +
       
   160 +    -- quit, or restart
       
   161 +    , ((modMask .|. shiftMask, xK_q     ), io (exitWith ExitSuccess)) -- %! Quit xmonad
       
   162 +    , ((modMask              , xK_q     ), restart "xmonad" True) -- %! Restart xmonad
       
   163 +    ]
       
   164 +    ++
       
   165 +    -- mod-[1..9] %! Switch to workspace N
       
   166 +    -- mod-shift-[1..9] %! Move client to workspace N
       
   167 +    [((m .|. modMask, k), windows $ f i)
       
   168 +        | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
       
   169 +        , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
       
   170 +    ++
       
   171 +    -- mod-{a,o} %! Switch to physical/Xinerama screens 1, 2, or 3
       
   172 +    -- mod-shift-{a,o} %! Move client to screen 1, 2, or 3
       
   173 +    [((m .|. modMask, key), screenWorkspace sc >>= flip whenJust (windows . f))
       
   174 +        | (key, sc) <- zip [xK_a, xK_o] [0..]
       
   175 +        , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
       
   176 +
       
   177 +
       
   178 diff --git a/source/custom-x11/xmonad/xmonad.install b/source/custom-x11/xmonad/xmonad.install
       
   179 new file mode 100644
       
   180 index 0000000..ac322b0
       
   181 --- /dev/null
       
   182 +++ b/source/custom-x11/xmonad/xmonad.install
       
   183 @@ -0,0 +1,23 @@
       
   184 +HS_DIR=/usr/share/haskell/xmonad
       
   185 +
       
   186 +post_install() {
       
   187 +    ${HS_DIR}/register.sh
       
   188 +    echo "xmonad now has dynamic configuration via ~/.xmonad/xmonad.hs"
       
   189 +    echo "See http://haskell.org/haskellwiki/Xmonad/Config_archive for examples"	
       
   190 +}
       
   191 +
       
   192 +pre_upgrade() {
       
   193 +  ${HS_DIR}/unregister.sh
       
   194 +}
       
   195 +
       
   196 +post_upgrade() {
       
   197 +  ${HS_DIR}/register.sh
       
   198 +}
       
   199 +
       
   200 +pre_remove() {
       
   201 +  ${HS_DIR}/unregister.sh
       
   202 +}
       
   203 +op=$1
       
   204 +shift
       
   205 +
       
   206 +$op $*