Xmonad/Config archive/yiannist's xmonad.hs

From HaskellWiki
Jump to navigation Jump to search


An xmonad configuration file for XFCE integration.

It uses:


xmonad.hs:

--
-- File     : ~/.xmonad/xmonad.hs
-- Author   : Yiannis Tsiouris (yiannist)
-- Desc     : A clean and well-documented xmonad configuration file (based on
--            the $HOME/.cabal/share/xmonad-0.10.1/man/xmonad.hs template file).
--
--            It uses:
--              * a ScratchPad (for a hidden terminal),
--              * an IM layout for Pidgin,
--              * a layout prompt (with auto-complete).
--
import           XMonad                          hiding ((|||))
import           XMonad.Config.Xfce
import           XMonad.Hooks.EwmhDesktops
import           XMonad.Hooks.ManageDocks
import           XMonad.Hooks.UrgencyHook
import           XMonad.Layout.Accordion
import           XMonad.Layout.DecorationMadness
import           XMonad.Layout.Fullscreen
import           XMonad.Layout.Grid
import           XMonad.Layout.IM
import           XMonad.Layout.LayoutCombinators
import           XMonad.Layout.NoBorders
import           XMonad.Layout.PerWorkspace
import           XMonad.Layout.Renamed
import           XMonad.Layout.Tabbed
import           XMonad.Prompt
import           XMonad.Prompt.Input
import qualified XMonad.StackSet                 as W
import           XMonad.Util.EZConfig
import           XMonad.Util.Scratchpad

import           Data.Ratio                      ((%))

main :: IO ()
main = xmonad $ ewmh xfceConfig
    { terminal = "urxvt"
    , modMask = mod4Mask
    , borderWidth = 1
    , focusedBorderColor = "#0033ff"
    , layoutHook = myLayoutHook
    , manageHook = manageHook xfceConfig <+> myManageHook
    } `additionalKeys` myKeys
  where
      -- keybindings
      myKeys = [ ((mod4Mask,                 xK_b           ), spawn "iceweasel")
               , ((mod4Mask,                 xK_r           ), spawn "emacs")
               , ((mod4Mask,                 xK_f           ), spawn "thunar")
               , ((mod4Mask,                 xK_bracketleft ), spawn "pidgin")
               , ((mod4Mask,                 xK_u           ), scratchpad)
               , ((mod4Mask,                 xK_y           ), focusUrgent)
               , ((mod4Mask .|. controlMask, xK_space       ), myLayoutPrompt)
               ]
      scratchpad = scratchpadSpawnActionTerminal "urxvt"

      -- layouts
      myLayoutHook = avoidStrutsOn [U] $
                     smartBorders $
                     onWorkspace "8" imLayout $
                     tall ||| wide ||| full ||| circle ||| sTabbed ||| acc
      tall   = renamed [Replace "tall"] $ Tall 1 0.03 0.5
      wide   = renamed [Replace "wide"] $ Mirror tall
      full   = renamed [Replace "full"] $ Full
      circle = renamed [Replace "circle"] $ circleSimpleDefaultResizable
      sTabbed = renamed [Replace "tabbed"] $ simpleTabbed
      acc = renamed [Replace "accordion"] $ Accordion
      imLayout = withIM (1%7) pidginRoster Grid
      pidginRoster = ClassName "Pidgin" `And` Role "buddy_list"

      -- layout prompt (w/ auto-completion and all layouts)
      myLayoutPrompt = inputPromptWithCompl myXPConfig "Layout"
                       (mkComplFunFromList' allLayouts)
                       ?+ (sendMessage . JumpToLayout)
      myXPConfig = defaultXPConfig { autoComplete = Just 1000 }
      allLayouts = ["tall", "wide", "circle", "full", "tabbed", "accordion"]

      -- manageHook
      myManageHook =     manageDocks
                     <+> floatHook
                     <+> fullscreenManageHook
                     <+> scratchpadManageHookDefault
      -- Inspect with xprop: appName is the first element in WM_CLASS, while
      -- className is the second.
      floatHook = composeAll [ appName =? "gimp-2.8"    --> doFloat
                             , className =? "Iceweasel" --> doF (W.shift "1")
                             , appName =? "Pidgin"      --> doF (W.shift "8")
                             , appName =? "xfrun4"      --> doFloat
                             ]

xmobar:

Config {  font = "xft:DejaVu Sans-7:bold"
        , bgColor = "black"
        , fgColor = "grey"
        , position = TopW L 94
        , lowerOnStart = True
        , commands = [ 
              Run Weather "LGAV" ["-t"," <tempC>C","-L","10","-H","30",
                "--normal","blue","--high","red","--low","lightblue"] 36000
            , Run Network "wlan0" ["-t","<dev>: [<rx>/<tx>]"] 10
            , Run Cpu ["-t","Cpu: <total>","-L","3","-H","50","--normal",
                "green","--high","red"] 10
            , Run CpuFreq ["-t","Freq: <cpu0>/<cpu1> GHz","-L","0","-H","2"
                ,"-l","lightblue","-n","white","-h","red"] 10
            , Run Memory ["-t","Mem: <usedratio>%"] 10
            , Run Date "%a %b %_d %l:%M" "date" 10
            , Run StdinReader
            , Run Com "dcop" ["kxkb", "kxkb", "getCurrentLayout"] "kbd" 20
        ]
        , sepChar = "%"
        , alignSep = "}{"
        , template = "<fc=#ff66ff>%date%</fc> %LGAV% } %StdinReader% { %wlan0% | %cpu% | %memory%" 
}

.xinitrc:

#!/bin/bash

#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)
#

# Manage environment look
xsetroot -cursor_name left_ptr
xset b 100 0 0
#Best viewed with >>>Xmobar[94%]<<
trayer --edge top --align right --SetDockType true --width 6 \
--transparent true --height 13 --SetPartialStrut true --tint 000000 & 
#feh --bg-scale /home/yiannis/pictures/GT1680x1050.jpg 

# Pre-spawn some apps:
urxvtd -q -f -o
eval `ssh-agent`
xcompmgr -c &

#Ready to GO!
exec  xmonad