You are not logged in.

#1 2010-04-10 09:55:04

serrghi
Member
From: Bergen, NO
Registered: 2008-02-12
Posts: 100
Website

Share your xmonad desktop!

Please share all your xmonad related configs, and also please provide a screenshot of your setup.

(xmonad.hs, dzen config, running background apps like stalonetray etc, conkyrc, xmobar, autostartupscript if you have one, and any iconpacks you're using with xmobar/dzen/conky)

Last edited by serrghi (2010-04-10 09:55:53)


Unyttig.INFO - Your source to not so useless information
My github - Various configs, dotfiles and nifty scripts

Offline

#2 2010-04-10 10:17:36

serrghi
Member
From: Bergen, NO
Registered: 2008-02-12
Posts: 100
Website

Re: Share your xmonad desktop!

My current setup, conky on the bottom dzen bar isnt finished yet, as i started a new config just the other day. The rest of the xmonad setup is currently very slim, because i ditched my old configs and started out from scratch again just for fun and I havent had time to complete my setup as of yet. But its very usable as is. The icons are Rob's and sm4tik's icons from http://dzen.geekmode.org/dwiki/doku.php … icon-packs

screenshot2010041014010.th.png screenshot2010041014012.th.png

-- ~/.xmonad/xmonad.hs
-- Imports {{{
import XMonad
-- Prompt
import XMonad.Prompt
import XMonad.Prompt.RunOrRaise (runOrRaisePrompt)
import XMonad.Prompt.AppendFile (appendFilePrompt)
-- Hooks
import XMonad.Operations

import System.IO
import System.Exit

import XMonad.Util.Run


import XMonad.Actions.CycleWS

import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.SetWMName
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.UrgencyHook
import XMonad.Hooks.FadeInactive
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.SetWMName

import XMonad.Layout.NoBorders (smartBorders, noBorders)
import XMonad.Layout.PerWorkspace (onWorkspace)
import XMonad.Layout.Reflect (reflectHoriz)
import XMonad.Layout.IM
import XMonad.Layout.SimpleFloat
import XMonad.Layout.Spacing
import XMonad.Layout.ResizableTile
import XMonad.Layout.NoBorders
import XMonad.Layout.Gaps

import qualified XMonad.StackSet as W
import qualified Data.Map as M

--}}}

-- Config {{{
-- Define Terminal
myTerminal      = "urxvt"
-- Define modMask
modMask' :: KeyMask
modMask' = mod4Mask
-- Define workspaces
myWorkspaces    = ["1:main","2:irc","3:web","4:dev","5:foo()","6:wine"]
-- Dzen config
myStatusBar = "dzen2 -x '0' -y '0' -h '24' -w '1280' -ta 'l' -fg '#FFFFFF' -bg '#161616' -fn '-*-bitstream vera sans-medium-r-normal-*-11-*-*-*-*-*-*-*'"
myBtmStatusBar = "conky -c /home/serrghi/.conky_bottom_dzen | dzen2 -x '0' -w '1280' -h '24' -ta 'c' -bg '#161616' -fg '#FFFFFF' -fn '-*-bitstream vera sans-medium-r-normal-*-11-*-*-*-*-*-*-*' -y '776'"
myBitmapsDir = "/home/serrghi/.xmonad/dzen"
--}}}
-- Main {{{
main = do
    dzenTopBar <- spawnPipe myStatusBar
    dzenBtmBar <- spawnPipe myBtmStatusBar
    spawn "sh /home/serrghi/.xmonad/autostart.sh"
    xmonad $ defaultConfig
      { terminal            = myTerminal
      , workspaces          = myWorkspaces
      , keys                = keys'
      , modMask             = modMask'
      , startupHook         = ewmhDesktopsStartup >> setWMName "LG3D"
      , layoutHook          = layoutHook'
      , manageHook          = manageHook'
      , logHook             = myLogHook dzenTopBar >> fadeInactiveLogHook 0xdddddddd  >> setWMName "LG3D"
      , normalBorderColor   = colorNormalBorder
      , focusedBorderColor  = colorFocusedBorder
}
--}}}


-- Hooks {{{
-- ManageHook {{{
manageHook' :: ManageHook
manageHook' = (composeAll . concat $
    [ [resource     =? r            --> doIgnore            |   r   <- myIgnores] -- ignore desktop
    , [className    =? c            --> doShift  "3:web"    |   c   <- myWebs   ] -- move webs to webs
    , [className    =? c            --> doShift  "4:dev"    |   c   <- myDevs   ] -- move devs to devs
    , [className    =? c            --> doF(W.shift "6:wine")   |   c   <- myWines  ] -- move wines to wine
    , [className    =? c            --> doCenterFloat       |   c   <- myFloats ] -- float my floats
    , [name         =? n            --> doCenterFloat       |   n   <- myNames  ] -- float my names
    , [isFullscreen                 --> myDoFullFloat                           ]
    ]) 

    where

        role      = stringProperty "WM_WINDOW_ROLE"
        name      = stringProperty "WM_NAME"

        -- classnames
        myFloats  = ["MPlayer","Zenity","VirtualBox","Xmessage","Save As...","XFontSel","Downloads","Nm-connection-editor"]
        myWebs    = ["Navigator","Shiretoko","Firefox","Uzbl","uzbl","Uzbl-core","uzbl-core","Google-chrome","Chromium","Shredder","Mail"]
        myDevs    = ["Eclipse","eclipse","Netbeans","Gvim"]
        myWines   = ["Wine"]

        -- resources
        myIgnores = ["desktop","desktop_window","notify-osd","stalonetray","trayer"]

        -- names
        myNames   = ["bashrun","Google Chrome Options","Chromium Options"]

-- a trick for fullscreen but stil allow focusing of other WSs
myDoFullFloat :: ManageHook
myDoFullFloat = doF W.focusDown <+> doFullFloat
-- }}}
layoutHook' = customLayout

-- Bar
myLogHook :: Handle -> X ()
myLogHook h = dynamicLogWithPP $ defaultPP
    {
        ppCurrent           =   dzenColor "#ebac54" "#161616" . pad
      , ppVisible           =   dzenColor "white" "#161616" . pad
      , ppHidden            =   dzenColor "white" "#161616" . pad
      , ppHiddenNoWindows   =   dzenColor "#444444" "#161616" . pad
      , ppUrgent            =   dzenColor "red" "#161616" . pad
      , ppWsSep             =   " "
      , ppSep               =   "  |  "
      , ppLayout            =   dzenColor "#ebac54" "#161616" .
                                (\x -> case x of
                                    "ResizableTall"             ->      "^i(" ++ myBitmapsDir ++ "/tall.xbm)"
                                    "Mirror ResizableTall"      ->      "^i(" ++ myBitmapsDir ++ "/mtall.xbm)"
                                    "Full"                      ->      "^i(" ++ myBitmapsDir ++ "/full.xbm)"
                                    "Simple Float"              ->      "~"
                                    _                           ->      x
                                )
      , ppTitle             =   (" " ++) . dzenColor "white" "#161616" . dzenEscape
      , ppOutput            =   hPutStrLn h
    }
-- Layout
customLayout = gaps [(D,16)] $ avoidStruts $ smartBorders tiled ||| smartBorders (Mirror tiled)  ||| noBorders Full ||| smartBorders simpleFloat
  where
    --tiled = ResizableTall 1 (2/100) (1/2) []
    tiled   = ResizableTall nmaster delta ratio []
    nmaster = 1   
    delta   = 2/100
    ratio   = 1/2
--}}}
-- Theme {{{
-- Color names are easier to remember:
colorOrange          = "#ff7701"
colorDarkGray        = "#171717"
colorPink            = "#e3008d"
colorGreen           = "#00aa4a"
colorBlue            = "#008dd5"
colorYellow          = "#fee100"
colorWhite           = "#cfbfad"
 
colorNormalBorder    = "#1c2636"
colorFocusedBorder   = "#ebac54"
barFont  = "terminus"
barXFont = "inconsolata:size=14"
xftFont = "xft: inconsolata-14"
--}}}

-- Prompt Config {{{
mXPConfig :: XPConfig
mXPConfig =
    defaultXPConfig { font                  = barFont
                    , bgColor               = colorDarkGray
                    , fgColor               = colorGreen
                    , bgHLight              = colorGreen
                    , fgHLight              = colorDarkGray
                    , promptBorderWidth     = 0
                    , height                = 14
                    , historyFilter         = deleteConsecutive
                    }
 
-- Run or Raise Menu
largeXPConfig :: XPConfig
largeXPConfig = mXPConfig
                { font = xftFont
                , height = 20
                }
-- }}}
-- Key mapping {{{
keys' :: XConfig Layout -> M.Map (KeyMask, KeySym) (X ())
keys' conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
    [ ((modMask,                    xK_p        ), runOrRaisePrompt largeXPConfig)
    , ((mod1Mask,                   xK_F2       ), spawn "gmrun")
    , ((0,                          xK_Print    ), spawn "screenshot scr")

    -- Programs
    , ((modMask,                    xK_r        ), spawn $ XMonad.terminal conf) -- spawn terminal
    , ((modMask,                    xK_f        ), spawn "google-chrome")
    , ((modMask,                    xK_t        ), spawn "thunderbird")
    , ((modMask,                    xK_e        ), spawn "pcmanfm")

    -- Media Keys
    , ((0,                          0x1008ff12  ), spawn "vol mute") -- XF86AudioMute
    , ((0,                          0x1008ff11  ), spawn "vol down") -- XF86AudioLowerVolume
    , ((0,                          0x1008ff13  ), spawn "vol up") -- XF86AudioRaiseVolume

    -- layouts
    , ((modMask,                    xK_space    ), sendMessage NextLayout)
    , ((modMask .|. shiftMask,      xK_space    ), setLayout $ XMonad.layoutHook conf) -- reset layout on current desktop to default
    , ((modMask,                    xK_b        ), sendMessage ToggleStruts)
    , ((mod1Mask,                   xK_Tab      ), windows W.focusDown) -- move focus to next window
    , ((mod1Mask,                   xK_F4       ), kill) -- kill selected window
    , ((modMask .|. shiftMask,      xK_j        ), windows W.swapDown) -- swap the focused window with the next window
    , ((modMask .|. shiftMask,      xK_k        ), windows W.swapUp)  -- swap the focused window with the previous window
    , ((modMask .|. shiftMask,      xK_t        ), withFocused $ windows . W.sink) -- Push window back into tiling

    -- workspaces
    , ((mod1Mask .|. controlMask,   xK_Right    ), nextWS)
    , ((mod1Mask .|. shiftMask,     xK_Right    ), shiftToNext)
    , ((mod1Mask .|. controlMask,   xK_Left     ), prevWS)
    , ((mod1Mask .|. shiftMask,     xK_Left     ), shiftToPrev)
    
    -- quit, or restart
    , ((modMask .|. shiftMask,      xK_q        ), io (exitWith ExitSuccess))
    , ((modMask              ,      xK_q        ), restart "xmonad" True)
    , ((modMask .|. shiftMask,      xK_r        ), spawn "killall conky dzen2 && xmonad --recompile && xmonad --restart")
    ]
    ++
    -- 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)]]

--}}}
-- vim:foldmethod=marker sw=4 sts=4 ts=4 tw=0 et ai nowrap
# ~/.xmonad/autostart.sh
#!/bin/sh

# Programs to launch at startup
xsetroot -cursor_name left_ptr
sh ~/.fehbg &

# Programs which will run after Xmonad has started
(sleep 2 && stalonetray) &
(sleep 2 && nm-applet) &
(sleep 2 && dropboxd) &
# ~/.conky_bottom_dzen
# Set to yes if you want Conky to be forked in the background
background no
out_to_console yes
# Update interval in seconds
update_interval 1
 
TEXT
^fg(\#ebac54)^i(/home/serrghi/.xmonad/dzen/arch_10x10.xbm) ^fg(\#FFFFFF)$kernel^fg(\#ebac54) ^i(/home/serrghi/.xmonad/dzen/pacman.xbm) ^fg(\#FFFFFF)up-to-date^fg(\#ebac54) ^i(/home/serrghi/.xmonad/dzen/cpu.xbm) ^fg(\#FFFFFF)${cpu}%^fg(\#ebac54) ${if_existing /proc/net/route wlan0}^i(/home/serrghi/.xmonad/dzen/wifi_01.xbm) ^fg(\#FFFFFF)${wireless_essid wlan0} ^fg(\#00aa4a)^i(/home/serrghi/.xmonad/dzen/net_down_03.xbm)${downspeedf wlan0} ^fg(\#ff3333)^i(/home/serrghi/.xmonad/dzen/net_up_03.xbm)${upspeedf wlan0}

Unyttig.INFO - Your source to not so useless information
My github - Various configs, dotfiles and nifty scripts

Offline

#3 2010-04-23 09:05:58

Shinryuu
Member
From: /dev/urandom
Registered: 2010-02-27
Posts: 339

Re: Share your xmonad desktop!

Thanks for making this thread big_smile I'm new to tiling managers so for a practice I might seek some help from your configuration files and modify them for my own needs to get closer with xmonad (also xmonad's documentations are pretty clean and easy to understand). I have used *box managers for a long time and I have manually tiled my stuff in the screen.. and tiling tools for doing that just are not for my taste. Overall your configuration looks nice and clean so keep going cool

I Hope I'll be posting my own configuration to this thread in the near future before it gets killed.

Offline

#4 2010-04-23 14:02:33

losl
Member
Registered: 2009-10-25
Posts: 25

Re: Share your xmonad desktop!

serrghi wrote:

My current setup, conky on the bottom dzen bar isnt finished yet, as i started a new config just the other day. The rest of the xmonad setup is currently very slim, because i ditched my old configs and started out from scratch again just for fun and I havent had time to complete my setup as of yet. But its very usable as is. The icons are Rob's and sm4tik's icons from http://dzen.geekmode.org/dwiki/doku.php … icon-packs...

Would you mind sharing your dzen config as well? I'd like a good setup to get my foot in the door on that, and yours looks like what I need.

Offline

#5 2010-04-23 14:34:15

Berticus
Member
Registered: 2008-06-11
Posts: 731

Re: Share your xmonad desktop!

I'm pretty sure there's already a thread like this floating around in the Desktop Environments sub-forum.

Offline

#6 2010-04-23 15:00:57

lifeafter2am
Member
From: 127.0.0.1
Registered: 2009-06-10
Posts: 1,332

Re: Share your xmonad desktop!

Berticus wrote:

I'm pretty sure there's already a thread like this floating around in the Desktop Environments sub-forum.

You mean the xmonad hacking thread?


#binarii @ irc.binarii.net
Matrix Server: https://matrix.binarii.net
-------------
Allan -> ArchBang is not supported because it is stupid.

Offline

#7 2010-04-23 18:06:31

serrghi
Member
From: Bergen, NO
Registered: 2008-02-12
Posts: 100
Website

Re: Share your xmonad desktop!

I dont feel it serves the same purpose. this is purely for showing off. please stay on topic smile


losl wrote:
serrghi wrote:

My current setup, conky on the bottom dzen bar isnt finished yet, as i started a new config just the other day. The rest of the xmonad setup is currently very slim, because i ditched my old configs and started out from scratch again just for fun and I havent had time to complete my setup as of yet. But its very usable as is. The icons are Rob's and sm4tik's icons from http://dzen.geekmode.org/dwiki/doku.php … icon-packs...

Would you mind sharing your dzen config as well? I'd like a good setup to get my foot in the door on that, and yours looks like what I need.

Take a look in my xmonad.hs its all there. its in the top of the config.

Last edited by serrghi (2010-04-23 18:08:43)


Unyttig.INFO - Your source to not so useless information
My github - Various configs, dotfiles and nifty scripts

Offline

#8 2010-04-24 14:35:31

jccl1706
Member
From: Cuba
Registered: 2010-03-11
Posts: 67

Re: Share your xmonad desktop!

you can share with me your Xdefaults
thanks


| archlinux | Xmonad | urxvt | vim |

Offline

#9 2010-04-24 15:37:10

serrghi
Member
From: Bergen, NO
Registered: 2008-02-12
Posts: 100
Website

Re: Share your xmonad desktop!

jccl1706 wrote:

you can share with me your Xdefaults
thanks

Xcursor.theme: whiteglass

! urxvt settings & colors

urxvt*background:          #242424
urxvt*cursorBlink:         true
urxvt*cursorColor:         #ebac34
urxvt*font:                xft:DejaVu Sans Mono:pixelsize=10
urxvt*boldFont:            xft:DejaVu Sans Mono:pixelsize=10
urxvt*transparent:       true
urxvt:borderLess:       true

urxvt*foreground:          white
urxvt*geometry:            120x25

! V
urxvt*inheritPixmap:       true
urxvt*internalBorder:      0
urxvt*saveLines:           4000
urxvt*scrollBar:           false
! V
urxvt*shading:             15
urxvt*termName:            rxvt
urxvt*fading:              20
! V
!urxvt*tintColor:          #ffffff
urxvt*underlineColor:      #86a2be
URxvt.perl-ext-common:     default,matcher
URxvt.matcher.button:      1
URxvt.matcher.pattern.1:   \bwww\.[\w-]\.[\w./?&@#-]*[\w/-]
URxvt*urlLauncher:         google-chrome
urxvt.perl-ext-common:     default,matcher

!black text
urxvt*color0:              #242424
urxvt*color8:              #cdb5cd

!red text
urxvt*color1:              #bf7979
!urxvt*color9:              #f4a45f
urxvt*color9:              #ebac54

!green text
urxvt*color2:              #97b26b
urxvt*color10:             #c5f779

!yellow text
urxvt*color3:              #cdcda1
urxvt*color11:             #ffffaf

!blue text
urxvt*color4:              #86a2be
urxvt*color12:             #98afd9

!magenta text
urxvt*color5:              #d9b798
urxvt*color13:             #d7d998

!cyan text
urxvt*color6:              #a1b5cd
urxvt*color14:             #a1b5cd

!white
urxvt*color7:              #ffffff
urxvt*color15:             #dedede

Unyttig.INFO - Your source to not so useless information
My github - Various configs, dotfiles and nifty scripts

Offline

#10 2010-04-24 21:37:28

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: Share your xmonad desktop!

Here's mine:
desktop_1004241736-thumb.png

and my xmonad.hs:

--
-- ~/.xmonad/xmonad.hs by pbrisbin
--
-- 3 april 2010 (minor formatting)
--
-- :: Versions I'm using
--  
--   ghc                        6.12.1-4
--   haskell-mtl                1.1.0.2-3
--   haskell-utf8-string        0.3.6-3
--   haskell-x11                1.5.0.0-1
--   haskell-x11-xft            0.3-12.1
--   xmonad-darcs               20100324-1
--   xmonad-contrib-darcs       20100324-1
--   dzen2-svn                  267-1
--
-- :: Functions you really should adjust
--
--     monitorWidth
--     myTerminal
--     conkyFile
--     myKeys
--
------

-- Imports {{{
import XMonad hiding ( (|||) )

import XMonad.Actions.CycleWS          (toggleWS)
import XMonad.Actions.UpdatePointer

import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.UrgencyHook

import XMonad.Layout.IM
import XMonad.Layout.LayoutCombinators (JumpToLayout)
import XMonad.Layout.LayoutHints       (layoutHintsWithPlacement)
import XMonad.Layout.LayoutCombinators
import XMonad.Layout.NoBorders
import XMonad.Layout.PerWorkspace      (onWorkspace)
import XMonad.Layout.ResizableTile

import XMonad.Util.EZConfig            (additionalKeysP)
import XMonad.Util.Loggers             (maildirNew,dzenColorL,wrapL)
import XMonad.Util.Run                 (spawnPipe)
import XMonad.Util.Scratchpad
import XMonad.Util.WindowProperties    (getProp32s)
import XMonad.Util.WorkspaceCompare    (getSortByXineramaRule)

import Data.List
import Data.Monoid
import Data.Ratio

import System.IO

import qualified Data.Map        as M
import qualified XMonad.StackSet as W

-- }}}

-- Main {{{
main = do
  d <- spawnPipe myLeftBar -- spawn the left statusbar
  spawn myRightBar         -- spawn the right statusbar
  spawn "conky"            -- spawn a standard conky

  -- and finally, start xmonad
  xmonad $ withUrgencyHook myUrgencyHook $ defaultConfig
    { terminal           = myTerminal
    , workspaces         = myWorkspaces
    , borderWidth        = myBorderWidth
    , normalBorderColor  = myNormalBorderColor
    , focusedBorderColor = myFocusedBorderColor
    , layoutHook         = myLayout
    , manageHook         = myManageHook
    , logHook            = myLogHook d
    } `additionalKeysP` myKeys

-- }}}

-- Theme {{{
--
-- adjust these variables, they are used throughout
--
myXFTFont    = "xft:Verdana-8"   -- see 'Status Bars' for the dzen font
conkyFile    = "~/.dzen_conkyrc" -- populates right status bar

-- GREYS
colorBG      = "#303030"         -- background
colorFG      = "#606060"         -- foreground
colorFG2     = "#909090"         -- foreground w/ emphasis
colorFG3     = "#c4df90"         -- foreground w/ strong emphasis
colorUrg     = "#cc896d"         -- urgent, peach
colorUrg2    = "#c4df90"         -- urgent, lime

barHeight    = 17
monitorWidth = 1920+1680          -- two statusbars will span this width 
leftBarWidth = 1920               -- right bar will span difference 

-- }}}

-- Options {{{
--
-- you should adjust the terminal
--
-- if you change workspace names, be sure to update them throughout
--
myTerminal           = "urxvtc"
myWorkspaces         = ["1-main","2-web","3-chat"] ++ map show [4..9]
myNormalBorderColor  = colorFG
myFocusedBorderColor = colorUrg
myBorderWidth        = 3

-- }}}

-- Layouts {{{
myLayout = avoidStruts $ onWorkspace "2-web"  webLayouts
                       $ onWorkspace "3-chat" imLayout
                       $ standardLayouts

  where
    
    standardLayouts = tiled ||| Mirror tiled ||| full
    webLayouts      = full ||| tiled ||| Mirror tiled

    -- im roster on left tenth, standardLayouts in other nine tenths
    imLayout        = withIM (1/10) imProp standardLayouts

    -- WMROLE = "roster" is Gajim.py's buddy list
    imProp          = Role "roster"

    tiled           = hinted (ResizableTall nmaster delta ratio [])
    full            = hinted (noBorders Full)

    -- like hintedTile but for any layout
    hinted l        = layoutHintsWithPlacement (0,0) l

    nmaster         = 1
    delta           = 3/100
    ratio           = toRational (2/(1 + sqrt 5 :: Double)) -- golden ratio

-- }}}

-- ManageHook {{{
myManageHook = (composeAll . concat $
  [ [resource  =? r                 --> doIgnore         |  r    <- myIgnores] -- ignore desktop
  , [className =? c                 --> doShift "2-web"  |  c    <- myWebs   ] -- move webs to web
  , [title     =? t                 --> doShift "3-chat" |  t    <- myChats  ] -- move chats to chat
  , [className =? c                 --> doShift "3-chat" | (c,_) <- myIMs    ] -- move chats to chat
  , [className =? c <&&> role /=? r --> doFloat          | (c,r) <- myIMs    ] -- float all ims but roster
  , [className =? c                 --> doFloat          |  c    <- myFloats ] -- float my floats
  , [className =? c                 --> doCenterFloat    |  c    <- myCFloats] -- float my floats
  , [name      =? n                 --> doFloat          |  n    <- myNames  ] -- float my names
  , [name      =? n                 --> doCenterFloat    |  n    <- myCNames ] -- float my names
  , [isFullscreen                   --> myDoFullFloat                        ]
  ]) <+> manageTypes <+> manageDocks <+> manageScratchPad

  where

    role      = stringProperty "WM_WINDOW_ROLE"
    name      = stringProperty "WM_NAME"

    -- [ ("class1","role1"), ("class2","role2"), ... ]
    myIMs     = [("Gajim.py","roster")]

    -- titles
    myChats   = ["irssi","mutt"]

    -- classnames
    myFloats  = ["MPlayer","Zenity","VirtualBox","rdesktop"]
    myCFloats = ["Xmessage","Save As...","XFontSel"]

    myWebs    = ["Navigator","Shiretoko","Firefox"]     ++
                ["Uzbl","uzbl","Uzbl-core","uzbl-core"] ++
                ["Google-chrome","Chromium"]

    -- resources
    myIgnores = ["desktop","desktop_window"]

    -- names
    myNames   = ["Google Chrome Options","Chromium Options"]
    myCNames  = ["bashrun"]

-- a trick for fullscreen but stil allow focusing of other WSs
myDoFullFloat :: ManageHook
myDoFullFloat = doF W.focusDown <+> doFullFloat

-- manage the scratchpad
manageScratchPad :: ManageHook
manageScratchPad = scratchpadManageHook (W.RationalRect l t w h)

  where

    h = 0.1     -- terminal height, 10%
    w = 1       -- terminal width, 100%
    t = 1 - h   -- distance from top edge, 90%
    l = 1 - w   -- distance from left edge, 0%

-- modified version of manageDocks
manageTypes :: ManageHook
manageTypes = checkType --> doCenterFloat

checkType :: Query Bool
checkType = ask >>= \w -> liftX $ do
  m   <- getAtom    "_NET_WM_WINDOW_TYPE_MENU"
  d   <- getAtom    "_NET_WM_WINDOW_TYPE_DIALOG"
  u   <- getAtom    "_NET_WM_WINDOW_TYPE_UTILITY"
  mbr <- getProp32s "_NET_WM_WINDOW_TYPE" w

  case mbr of
    Just [r] -> return $ elem (fromIntegral r) [m,d,u]
    _        -> return False

-- }}}

-- Status Bars {{{
--
-- build two dzen2 bars
--
-- for non-xft dzen, use something like this instead:
--  
--  myDzenFont = "-*-terminus-medium-*-*-*-12-*-*-*-*-*-*-*"
--
myDzenFont :: String
myDzenFont = drop 4 myXFTFont -- drop the 'xft:' part

makeDzen :: Int -> Int -> Int -> Int -> String -> String
makeDzen x y w h a = "dzen2 -p" ++
                     " -ta "    ++ a          ++
                     " -x "     ++ show x     ++
                     " -y "     ++ show y     ++
                     " -w "     ++ show w     ++
                     " -h "     ++ show h     ++
                     " -fn '"   ++ myDzenFont ++ "'" ++
                     " -fg '"   ++ colorFG    ++ "'" ++
                     " -bg '"   ++ colorBG    ++ "' -e 'onstart=lower'"

-- define the bars
myLeftBar   = makeDzen 0 0 leftBarWidth barHeight "l"
myRightBar  = "conky -c " ++ conkyFile ++ " | " ++ makeDzen leftBarWidth 0 (monitorWidth - leftBarWidth) barHeight "r"

-- }}}

-- LogHook {{{
myLogHook :: Handle -> X ()
myLogHook h = (dynamicLogWithPP $ defaultPP
  { ppCurrent         = dzenFG colorUrg2 . pad
  , ppVisible         = dzenFG colorFG2  . pad
  , ppUrgent          = dzenFG colorUrg  . pad . dzenStrip
  , ppLayout          = dzenFG colorFG2  . myRename
  , ppHidden          = dzenFG colorFG2  . noScratchPad
  , ppHiddenNoWindows = namedOnly
  , ppTitle           = shorten 100 
  , ppSort            = getSortByXineramaRule
  , ppExtras          = [myAllMail, myInMail]
  , ppSep             = " "
  , ppWsSep           = ""
  , ppOutput          = hPutStrLn h
  }) >> updatePointer (Relative 0.95 0.95)

  where

    -- thanks byorgey (this filters out NSP too)
    namedOnly ws = if any (`elem` ws) ['a'..'z'] then pad ws else ""

    -- my own filter out scratchpad function
    noScratchPad ws = if ws == "NSP" then "" else pad ws

    -- L needed for loggers
    dzenFG  c = dzenColor  c ""
    dzenFGL c = dzenColorL c "" 

    myAllMail = wrapL "  Mail: " ""  . dzenFGL colorFG2 $ maildirNew myArchive
    myInMail  = wrapL "["        "]" . dzenFGL colorFG2 $ maildirNew myInbox

    myArchive = "/home/patrick/Mail/GMail/archive" -- All Mail
    myInbox   = "/home/patrick/Mail/GMail/INBOX"   -- Inbox

    myRename = (\x -> case x of
               "Hinted ResizableTall"          -> "  / /-/  "
               "Mirror Hinted ResizableTall"   -> "  /-,-/  "
               "Hinted Tabbed Bottom Simplest" -> "  /.../  "
               "Hinted TwoPane"                -> "  / / /  "
               "Hinted Full"                   -> "  /   /  "
               _                               -> "  " ++ x ++ "  "
               ) . stripIM

    stripIM s = if "IM " `isPrefixOf` s then drop (length "IM ") s else s

-- }}}

-- My SpawnHook {{{
--
-- spawn an arbitrary command on urgent
--
data MySpawnHook = MySpawnHook String deriving (Read, Show)

instance UrgencyHook MySpawnHook where
    urgencyHook (MySpawnHook s) w = spawn $ s

-- 'ding!' on urgent (gajim has fairly unnannoying sounds thankfully)
myUrgencyHook = MySpawnHook "ossplay -q /usr/share/gajim/data/sounds/message2.wav" 

-- }}}

-- Key Bindings {{{
--
-- only those which override/change defaults
--
-- custom scripts at http://pbrisbin.com:8080/pages/scripts.html
--
myKeys = [ ("M-p"                   , spawn "launch.sh"       ) -- dmenu wrapper, sort apps by usage
         , ("M-S-p"                 , spawn "bashrun"         ) -- Open gmrun replacement

         -- opening apps with Win
         , ("M4-t"                  , scratchPad              ) -- Spawn scratch pad terminal
         , ("M4-m"                  , spawn myMail            ) -- Open mail client
         , ("M4-b"                  , spawn myBrowser         ) -- Open web client
         , ("M4-i"                  , spawn myIRC             ) -- Open/attach IRC client in screen
         , ("M4-l"                  , spawn myLock            ) -- Win-l to lock screen
         , ("M4-e"                  , spawn myEject           ) -- Open/close tray 
         , ("M4-r"                  , spawn myTorrents        ) -- Open/attach rtorrent in screen 

         -- some custom hotkeys
         , ("M-a"                   , spawn "msearch all"     ) -- Search current playlist via dmenu
         , ("M-g"                   , spawn "goodsong"        ) -- Note current song as 'good'
         , ("M-S-g"                 , spawn "goodsong -p"     ) -- Play a random 'good' song
         , ("<Print>"               , spawn "sshot"           ) -- Take a screenshot on PrintScreen

         -- extended workspace navigations
         , ("M-`"                   , toggleWS                ) -- Switch to the most recently vewed ws
         , ("M-<Backspace>"         , focusUrgent             ) -- Focus most recently urgent window
         , ("M-S-<Backspace>"       , clearUrgents            ) -- Make urgents go away
         , ("M-f"                   , jumpToFull              ) -- jump to full layout

         -- extended window movements
         , ("M-o"                   , sendMessage MirrorShrink) -- Shink slave panes vertically
         , ("M-i"                   , sendMessage MirrorExpand) -- Expand slave panes vertically

         -- mpd and oss volume
         , ("<XF86AudioPlay>"       , spawn "mpc toggle"      ) -- play/pause mpd
         , ("<XF86AudioStop>"       , spawn "mpc stop"        ) -- stop mpd
         , ("<XF86AudioPrev>"       , spawn "mpc prev"        ) -- prev song
         , ("<XF86AudioNext>"       , spawn "mpc next"        ) -- next song
         , ("<XF86AudioMute>"       , spawn "ossvol -t"       ) -- toggle mute via custom script
         , ("<XF86AudioLowerVolume>", spawn "ossvol -d 1"     ) -- volume down via custom script
         , ("<XF86AudioRaiseVolume>", spawn "ossvol -i 1"     ) -- volume up via custom script

         -- Mod+ to control MPlayer
         , ("M-<XF86AudioPlay>"     , mPlay "pause"           ) -- play/pause mplayer
         , ("M-<XF86AudioStop>"     , mPlay "stop"            ) -- stop mplayer
         , ("M-<XF86AudioPrev>"     , mPlay "seek -10"        ) -- seek back 10 seconds
         , ("M-<XF86AudioNext>"     , mPlay "seek 10"         ) -- seek forward 10 seconds

         -- custom restart/quit commands
         , ("M-q"                   , spawn myRestart         ) -- Restart xmonad
         , ("M-S-q"                 , spawn "leave"           ) -- Logout via zenity dialog
         ] 

         where

           -- use myTerminal as the scratchPad terminal
           scratchPad = scratchpadSpawnActionTerminal myTerminal

           -- my apps
           myMail     = myTerminal ++ " -e mutt"
           myBrowser  = "$BROWSER"
           myLock     = "slock"
           myEject    = "eject -T /dev/sr0"

           -- see http://pbrisbin.com:8080/pages/screen_tricks.html
           myIRC      = myScreen "irssi"
           myTorrents = myScreen "rtorrent"

           myScreen s = myTerminal ++ " -title "                    ++ s
                                   ++ " -e bash -cl \"SCREEN_CONF=" ++ s 
                                   ++ " screen -S "                 ++ s
                                   ++ " -R -D "                     ++ s 
                                   ++ "\""

           jumpToFull = sendMessage $ JumpToLayout "Hinted Full"

           -- see http://pbrisbin.com:8080 recent post #9
           mPlay s    = spawn $ "echo " ++ s ++ " > $HOME/.mplayer_fifo"

           -- kill all conky/dzen2 before executing default restart command
           myRestart  = "for pid in `pgrep conky`; do kill -9 $pid; done && " ++
                        "for pid in `pgrep dzen2`; do kill -9 $pid; done && " ++
                        "xmonad --recompile && xmonad --restart"

-- }}}

-- vim:foldmethod=marker foldmarker={{{,}}}

any other dotfiles available via the link in my sig.

Offline

#11 2010-04-26 20:18:54

Paul-S
Member
From: Wales
Registered: 2008-02-04
Posts: 353

Re: Share your xmonad desktop!

XMonad and dzen2, with grid magnify layout

tNGFiaQ.jpg

Offline

#12 2010-04-27 01:05:42

ScottKidder
Member
Registered: 2008-10-27
Posts: 23

Re: Share your xmonad desktop!

Here's mine! I did most of this today and have just switched from xmobar to dzen so I have no cpu/mem stuff yet.
I'm using the same icon packs as above from the main dzen wiki. Both my xmonad.hs, dzen script and zshrc are below.
Edit: If anyone happens to wonder why my screenshot looks so awkward, it's because I'm using a 640x480 CRT for my second monitor cool
Edit2: I got my cpu/mem stuff, volume for mpd/alsa along with xmonad bindings to change both,  pacman update checker, and have my mail
and arch icons blinking if I have new mail(s) or arch packages big_smile

tNGIxeA

xmonad.hs

import XMonad
import qualified XMonad.StackSet as W
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.SetWMName
import XMonad.Hooks.FadeInactive
import XMonad.Hooks.UrgencyHook
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeys)
import XMonad.Prompt
import XMonad.Prompt.Shell
import XMonad.Prompt.XMonad
import XMonad.Prompt.RunOrRaise
import XMonad.Layout.NoBorders
import XMonad.Layout.PerWorkspace
import XMonad.Layout.IM
import XMonad.Layout.Reflect
import XMonad.Layout.Grid
import Control.Monad
import System.IO
import Data.List
import Data.Ratio ((%))
import qualified Data.Map as M

-- Simple configuration
myWorkspaces = ["web", "irssi", "term", "im", "music", "mntr", "#"]   
myBorderWidth = 2
myTerminal = "urxvtc"
myModMask = mod4Mask
myIconDir = "/home/scott/.dzen/dzenIcons/"
myStatusBar = "dzen2 -x '0' -y '0' -h '20' -w '290' -ta 'l' -bg '" ++ myDBGColor ++ "' -fn '" ++ myFont ++ "'"
myOtherBar = ".dzen/script.zsh | dzen2 -x '248' -y '0' -h '20' -w '1192' -ta 'r' -bg '" ++ myDBGColor ++ "' -fg '" ++ myDFGColor ++ "' -fn '" ++ myFont ++ "'"
--myFont = "-*-fixed-medium-r-*-*-14-*-*-*-*-*-iso8859-2"
myFont = "-*-terminus-medium-*-*-*-12-120-75-75-*-*-iso8859-*"

-- Colors
myDFGColor = "#ffffff" -- Dzen
myDBGColor = "#000000"
myFFGColor = "#000000" -- FG
myFBGColor = "#780000"
myVFGColor = "#3a0a0d" -- Visible
myVBGColor = myDBGColor
myUFGColor = "#780000" -- Urgent
myUBGColor = "#ffffff"
myIFGColor = "#ffffff" -- Icon
myIBGColor = myDBGColor
mySColor = "#171717" -- Seperator
myBorder = "#110E17"
myFocusedBorder = "#780000"

-- Pretty Printing
myDzenPP h = defaultPP
     {  ppCurrent         = dzenColor myFFGColor myFBGColor . wrap ("^fg(" ++ myIFGColor ++ ")^i(" ++ myIconDir ++ "/eye_l.xbm)") ""
      , ppVisible         = dzenColor myVFGColor myVBGColor . wrap ("^fg(" ++ myVFGColor ++ ")") ("^fg(" ++ myIFGColor ++ ")^i(" ++ myIconDir ++ "/eye_r.xbm)")
      , ppHidden          = dzenColor myDFGColor myDBGColor . wrap ("^i(" ++ myIconDir ++ "/dzen_bitmaps/has_win.xbm)") ""
      , ppHiddenNoWindows = dzenColor myDFGColor myDBGColor . wrap ("^i(" ++ myIconDir ++ "/dzen_bitmaps/has_win_nv.xbm)") ""
      , ppUrgent          = dzenColor myUFGColor myUBGColor . wrap ("^i(" ++ myIconDir ++ "/info_03.xbm)") "" . dzenStrip
      , ppTitle           = dzenColor myDFGColor myDBGColor . shorten 0
      , ppLayout          = dzenColor myDFGColor myDBGColor .
                            (\x -> case x of
                            "Mirror Tall" -> "^fg(" ++ myIFGColor ++ ")^i(" ++ myIconDir ++ "/dzen_bitmaps/mtall.xbm)"
                            "Tall" -> "^fg(" ++ myIFGColor ++ ")^i(" ++ myIconDir ++ "/dzen_bitmaps/tall.xbm)"
                            "Full" -> "^fg(" ++ myIFGColor ++ ")^i(" ++ myIconDir ++ "/dzen_bitmaps/full.xbm)"
                            _ -> x
                            )
      , ppSep             = " "
      , ppOutput          = hPutStrLn h }

-- Kill zombie dzens before normal xmonad restart
myRestart = "for pid in `pgrep dzen2`; do kill -9 $pid; done && xmonad --recompile && xmonad --restart"

-- Layout Hook
mylayoutHook = Mirror tiled ||| tiled ||| onWorkspace "im" tiled Full 
    where
    tiled = Tall nmaster delta ratio
    nmaster = 1
    delta = 3 / 100
    ratio = 13 / 20

-- Manage hook
myManageHook = composeAll
    [  className =? "Xmessage"  --> doFloat 
    ,  className =? "Pidgin"   --> doShift "im"      
    ,  title     =? "htop"     --> doShift "mntr"
    ,  title     =? "irssi"    --> doShift "irssi"
    ,  title     =? "ncmpcpp"  --> doShift "music"
    ] 
        <+> (fmap not isDialog --> doF avoidMaster)

-- Avoid changing master on new window creation
avoidMaster :: W.StackSet i l a s sd -> W.StackSet i l a s sd
avoidMaster = W.modify' $ \c -> case c of
    W.Stack t [] (r:rs) -> W.Stack t [r] rs
    otherwise            -> c

-- Log Hook
myLogHook = fadeInactiveLogHook fadeAmount
    where fadeAmount = 0.79

----------Start main-----------------
main = do
    dzen <- spawnPipe myStatusBar
    other <- spawnPipe myOtherBar
    xmonad $ withUrgencyHook NoUrgencyHook defaultConfig
    { manageHook         = manageHook defaultConfig <+> myManageHook 
    , layoutHook         = avoidStruts $ mylayoutHook
    , startupHook        = setWMName "LG3D"
    , keys               = \c -> mykeys c `M.union` keys defaultConfig c 
    , terminal           = myTerminal
    , modMask            = myModMask
    , borderWidth        = myBorderWidth
    , focusFollowsMouse  = True
    , normalBorderColor  = myBorder
    , focusedBorderColor = myFocusedBorder
    , workspaces         = myWorkspaces 
    , logHook            = myLogHook >> (dynamicLogWithPP $ myDzenPP dzen)
    }    
    where
            mykeys (XConfig {modMask = modm}) = M.fromList $
        [   ((modm, xK_f), spawn "firefox")      
          , ((modm .|. shiftMask, xK_apostrophe), spawn "ncmpcpp prev")
                  , ((modm .|. shiftMask, xK_period),     spawn "ncmpcpp next")
          , ((modm .|. shiftMask, xK_p),          spawn "ncmpcpp toggle")
          , ((modm .|. controlMask, xK_a),        spawn "mpc volume -5")
          , ((modm .|. controlMask, xK_o),        spawn "mpc volume +5")
          , ((modm .|. controlMask, xK_e),        spawn ".scripts/volumeChange.zsh -5")
          , ((modm .|. controlMask, xK_u),        spawn ".scripts/volumeChange.zsh +5")
          , ((modm .|. controlMask, xK_p),        runOrRaisePrompt defaultXPConfig)
                  , ((modm, xK_q),                        spawn myRestart)]
                  ++    
                  -- Change Xinerama bindings
          [ ((modm, key), screenWorkspace sc >>= flip whenJust (windows . f)) 
                      | (key, sc) <- zip [xK_w, xK_v, xK_z] [0..]
                      , (f, m) <- [(W.view, 0)]]

dzen2 script

#!/bin/zsh
#
# dzen2 script - Scott Kidder 2010
#
# Dzen conf
ICONDIR=~/.dzen/dzenIcons
ICONCOL1="#3a0a0d"
ICONCOL2="#780000"
BARFG="#780000"
BARBG="#212121"
SEGCOL="#212121"
# Configuration
DATE_FORMAT='%a, %-m/%-d/%y %I:%M:%S'
GCOUNT=0
GBLINK=0
ACOUNT=0
ABLINK=0

INTERVAL=1

DATEIVAL=1
MAILIVAL=30
MPDIVAL=1
PMIVAL=180
DISKIVAL=360
SYSIVAL=1
WEATHERIVAL=720
BLINKIVAL=1

# Functions
fdate() { date +$DATE_FORMAT }

fmail() {
    pass=$(cat /opt/foobarquuz.txt)
    wget --secure-protocol=TLSv1 --timeout=3 -t 1 -q -O - https://scott.kidder11:${pass}@mail.google.com/mail/feed/atom --no-check-certificate | grep 'fullcount' | sed -e 's/.*<fullcount>//;s/<\/fullcount>.*//'
}

fweather() {
    lynx -dump 'http://api.wunderground.com/weatherstation/WXCurrentObXML.asp?ID=KMIMTPLE2' | grep GMT | awk '{print $10}'
}

fpacman() { pacman -Qu | wc -l }

fmpd() { mpc | head -n 1 }

fmpdbar() {
mpc | sed -ne 's/^.*(\([0-9]*\)%).*$/\1/p' | gdbar -h 10 -w 40 -fg $BARFG -bg $BARBG -s o -nonl
}

fmpdvol() {
    V=$(mpc | grep volume | awk '{print $2}' | tr -d repeat:// | tr -d %//)
    if [ -z $V ]; then
        echo 100 | gdbar -h 8 -w 36 -fg $BARFG -bg $BARBG -ss 1 -sw 3 -s o -max 101
    else
        echo $V | gdbar -h 8 -w 36 -fg $BARFG -bg $BARBG -ss 1 -sw 3 -s o -max 101
    fi
}

falsavol() {
    amixer | grep -A 4 Master | tail -n 1 | awk '{print $4}' | tr -d \[\]%// | gdbar -h 8 -w 36 -fg $BARFG -bg $BARBG -ss 1 -sw 3 -s o -max 101
}

fdiskusage1() {
    df -h / | sed -ne 's/^.* \([0-9]*\)% .*/\1/p' | gdbar -h 8 -w 40 -fg $BARFG -bg $SEGCOL -ss 1 -sw 3 -nonl    
}
fdiskusage2() {
    df -h /shared | sed -ne 's/^.* \([0-9]*\)% .*/\1/p' | gdbar -h 8 -w 40 -fg $BARFG -bg $SEGCOL -ss 1 -sw 3 -nonl    
}

fmem() {
    awk '/MemTotal/ {t=$2} /MemFree/ {f=$2} /^Cached/ {c=$2} END {print t-f-c " " t;}' /proc/meminfo | gdbar -h 10 -w 60 -s o -fg $BARFG -bg $BARBG -w 50 -h 8
}

fcpu() {
    awk '{print $1 " " $2 " " $3;}' /proc/loadavg
}

DATECOUNTER=$DATEIVAL
MAILCOUNTER=$MAILIVAL
MPDCOUNTER=$MPDIVAL
PMCOUNTER=$PMIVAL
DISKCOUNTER=$DISKIVAL
MEMCOUNTER=$SYSIVAL
CPUCOUNTER=$SYSIVAL
WEATHERCOUNTER=$WEATHERIVAL
BLINKCOUNTER=$BLINKIVAL

while true; do
    if [ $DATECOUNTER -ge $DATEIVAL ]; then
        PDATE=$(fdate)
        DATECOUNTER=0
    fi

    if [ $PMCOUNTER -ge $PMIVAL ]; then
        NUM=$(fpacman)
        ACOUNT=$NUM
        PPM="$NUM"
        PMCOUNTER=0
    fi

    if [ $MAILCOUNTER -ge $MAILIVAL ]; then
        COUNT=$(fmail)
        GCOUNT=$COUNT
        blink --c -r $COUNT;
        PMAIL="$COUNT"
        MAILCOUNTER=0
    fi

    if [ $BLINKCOUNTER -ge $BLINKIVAL ]; then
        if [ $GCOUNT -ne 0 ]; then
            if [ $GBLINK -ne 0 ]; then
                PMICON="^fg($ICONCOL2)^i($ICONDIR/mail.xbm)^fg(#)"
                GBLINK=0
            else
                PMICON="^i($ICONDIR/mail.xbm)"
                GBLINK=1
            fi
        fi

        if [ $ACOUNT -ne 0 ]; then
            if [ $ABLINK -ne 0 ]; then
                AICON="^fg($ICONCOL2)^i($ICONDIR/arch.xbm)^fg(#)"
                ABLINK=0
            else
                AICON="^i($ICONDIR/arch.xbm)"
                ABLINK=1
            fi
        fi
        BLINKCOUNTER=0
    fi

    if [ $MPDCOUNTER -ge $MPDCOUNTER ]; then
        SONG=$(fmpd)
        BAR=$(fmpdbar)
        MVOL=$(fmpdvol)
        AVOL=$(falsavol)
        PMPD="^i($ICONDIR/dzen_bitmaps/music.xbm) $SONG $BAR ^i($ICONDIR/phones.xbm) $MVOL ^i($ICONDIR/spkr_02.xbm)$AVOL"
        MPDCOUNTER=0
    fi

    if [ $DISKCOUNTER -ge $DISKIVAL ]; then
        DISK1=$(fdiskusage1)
        DISK2=$(fdiskusage2)
        PDISK1="^fg($ICONCOL1)^i($ICONDIR/diskette.xbm)^fg(#) root$DISK1"
        PDISK2="shared$DISK2"
        DISKCOUNTER=0
    fi

    if [ $MEMCOUNTER -ge $SYSIVAL ]; then
        PMEM="^fg($ICONCOL1)^i($ICONDIR/mem.xbm)^fg(#) $(fmem)"
        MEMCOUNTER=0
    fi

    if [ $CPUCOUNTER -ge $SYSIVAL ]; then
        PCPU="^fg($ICONCOL1)^i($ICONDIR/cpu.xbm)^fg(#) $(fcpu)"
        CPUCOUNTER=0
    fi

    if [ $WEATHERCOUNTER -ge $WEATHERIVAL ]; then
        PWEATHER="^i($ICONDIR/temp.xbm)$(fweather)"
        WEATHERCOUNTER=0
    fi

    SEP=^fg($ICONCOL1)^i($ICONDIR/ac.xbm)^fg(#)
    print "$PMPD $PWEATHER $PMICON $PMAIL $AICON $PPM $PCPU $PMEM $PDISK1 $PDISK2 $SEP $PDATE"

    DATECOUNTER=$((DATECOUNTER+1))
    MAILCOUNTER=$((MAILCOUNTER+1))
    MPDCOUNTER=$((MPDCOUNTER+1))
    PMCOUNTER=$((PMCOUNTER+1))
    DISKCOUNTER=$((DISKCOUNTER+1))
    MEMCOUNTER=$((MEMCOUNTER+1))
    CPUCOUNTER=$((CPUCOUNTER+1))
    WEATHERCOUNTER=$((WEATHERCOUNTER+1))
    BLINKCOUNTER=$((BLINKCOUNTER+1))


    sleep $INTERVAL
done

zshrc

# Created by Scott for 4.3.10

#---------------------------------------
# Variables
#---------------------------------------
export EDITOR="vim"
export PAGER="vimpager"
export PDF="epdfview"
export BROWSER="firefox"
export VIDEO="vlc"
export MPD_HOST="archlinux"
export PATH=$PATH:~/.cabal/bin/:~/.scripts/

#---------------------------------------
# History stuff
#---------------------------------------
HISTSIZE=1000
SAVEHIST=1000
HISTFILE=~/.history
setopt APPEND_HISTORY
setopt INC_APPEND_HISTORY
setopt SHARE_HISTORY

#---------------------------------------
# Comp stuff
#---------------------------------------
zmodload zsh/complist
autoload -U compinit
compinit
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.zsh/cache
zstyle ':completion:*' completer _complete _match _approximate
zstyle ':completion:*:match:*' original only
zstyle ':completion:*:approximate:*' \
        max-errors 'reply=($((($#PREFIX+$#SUFFIX)/3))numeric)' 
zstyle ':completion:*:functions' ignored-patterns '_*'
zstyle ':completion:*:*:kill:*' menu yes select
zstyle ':completion:*:kill:*' force-list always 
zstyle ':completion:*' squeeze-slashes true 

#---------------------------------------
# Prompt 
#---------------------------------------
autoload -U promptinit
promptinit
PROMPT='%F{red}%B%K{red}█▓▒░%F{white}%K{red}%B%n@%m%b%F{red}%K{black}█▓▒░%F{white}%K{black}%B%~%b%f%k %B%F{red}>%b%f%F{red}>%f%F{white}>%f '

RPROMPT='%B%F{red}[%* on %D]'
#---------------------------------------
# Keybindings
#---------------------------------------
bindkey -v

#---------------------------------------
# zsh things
#---------------------------------------
setopt NOBGNICE
setopt NO_BEEP
setopt AUTO_CD
setopt CORRECT
setopt AUTO_LIST
setopt COMPLETE_IN_WORD
setopt ALWAYS_TO_END

#---------------------------------------
# Aliases
#---------------------------------------
#---------------------------------------
# Auto extensions
#---------------------------------------
alias -s pl=$EDITOR
alias -s txt=$EDITOR
alias -s cpp=$EDITOR
alias -s c=$EDITOR
alias -s pdf=$PDF
alias -s java=$EDITOR
alias -s html=$BROWSER
alias -s htm=$BROWSER
alias -s avi=$VIDEO
alias -s mp3=$VIDEO
alias -s doc=soffice
alias -s gz=tar -xzvf
alias -s bz2=tar -xjvf
alias -s jpeg=feh
alias -s jpg=feh
alias -s png=feh
alias -s gif=feh

#---------------------------------------
# Regular Aliases
#---------------------------------------
alias ls='ls --color=auto -F'
alias ll='ls --color=auto -la'
alias pp='sudo powerpill'
alias pps='sudo powerpill -S'
alias ppss='sudo powerpill -Ss'
alias ppsy='sudo powerpill -S --noconfirm'
alias ppu='sudo powerpill -Su --noconfirm && notify-send "System Upgrade Done!" && echo -e "\a"'
alias logisim='java -jar ~/logisim/.logisim'
alias h='history'
alias bp='echo -e "\a"'
alias cabal='nocorrect cabal'
alias sr='.scripts/snapshotRecover'
alias ec='vim .xmonad/xmonad.hs'
alias es='vim .dzen/script.zsh'

#---------------------------------------
# Special
#---------------------------------------
alias -g L='|less'
alias -g cps220='kidde1sr@cps220.cps.cmich.edu'

Last edited by ScottKidder (2010-04-28 17:46:32)


archlinux|xmonad
++++++++++[>++++++++>+++++++>+++<<<-]>+++.>---.<----.+++++..>>++.<++++++++.--.-----..+.<--.

Offline

#13 2010-04-27 21:13:35

milomouse
Member
Registered: 2009-03-24
Posts: 940
Website

Re: Share your xmonad desktop!

th_2010_04_27-155623.png
xmonad.hs:

-------------------------------------------------------------------------------------------
-- ~/.xmonad/xmonad.hs
-------------------------------------------------------------------------------------------
-- author: milomouse <vincent[at]fea.st>
-- credit: serrghi     -> config used as my starting grounds--very clean/workable.
--         serverninja -> too many thanks to mention (formatting, layout ideas, etc.)
--         pbrisbin    -> scratchpad "NSP" workspace hiding, and 'versions' idea.
-------------------------------------------------------------------------------------------
-- versions used atoc:
-- |  ghc                  -> 6.12.1-4
-- |  haskell-mtl          -> 1.1.0.2-3
-- |  haskell-utf8-string  -> 0.3.6-3
-- |  haskell-x11          -> 1.5.0.0-2
-- |  haskell-x11-xft      -> 0.3-13.1
-- |  xmonad-darcs         -> 20100423-1
-- |  xmonad-contrib-darcs -> 20100423-1
-- |  dzen2-svn            -> 267-1
-------------------------------------------------------------------------------------------

{-# LANGUAGE NoMonomorphismRestriction #-}

-- IMPORTS {{{

import XMonad hiding ( (|||) )
import qualified XMonad.StackSet as W
import qualified Data.Map as M
import Data.Ratio
import System.IO
import System.Exit

-- <actions>
import XMonad.Actions.GridSelect
import XMonad.Actions.CycleWS (nextWS,prevWS,toggleWS,shiftToNext,shiftToPrev)
import XMonad.Actions.CycleWindows (rotFocusedDown,rotFocusedUp,rotUnfocusedDown,rotUnfocusedUp)
import XMonad.Actions.RotSlaves (rotSlavesDown,rotSlavesUp)
import XMonad.Actions.Promote
import XMonad.Actions.WindowGo (runOrRaiseMaster)
import XMonad.Actions.PerWorkspaceKeys
import XMonad.Actions.FloatKeys (keysMoveWindow,keysResizeWindow)
import XMonad.Actions.WithAll
import XMonad.Actions.Search
import XMonad.Actions.Submap
import qualified XMonad.Actions.Search as S
import qualified XMonad.Actions.Submap as SM

-- <hooks>
import XMonad.Hooks.InsertPosition
import XMonad.Hooks.ManageHelpers (doCenterFloat,doFullFloat)
import XMonad.Hooks.ManageDocks (avoidStruts)
import XMonad.Hooks.EwmhDesktops (ewmhDesktopsStartup)
import XMonad.Hooks.SetWMName
import XMonad.Hooks.DynamicLog

-- <utilities>
import XMonad.Util.Cursor
import XMonad.Util.Run
import XMonad.Util.SpawnOnce
import XMonad.Util.Scratchpad (scratchpadManageHook,scratchpadSpawnActionCustom)

-- <prompts>
import XMonad.Prompt
import qualified XMonad.Prompt as P
import XMonad.Prompt.Shell
import XMonad.Prompt.AppendFile (appendFilePrompt)
import XMonad.Prompt.Man (manPrompt)
import XMonad.Prompt.Window (windowPromptBring,windowPromptGoto)

-- <layouts>
import XMonad.Layout.OneBig
import XMonad.Layout.TwoPane
import XMonad.Layout.Tabbed
import XMonad.Layout.ResizableTile
import XMonad.Layout.MosaicAlt
import XMonad.Layout.Spiral

-- <layout helpers>
import XMonad.Layout.Master
import XMonad.Layout.LayoutCombinators
import XMonad.Layout.LimitWindows
import XMonad.Layout.NoBorders (noBorders,smartBorders,withBorder)
import XMonad.Layout.Gaps
import XMonad.Layout.Reflect
import XMonad.Layout.MultiToggle
import XMonad.Layout.MultiToggle.Instances
import XMonad.Layout.PerWorkspace (onWorkspace)
import XMonad.Layout.Named
import XMonad.Layout.WindowNavigation

-- end of IMPORTS }}}





-- MAIN CONFIGURATION {{{

main = do
    dzenTopBar <- spawnPipe myStatusBar
    xmonad $ defaultConfig
      { modMask             = myModMask
      , keys                = myKeyBindings
      , terminal            = "urxvt"
      , workspaces          = map show [1..5]
      , layoutHook          = myLayouts
      , manageHook          = insertPosition Above Newer <+> myManageHook
      , startupHook         = myStartHook
      , logHook             = myLogHook dzenTopBar >> setWMName "LG3D"
      , normalBorderColor   = colorNormalBorder
      , focusedBorderColor  = colorFocusedBorder
      , borderWidth         = 2 -- for floating windows ('noBorders' OR 'withBorder Int' on layouts)
      , focusFollowsMouse   = False
      }
myStartHook = spawnOnce ". $HOME/.xmonad/dzen2start" <+>
              setDefaultCursor xC_left_ptr <+>
              ewmhDesktopsStartup >> setWMName "LG3D"

-- end of MAIN-CONFIGURATION }}}





-- COLORS, FONTS, AND PROMPTS {{{

-- <colors>
colorBlack          = "#000000"
colorBlackAlt       = "#040404"
colorGray           = "#606060"
colorGrayAlt        = "#282828"
colorDarkGray       = "#161616"
colorWhite          = "#cfbfad"
colorWhiteAlt       = "#8c8b8e"
colorDarkWhite      = "#444444"
colorCream          = "#a9a6af"
colorDarkCream      = "#5f656b"
colorMagenta        = "#a488d9"
colorMagentaAlt     = "#7965ac"
colorDarkMagenta    = "#8e82a2"
colorBlue           = "#98a7b6"
colorBlueAlt        = "#598691"
colorDarkBlue       = "#464a4a"
colorNormalBorder   = colorGray
colorFocusedBorder  = colorMagenta

-- <fonts>
barFont   = "fixed"
barXFont  = "fixed:size=10"
xftFont   = "xft: fixed-10"

-- <tab-bar configuration>
myTabTheme =
    defaultTheme { fontName            = xftFont
                 , inactiveBorderColor = colorGrayAlt
                 , inactiveColor       = colorDarkGray
                 , inactiveTextColor   = colorGrayAlt
                 , activeBorderColor   = colorGrayAlt
                 , activeColor         = colorDarkMagenta
                 , activeTextColor     = colorDarkGray
                 , urgentBorderColor   = colorBlackAlt
                 , urgentTextColor     = colorWhite
                 , decoHeight          = 12
                 }

-- <prompts>
myXPConfig :: XPConfig
myXPConfig =
    defaultXPConfig { font                  = xftFont
                    , bgColor               = colorDarkGray
                    , fgColor               = colorMagenta
                    , bgHLight              = colorDarkMagenta
                    , fgHLight              = colorDarkGray
                    , borderColor           = colorBlackAlt
                    , promptBorderWidth     = 1
                    , height                = 16
                    , position              = Bottom
                    , historySize           = 100
                    , historyFilter         = deleteConsecutive
                    }

-- end of COLORS, FONTS, AND PROMPTS }}}





-- UTILITY FUNCTIONS {{{

-- <grid-select>
myColorizer = colorRangeFromClassName
    (0x00,0x00,0x00) -- lowest inactive bg
    (0xBB,0xAA,0xFF) -- highest inactive bg
    (0x88,0x66,0xAA) -- active bg
    (0xBB,0xBB,0xBB) -- inactive fg
    (0x00,0x00,0x00) -- active fg
  where
    black = minBound
    white = maxBound

myGSConfig colorizer = (buildDefaultGSConfig myColorizer)
    { gs_cellheight   = 50
    , gs_cellwidth    = 200
    , gs_cellpadding  = 10
    , gs_font         = xftFont
    }

-- <scratchpad>
manageScratchPad :: ManageHook
manageScratchPad = scratchpadManageHook (W.RationalRect (1/6) (1/4) (2/3) (2/5))
scratchPad = scratchpadSpawnActionCustom "urxvt -name scratchpad +sb -fn '-*-fixed-medium-*-*-*-9-*-*-*-*-*' -e tmux -L sp new-session ncmpcpp"

-- end of UTILITY FUNCTIONS }}}





-- LAYOUTS {{{

myLayouts = avoidStruts                   $
--            gaps [(D,13)]                 $ -- thinking about another dzen2 bar.
            windowNavigation              $
            mkToggle (single NBFULL)      $
            mkToggle (single REFLECTX)    $
            mkToggle (single REFLECTY)    $
            onWorkspace "2" workLayouts   $
            onWorkspace "3" inetLayouts   $
            onWorkspace "4" fotoLayouts   $
            (collectiveLayouts)
  where
    collectiveLayouts = myFull ||| myTwoP ||| myTabD ||| myTile ||| myOneB ||| myMosC ||| mySprL

    -- <define layouts>
    myFull = named "*" (smartBorders (noBorders Full))
    myTile = named "+" (smartBorders (withBorder 1 (limitWindows 5 (ResizableTall 1 0.03 0.5 []))))
    myTabD = named "=" (smartBorders (noBorders (mastered 0.02 0.4 $ tabbedAlways shrinkText myTabTheme)))
    myTwoP = named "-" (smartBorders (withBorder 1 (TwoPane 0.02 0.4)))
    myMosC = named "%" (smartBorders (withBorder 1 (MosaicAlt M.empty)))
    mySprL = named "@" (smartBorders (withBorder 1 (limitWindows 5 (spiral gRatio))))
    myOneB = named "#" (smartBorders (withBorder 1 (limitWindows 5 (OneBig 0.75 0.75))))

    -- <layouts per workspace>
    workLayouts = myTabD ||| myOneB ||| myTile ||| myMosC ||| myTwoP
    inetLayouts = myFull ||| myTwoP ||| myTabD
    fotoLayouts = myFull ||| myMosC ||| mySprL ||| myOneB

    -- <<spiral ratio>>
    gRatio = toRational goldenRatio
    goldenRatio = 2/(1+sqrt(5)::Double);

-- end of LAYOUTS }}}





-- WORKSPACES/STATUSBAR {{{

-- <window management>
myManageHook :: ManageHook
myManageHook = (composeAll . concat $
    [ [resource     =? r     --> doIgnore       |   r   <- myIgnores] -- ignore desktop
    , [className    =? c     --> doShift  "3"   |   c   <- myInetC  ] -- move myInetC windows to workspace 3
    , [className    =? c     --> doShift  "4"   |   c   <- myFotoC  ] -- move myFotoC windows to workspace 4
    , [className    =? c     --> doCenterFloat  |   c   <- myFloatsC] -- float center geometry by class
    , [name         =? n     --> doCenterFloat  |   n   <- myFloatsN] -- float center geometry by name
    , [name         =? n     --> doFullFloat    |   n   <- myTrueFSN] -- float true fullscreen by name
    ]) <+> manageScratchPad
    where
        role      = stringProperty "WM_WINDOW_ROLE"
        name      = stringProperty "WM_NAME"
        -- <<class>>
        myFloatsC = ["MPlayer","Save As...","Downloads"]
        myFotoC   = ["Gliv","Display"]
        myInetC   = ["Navigator","Minefield","Firefox"]
        -- <<resource>>
        myIgnores = ["desktop","desktop_window"]
        -- <<name>>
        myFloatsN = ["gcolor2"]
        myTrueFSN = ["GLiv in fullscreen"]

-- <statusbar/logging>
myStatusBar = "dzen2 -x '0' -y '0' -h '13' -w '130' -ta 'l' -bg '#161616' -fg '#a9a6af' -fn '-*-fixed-medium-r-normal-*-10-*-*-*-*-*-*-*'"
myLogHook :: Handle -> X ()
myLogHook h = dynamicLogWithPP $ defaultPP
    {
        ppCurrent           =   dzenColor colorBlueAlt    colorDarkGray . hideScratchpad
      , ppVisible           =   dzenColor colorCream      colorDarkGray . hideScratchpad
      , ppHidden            =   dzenColor colorDarkCream  colorDarkGray . hideScratchpad
      , ppHiddenNoWindows   =   dzenColor colorDarkWhite  colorDarkGray . hideScratchpad
      , ppUrgent            =   dzenColor colorMagenta    colorDarkGray . pad
      , ppWsSep             =   ""
      , ppSep               =   " | "
      , ppLayout            =   dzenColor colorMagentaAlt colorDarkGray .
                                (\x -> case x of
                                    "Full" -> "*"
                                    "ReflectX *" -> "*"
                                    "ReflectX +" -> "+"
                                    "ReflectX =" -> "="
                                    "ReflectX -" -> "-"
                                    "ReflectX %" -> "%"
                                    "ReflectX @" -> "@"
                                    "ReflectY *" -> "*"
                                    "ReflectY +" -> "+"
                                    "ReflectY =" -> "="
                                    "ReflectY -" -> "-"
                                    "ReflectY %" -> "%"
                                    "ReflectY @" -> "@"
                                    "ReflectX ReflectY *" -> "*"
                                    "ReflectX ReflectY +" -> "+"
                                    "ReflectX ReflectY =" -> "="
                                    "ReflectX ReflectY -" -> "-"
                                    "ReflectX ReflectY %" -> "%"
                                    "ReflectX ReflectY @" -> "@"
                                    _      -> x
                                )
      , ppTitle             =   (" " ++) . dzenColor colorWhiteAlt colorDarkGray . dzenEscape
      , ppOutput            =   hPutStrLn h
    }
    where
      hideScratchpad ws = if ws == "NSP" then "" else pad ws -- don't show scratchpad in workspace list

-- end of WORKSPACES/STATUSBAR }}}





-- KEY-BINDINGS {{{

myModMask :: KeyMask
myModMask =  mod4Mask

myKeyBindings :: XConfig Layout -> M.Map (KeyMask, KeySym) (X ())
myKeyBindings conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
    -- <basic commands>
    [ ((modMask .|. shiftMask,     xK_q         ), io (exitWith ExitSuccess)) -- exit xmonad
    , ((modMask .|. shiftMask,     xK_r         ), restart "xmonad" True) -- restart xmonad
    , ((modMask .|. controlMask,   xK_r         ), unsafeSpawn "xmonad --recompile && xmonad --restart") -- recompile and restart xmonad
    , ((modMask,                   xK_b         ), refresh) -- bump window to correct size
    , ((modMask .|. controlMask,   xK_BackSpace ), kill) -- kill selected window
    -- <prompts/utils>
    , ((0,                         xK_F1        ), manPrompt myXPConfig) -- manpage prompt
    , ((0,                         xK_F2        ), shellPrompt myXPConfig) -- shell prompt
    , ((0,                         xK_F3        ), windowPromptGoto myXPConfig) -- goto window on it's workspace on in it's frame
    , ((modMask,                   xK_F3        ), windowPromptBring myXPConfig) -- bring window to current workspace in current frame
    , ((0,                         xK_F4        ), promptSearchBrowser myXPConfig "firefox" multi) -- internet search (engine:string (google default))
    , ((modMask,                   xK_F4        ), SM.submap $ searchEngineMap $ promptSearchBrowser myXPConfig "firefox") -- internet seach (sub-bindings at end of section)
    , ((0,                         xK_F12       ), appendFilePrompt myXPConfig "/home/milo/othe/.TODO_now") -- add one-liner to file (cannot expand $HOME)
    , ((modMask,                   xK_g         ), goToSelected $ myGSConfig myColorizer) -- show a grid of windows to jump to
    , ((modMask .|. shiftMask,     xK_g         ), bringSelected $ myGSConfig myColorizer) -- show a grid of windows to bring here
    -- <common programs>
    , ((modMask,                   xK_Escape    ), safeSpawnProg "banishmouse") -- hide and freeze the mouse cursor (or bring back to original location)
    , ((0,                         xK_Print     ), unsafeSpawn "import -window root $HOME/foto/shot/$(date +%Y_%m_%d-%H%M%S).png") -- take screenshot of current workspace
    , ((modMask .|. shiftMask,     xK_Delete    ), unsafeSpawn "alock -bg image:file=$HOME/foto/wall/beheading.jpg -cursor glyph -auth pam >&/dev/null") -- lock screen
    , ((modMask .|. shiftMask,     xK_Return    ), safeSpawnProg $ XMonad.terminal conf) -- spawn terminal by itself
    , ((modMask,                   xK_Return    ), unsafeSpawn "urxvt -e tmux") -- spawn terminal in tmux
    , ((modMask,                   xK_grave     ), scratchPad) -- spawn floating "scratchpad" window
    , ((modMask,                   xK_f         ), runOrRaiseMaster "firefox" (className =? "Firefox")) -- run or raise/goto firefox
    -- <function/media keys>
    , ((0 .|. controlMask,         0x1008ff02   ), unsafeSpawn "moodlight -m") -- maximum screen brightness ((XF86MonBrightnessUp [max]))
    , ((0,                         0x1008ff02   ), unsafeSpawn "moodlight -u") -- increase screen brightness ((XF86MonBrightnessUp))
    , ((0,                         0x1008ff03   ), unsafeSpawn "moodlight -d") -- decrease screen brightness ((XF86MonBrightnessDown))
    , ((0,                         0x1008ff12   ), unsafeSpawn "mossrat -m")   -- mute volume, via "mossrat" ((XF86AudioMute))
    , ((0,                         0x1008ff11   ), unsafeSpawn "mossrat -d 1") -- decrease volume, via "mossrat" ((XF86AudioLowerVolume))
    , ((0,                         0x1008ff13   ), unsafeSpawn "mossrat -i 1") -- increase volume, via "mossrat" ((XF86AudioRaiseVolume))
    , ((modMask,                   xK_a         ), submap . M.fromList $ -- "mossrat" commong sub-bindings (music playing script)
                                [ ((0, xK_t       ), unsafeSpawn "mossrat --toggle") -- <toggle song>
                                , ((0, xK_s       ), unsafeSpawn "mossrat --stop") -- <stop song>
                                , ((0, xK_p       ), unsafeSpawn "mossrat --prev") -- <play previous song>
                                , ((0, xK_n       ), unsafeSpawn "mossrat --next") -- <play next song>
                                ])
    , ((modMask,                   xK_s         ), submap . M.fromList $ -- "songrem" common sub-bindings (forked fav. song script)
                                [ ((0, xK_a       ), unsafeSpawn "songrem --add") -- <add current song to list>
                                , ((0, xK_r       ), unsafeSpawn "songrem --remove") -- <remove current song, if in list>
                                , ((0, xK_e       ), unsafeSpawn "songrem --edit") -- <manually edit list in [internally called] terminal>
                                , ((0, xK_n       ), unsafeSpawn "songrem --play") -- <play song from list>
                                ])
    , ((modMask .|. shiftMask,     xK_e         ), safeSpawnProg "eject") -- open disc tray
    -- <tiled windows>
    , ((modMask,                   xK_m         ), windows W.focusMaster) -- immediately focus on master
    , ((modMask .|. shiftMask,     xK_m         ), promote) -- swap with & focus on master (if xK_m in master; like "Swap D" but keeps focus)
    , ((modMask,                   xK_equal     ), sendMessage $ IncMasterN 1) -- increase number of masters
    , ((modMask,                   xK_minus     ), sendMessage $ IncMasterN (-1)) -- decrease number of masters
    , ((modMask,                   xK_0         ), sendMessage $ Expand) -- expand size of master frame
    , ((modMask,                   xK_9         ), sendMessage $ Shrink) -- shrink size of master frame
    , ((modMask .|. shiftMask,     xK_0         ), sendMessage $ MirrorShrink) -- shrink size of master frame
    , ((modMask .|. shiftMask,     xK_9         ), sendMessage $ MirrorExpand) -- expand size of master frame
    , ((modMask .|. mod1Mask,      xK_0         ), withFocused (sendMessage . expandWindowAlt)) -- expand MosaicAlt frame
    , ((modMask .|. mod1Mask,      xK_9         ), withFocused (sendMessage . shrinkWindowAlt)) -- shrink MosaicAlt frame
    , ((modMask .|. mod1Mask,      xK_equal     ), withFocused (sendMessage . tallWindowAlt)) -- create a more horizontal MosaicAlt
    , ((modMask .|. mod1Mask,      xK_minus     ), withFocused (sendMessage . wideWindowAlt)) -- create a more vertical MosaicAlt
    , ((modMask .|. mod1Mask,      xK_space     ), sendMessage resetAlt) -- reset MosaicAlt layout
    , ((modMask,                   xK_j         ), sendMessage $ Go D) -- focus down a frame
    , ((modMask,                   xK_k         ), sendMessage $ Go U) -- focus up a frame
    , ((modMask,                   xK_h         ), sendMessage $ Go L) -- focus left a frame
    , ((modMask,                   xK_l         ), sendMessage $ Go R) -- focus right a frame
    , ((modMask .|. shiftMask,     xK_j         ), sendMessage $ Swap D) -- swap window with lower frame and focus on it
    , ((modMask .|. shiftMask,     xK_k         ), sendMessage $ Swap U) -- swap window with above frame and focus on it
    , ((modMask .|. shiftMask,     xK_h         ), sendMessage $ Swap L) -- swap window with left frame and focus on it
    , ((modMask .|. shiftMask,     xK_l         ), sendMessage $ Swap R) -- swap window with right frame and focus on it
    , ((modMask .|. controlMask,   xK_j         ), rotUnfocusedDown) -- rotate unfocused slaves [and/or master] down/prev
    , ((modMask .|. controlMask,   xK_k         ), rotUnfocusedUp) -- rotate unfocused slaves [and/or master] up/next
    , ((modMask .|. controlMask,   xK_h         ), rotFocusedDown) -- rotate focused slaves [and/or master] down/prev
    , ((modMask .|. controlMask,   xK_l         ), rotFocusedUp) -- rotate focused slaves [and/or master] up/next
    , ((modMask,                   xK_Tab       ), rotSlavesUp) -- rotate all slaves up/prev
    , ((modMask,                   xK_n         ), windows W.focusDown) -- focus down/next (in Full layout, or if you'd rather see tabs move (undesirable))
    , ((modMask,                   xK_p         ), windows W.focusUp) -- focus up/prev (in Full layout, or if you'd rather see tabs move (undesirable))
    , ((modMask .|. controlMask,   xK_n         ), windows W.swapDown) -- swap down/next (in Full layout, or for tabbed slave movement (undesirable))
    , ((modMask .|. controlMask,   xK_p         ), windows W.swapUp) -- swap up/prev (in Full layout, or for tabbed slave movement (undesirable))
    -- <floating windows (rarely use these)>
    , ((modMask,                   xK_w         ), withFocused $ windows . W.sink) -- push a focused floating window back into tiling
    , ((modMask .|. shiftMask,     xK_w         ), sinkAll) -- push all floating windows in workspace into tiling
    , ((modMask,                   xK_u         ), withFocused (keysMoveWindow (0,10))) -- move down
    , ((modMask .|. shiftMask,     xK_u         ), withFocused (keysResizeWindow (0,-10) (0,1))) -- decrease down
    , ((modMask .|. controlMask,   xK_u         ), withFocused (keysResizeWindow (0,10) (0,1))) -- increase down
    , ((modMask,                   xK_i         ), withFocused (keysMoveWindow (0,-10))) -- move up
    , ((modMask .|. shiftMask,     xK_i         ), withFocused (keysResizeWindow (0,-10) (1,0))) -- decrease up
    , ((modMask .|. controlMask,   xK_i         ), withFocused (keysResizeWindow (0,10) (1,0))) -- increase up
    , ((modMask,                   xK_y         ), withFocused (keysMoveWindow (-10,0))) -- move left
    , ((modMask .|. shiftMask,     xK_y         ), withFocused (keysResizeWindow (-10,0) (1,1))) -- decrease left
    , ((modMask .|. controlMask,   xK_y         ), withFocused (keysResizeWindow (10,0) (1,1))) -- increase left
    , ((modMask,                   xK_o         ), withFocused (keysMoveWindow (10,0))) -- move right
    , ((modMask .|. shiftMask,     xK_o         ), withFocused (keysResizeWindow (-10,0) (0,1))) -- decrease right
    , ((modMask .|. controlMask,   xK_o         ), withFocused (keysResizeWindow (10,0) (0,1))) -- increase right
    -- <layout/workspace common>
    , ((modMask,                   xK_t         ), submap . M.fromList $ -- common toggle sub-bindings
                                [ ((0, xK_o       ), sendMessage $ Toggle NBFULL) -- <toggle Full with noBorders (like "only"), and back again>
                                , ((0, xK_x       ), sendMessage $ Toggle REFLECTX) -- <toggle mirrored layout by X axis>
                                , ((0, xK_y       ), sendMessage $ Toggle REFLECTY) -- <toggle mirrored layout by Y axis>
                                ])
    , ((modMask,                   xK_space     ), sendMessage NextLayout) -- cycle to next layout
    , ((modMask .|. shiftMask,     xK_space     ), setLayout $ XMonad.layoutHook conf) -- reset layout on current desktop to default
    , ((modMask,                   xK_period    ), nextWS) -- focus next workspace
    , ((modMask,                   xK_comma     ), prevWS) -- focus previous workspace
    , ((modMask,                   xK_slash     ), toggleWS) -- toggle between last viewed workspace and current
    , ((modMask .|. shiftMask,     xK_period    ), shiftToNext) -- move current frame to next workspace
    , ((modMask .|. shiftMask,     xK_comma     ), shiftToPrev) -- move current frame to previous workspace
    , ((modMask .|. controlMask,   xK_period    ), shiftToNext >> nextWS) -- move current frame to next workspace and go there
    , ((modMask .|. controlMask,   xK_comma     ), shiftToPrev >> prevWS) -- move current frame to previous workspace and go there
    ]
    ++
    [((m .|. modMask, k), windows $ f i)
        | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
        , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]
    ]
    where
      searchEngineMap method = M.fromList $
          [ ((0, xK_g), method S.google )
          , ((0, xK_i), method S.images )
          , ((0, xK_w), method S.wikipedia )
          , ((0, xK_a), method S.amazon )
          , ((0, xK_b), method $ S.searchEngine "ArchBBS" "http://bbs.archlinux.org/search.php?action=search&keywords=")
          ]

-- end of KEY-BINDINGS }}}

-- vim:foldmethod=marker foldmarker={{{,}}} sw=2 sts=2 ts=2 tw=0 et ai nowrap

dzen2start (from spawnOnce in xmonad.hs (~/.xmonad/dzen2start)):

#!/bin/zsh
# media/date bar at far right.
while true; do
  echo "$(mossrat -x)^fg(#a488d9) | ^fg(#8c8b8e)$(date '+%Y^fg(#444).^fg()%m^fg(#444).^fg()%d^fg(#007b8c)/^fg(#5f656b)%j ^fg(#a488d9)| ^fg()%H^fg(#444):^fg()%M^fg(#444):^fg()%S') "
  sleep 1
done | dzen2 -u -x '626' -y '0' -h '13' -w '740' -ta 'r' -bg '#161616' -fg '#8c8b8e' -fn '-*-fixed-medium-r-normal-*-10-*-*-*-*-*-*-*' &
# top-center to the right of xmonad's.
while true; do
  echo "^fg(#515056)totalWindows: ^fg()$(lsw|awk ' !x[$0]--'|grep -v "GLiv\|Firefox\| - Downloads"|wc -l) ^fg(#007b8c)| \
^fg()$(cat /proc/loadavg|sed 's/ [0-9]\/.*$//;s/\./'"^fg(#5f656b)"'&'"^fg()"'/g') ^fg(#007b8c)| ^fg()\
$(df -h|grep "sda2\|sda5\|sda3"|awk '{print "^fg(#5f656b)"$4"^fg(#050505)""""|^fg(#444)"$5" "}'|tr -d '\n')"\
"^fg(#007b8c)| ^fg(#515056)newMail: ^fg()$(ls -1 /home/milo/mail/FastMail/*/new|sed 's|/.*$||'|tr '\n' ' '|wc -w)" \
"^fg() ^fg(#a488d9)>""^fg(#007b8c)>""^fg(#444444)>"
  sleep 1
done | dzen2 -u -x '130' -w '496' -y '0' -h '13' -ta 'l' -bg '#161616' -fg '#8c8b8e' -fn '-*-fixed-medium-r-normal-*-10-*-*-*-*-*-*-*' &

edit: thought i'd update (screenshot is still valid as one of the layouts). credits in xmonad.hs. github: http://github.com/milomouse/dotfiles/tr … er/.xmonad

Last edited by milomouse (2010-05-11 23:21:57)

Offline

#14 2010-05-09 21:27:52

ScottKidder
Member
Registered: 2008-10-27
Posts: 23

Re: Share your xmonad desktop!

BUMP! I've been working with mine a lot lately big_smile

MOD EDIT : Please follow the forum rules when posting screenshots !!!!   ---  Inxsible

xmonad.hs

import XMonad
import qualified XMonad.StackSet as W
import qualified Data.Map        as M
import XMonad.Actions.GridSelect
import XMonad.Actions.FindEmptyWorkspace
import XMonad.Actions.CycleWS
import XMonad.Actions.Plane
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.SetWMName
import XMonad.Hooks.FadeInactive
import XMonad.Hooks.UrgencyHook hiding (Never)
import XMonad.Layout.PerWorkspace
import XMonad.Layout.IM
import XMonad.Layout.Grid
import XMonad.Layout.TwoPane
import XMonad.Layout.NoBorders
import XMonad.Prompt
import XMonad.Prompt.Shell
import XMonad.Prompt.XMonad
import XMonad.Prompt.RunOrRaise
import XMonad.Prompt.AppendFile
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeysP, additionalKeys)
import Control.Monad
import System.IO
import Data.List
import Data.Ratio ((%))

main = do
    dzen <- spawnPipe myStatusBar
    --other <- spawnPipe myOtherBar
    other <- spawnPipe myLeftBar
    other <- spawnPipe myRightBar
    xmonad $ withUrgencyHook NoUrgencyHook defaultConfig
    { manageHook         = manageHook defaultConfig <+> myManageHook 
    , layoutHook         = avoidStruts $ mylayoutHook
    , startupHook        = setWMName "LG3D"
    , terminal           = myTerminal
    , modMask            = myModMask
    , borderWidth        = myBorderWidth
    , focusFollowsMouse  = True
    , normalBorderColor  = myBorder
    , focusedBorderColor = myFocusedBorder
    , workspaces         = myWorkspaces 
    , logHook            = myLogHook >> (dynamicLogWithPP $ myDzenPP dzen)
    } `additionalKeysP` myKeys

-- Simple configuration
myWorkspaces = ["web", "mail", "term", "im", "music", "irssi", "htop","λ", "σ"]   
--myWorkspaces = toList myCursors
myBorderWidth = 2
myTerminal = "urxvtc"
myModMask = mod4Mask
myIconDir = "/home/scott/.dzen/dzenIcons/"
myStatusBar = "dzen2 -x '0' -y '0' -h '20' -w '309' -ta 'l' -bg '" ++ myDBGColor ++ "' -fn '" ++ myFont ++ "'"
--myOtherBar = ".dzen/script.zsh | dzen2 -x '309' -y '0' -h '20' -w '1131' -ta 'r' -bg '" ++ myDBGColor ++ "' -fg '" ++ myDFGColor ++ "' -fn '" ++ myFont ++ "'"
myLeftBar = ".dzen/left.zsh | dzen2 -xs 1 -x '309' -y '0' -h '20' -w '1131' -ta 'r' -bg '" ++ myDBGColor ++ "' -fg '" ++ myDFGColor ++ "' -fn '" ++ myFont ++ "'"
myRightBar = ".dzen/right.zsh | dzen2 -xs 2 -y '0' -h '20' -ta 'r' -bg '" ++ myDBGColor ++ "' -fg '" ++ myDFGColor ++ "' -fn '" ++ myFont ++ "'"
--myFont = "-*-fixed-medium-r-*-*-14-*-*-*-*-*-iso8859-2"
myFont = "-*-terminus-medium-*-*-*-12-120-75-75-*-*-iso8859-*"

-- Layout Hook
mylayoutHook = lessBorders (Combine Difference Screen OnlyFloat) (Mirror tiled ||| tiled ||| Grid ||| onWorkspace "im" (TwoPane (3/100) (1/2)) Full)
    where
    tiled = Tall nmaster delta ratio
    nmaster = 1
    delta = 3 / 100
    ratio = 13 / 20

-- Manage hook
myManageHook = composeAll
    [  className =? "Xmessage" --> doFloat 
    ,  className =? "Pidgin"   --> doShift "im"      
    ,  title     =? "htop"     --> doShift "htop"
    ,  title     =? "irssi"    --> doShift "irssi"
    ,  title     =? "ncmpcpp"  --> doShift "music"
    ,  title     =? "sup"      --> doShift "mail"
    ] 
        <+> (fmap not isDialog --> doF avoidMaster)

-- Log Hook
myLogHook = fadeInactiveLogHook fadeAmount
    where fadeAmount = 0.79

-- Colors
myDFGColor = "#ffffff" -- Dzen
myDBGColor = "#000000"
myFFGColor = "#000000" -- FG
myFBGColor = "#780000"
myVFGColor = "#3a0a0d" -- Visible
myVBGColor = myDBGColor
myUFGColor = "#780000" -- Urgent
myUBGColor = "#ffffff"
myIFGColor = "#ffffff" -- Icon
myIBGColor = myDBGColor
mySColor = "#171717" -- Seperator
myBorder = "#110E17"
myFocusedBorder = "#780000"

-- Pretty Printing
myDzenPP h = defaultPP
     {  ppCurrent         = dzenColor myFFGColor myFBGColor . wrap ("^fg(" ++ myIFGColor ++ ")^i(" ++ myIconDir ++ "/eye_l.xbm)") ""
      , ppVisible         = dzenColor myVFGColor myVBGColor . wrap ("^fg(" ++ myVFGColor ++ ")") ("^fg(" ++ myIFGColor ++ ")^i(" ++ myIconDir ++ "/eye_r.xbm)")
      , ppHidden          = dzenColor myDFGColor myDBGColor . wrap ("^i(" ++ myIconDir ++ "/dzen_bitmaps/has_win.xbm)") ""
      , ppHiddenNoWindows = dzenColor myDFGColor myDBGColor . wrap ("^i(" ++ myIconDir ++ "/dzen_bitmaps/has_win_nv.xbm)") ""
      , ppUrgent          = dzenColor myUFGColor myUBGColor . wrap ("^i(" ++ myIconDir ++ "/info_03.xbm)") "" . dzenStrip
      , ppTitle           = dzenColor myDFGColor myDBGColor . shorten 0
      , ppLayout          = dzenColor myDFGColor myDBGColor .
                            (\x -> case x of
                            "Mirror Tall" -> "^fg(" ++ myIFGColor ++ ")^i(" ++ myIconDir ++ "/dzen_bitmaps/mtall.xbm)"
                            "Tall" -> "^fg(" ++ myIFGColor ++ ")^i(" ++ myIconDir ++ "/dzen_bitmaps/tall.xbm)"
                            "Full" -> "^fg(" ++ myIFGColor ++ ")^i(" ++ myIconDir ++ "/dzen_bitmaps/full.xbm)"
                            "Grid" -> "^fg(" ++ myIFGColor ++ ")^i(" ++ myIconDir ++ "/dzen_bitmaps/grid.xbm)"
                            "TwoPane" -> "^fg(" ++ myIFGColor ++ ")^i(" ++ myIconDir ++ "/dzen_bitmaps/two_pane.xbm)"
                            _ -> x
                            )
      , ppSep             = " "
      , ppOutput          = hPutStrLn h }

-- Custom Keys
myKeys = [ ("M-f",   spawn "firefox")      
         , ("M-u",   spawn "uzbl-tabbed")
         -- MPD and ALSA Volume
         , ("M-S-'", spawn "ncmpcpp prev")
         , ("M-S-.", spawn "ncmpcpp next")
         , ("M-S-p", spawn "ncmpcpp toggle")
         , ("M-C-a", spawn "mpc volume -5")
         , ("M-C-o", spawn "mpc volume +5")
         , ("M-C-e", spawn "volumeChange -5")
         , ("M-C-u", spawn "volumeChange +5")
         -- CycleWS
         , ("M-s", nextWS)
         , ("M-n", prevWS)
         -- FindEmptyWorkspace
         , ("M-S-m", viewEmptyWorkspace)
         , ("M-C-m", tagToEmptyWorkspace)
         -- Grid select 
         , ("M-g",   goToSelected $ gsconfig)
         -- Prompt
         , ("M-C-p", runOrRaisePrompt defaultXPConfig)
         , ("M-S-n", appendFilePrompt defaultXPConfig "/home/scott/notes/notes.txt")
         , ("M-S-t", appendFilePrompt defaultXPConfig "/home/scott/notes/todo.txt")

         -- Restart
         , ("M-q",   spawn myRestart)]
         ++    
         -- Change Xinerama bindings
         [ ("M-"++key, screenWorkspace sc >>= flip whenJust (windows . f))
             | (key, sc) <- zip ["w", "v", "z"] [0..]
             , (f, m) <- [(W.view, 0)]] 
         -- WorkspaceCursors
         -- ++
         --[("M-"++shift++control++[k], f direction depth)
           -- |  (f,shift) <- zip [modifyLayer,shiftModifyLayer] ["","S-"]
           --, (direction,control) <- zip [W.focusUp',W.focusDown'] ["C-",""]
           --, (depth,k) <- zip (reverse [1..focusDepth myCursors]) "kxb"]
               
-- Helper functions
--
-- Avoid changing master on new window creation
avoidMaster :: W.StackSet i l a s sd -> W.StackSet i l a s sd
avoidMaster = W.modify' $ \c -> case c of
    W.Stack t [] (r:rs) -> W.Stack t [r] rs
    otherwise            -> c

-- Kill zombie dzens before normal xmonad restart
myRestart = "for pid in `pgrep dzen2`; do kill -9 $pid; done && xmonad --recompile && xmonad --restart"

-- Grid select stuff
gsconfig = defaultGSConfig { gs_cellheight = 50, gs_cellwidth = 150 }

-- WSCursors stuff
-- myCursors = makeCursors [["wsA", "wsB", "wsC"],["a","b","c"],["x","y"]]

dzen

#!/bin/zsh
#
# dzen2 script - Scott Kidder 2010
#
# Dzen conf
ICONDIR=~/.dzen/dzenIcons
ICONCOL1="#3a0a0d"
ICONCOL2="#780000"
BARFG="#780000"
BARBG="#212121"
SEGCOL="#212121"
SEPCOL="#999999"
# Configuration
DATE_FORMAT='%a, %-m/%-d/%y %I:%M:%S'
GCOUNT=0
GBLINK=0
ACOUNT=0
ABLINK=0
GTX=`cat /sys/class/net/eth0/statistics/tx_bytes`
GRX=`cat /sys/class/net/eth0/statistics/rx_bytes`

INTERVAL=1

DATEIVAL=1
MAILIVAL=30
PMIVAL=180
DISKIVAL=360
SYSIVAL=1
WEATHERIVAL=720
BLINKIVAL=1

# Functions
fdate() { date +$DATE_FORMAT }
fcpu() { awk '{print $1 " " $2 " " $3;}' /proc/loadavg }
fsnapshot() { lscp | tail -n 1 | awk '{print $1;}' }
fmail() { cat .scripts/mail }
fpacman() { pacman -Qu | wc -l }
fmem() { awk '/MemTotal/ {t=$2} /MemFree/ {f=$2} /^Cached/ {c=$2} END {print t-f-c " " t;}' /proc/meminfo | gdbar -h 8 -w 50 -s o -fg $BARFG -bg $BARBG }

fweather() {
    #lynx -dump 'http://api.wunderground.com/weatherstation/WXCurrentObXML.asp?ID=MMIHRT' | grep GMT | awk '{print $10}'
    CUR=$(lynx -dump 'http://api.wunderground.com/weatherstation/WXCurrentObXML.asp?ID=MMIHRT' | grep -A1 GMT|tail -n1|awk '{print $3}')
    LO=$(lynx -dump 'http://forecast.weather.gov/MapClick.php?lat=43.69710&lon=-86.36310&FcstType=dwwl'|grep -A11 Glance|grep Lo|tr -d "[:alpha:], //")
    HI=$(lynx -dump 'http://forecast.weather.gov/MapClick.php?lat=43.69710&lon=-86.36310&FcstType=dwwl'|grep -A9 Glance|grep Hi|tr -d "[:alpha:], //")
    PRECIP=$(lynx -dump 'http://forecast.weather.gov/MapClick.php?lat=43.69710&lon=-86.36310&FcstType=dwwl'|grep -A9 Glance|grep %|tail -n1|tr -d "[:alpha:], //")
    echo "[^fg($ICONCOL2)^i($ICONDIR/temp.xbm)^fg(#) $CUR°] [[^fg(#0077cc)^i($ICONDIR/lo.xbm)^fg(#) $LO°] [^fg(#cc1100)^i($ICONDIR/hi.xbm)^fg(#) $HI°] [^fg(#3399aa)^i($ICONDIR/rain.xbm)^fg(#) $PRECIP]] "
}
# Disk1
fdiskusage1per() { df -h /|tail -n1|awk '{print $5}' }
fdiskusage1bar() {
    df -h /|sed -ne 's/^.* \([0-9]*\)% .*/\1/p'|gdbar -h 8 -w 40 -fg $BARFG -bg $SEGCOL -ss 1 -sw 3 -nonl
}
# Disk2
fdiskusage2per() { df -h /shared|tail -n1|awk '{print $5}' }
fdiskusage2bar() {
    df -h /shared|sed -ne 's/^.* \([0-9]*\)% .*/\1/p'|gdbar -h 8 -w 40 -fg $BARFG -bg $SEGCOL -ss 1 -sw 3 -nonl    
}

# Useless functions
#fnetr() {
#    RXB=`cat /sys/class/net/eth0/statistics/rx_bytes`
#    let X=RXB-GRX
#    GRX=$X
#    let RATE=X/1024
#    echo $RATE
#}

#fnett() {
#    TXB=`cat /sys/class/net/eth0/statistics/tx_bytes`
#    let X=TXB-GTX
#    GTX=$X
#    let RATE=X/1024
#    echo $RATE
#}

#fswap() {
#    awk '/SwapTotal/ {t=$2} /SwapFree/ {f=$2} END {print t-f " " t;}' /proc/meminfo | gdbar -h 8 -w 50 -s o -fg $BARFG -bg $BARBG
#}

#fmail() {
    #pass=$(cat /opt/foobarquuz.txt)
    #wget --secure-protocol=TLSv1 --timeout=3 -t 1 -q -O - https://scott.kidder11:${pass}@mail.google.com/mail/feed/atom --no-check-certificate | grep 'fullcount' | sed -e 's/.*<fullcount>//;s/<\/fullcount>.*//'
#}


DATECOUNTER=$DATEIVAL
MAILCOUNTER=$MAILIVAL
PMCOUNTER=$PMIVAL
DISKCOUNTER=$DISKIVAL
MEMCOUNTER=$SYSIVAL
CPUCOUNTER=$SYSIVAL
SNAPSHOTCOUNTER=$SYSIVAL
NETCOUNTER=$SYSIVAL
WEATHERCOUNTER=$WEATHERIVAL
BLINKCOUNTER=$BLINKIVAL

while true; do
    if [ $DATECOUNTER -ge $DATEIVAL ]; then
        PDATE=$(fdate)
        DATECOUNTER=0
    fi

    if [ $PMCOUNTER -ge $PMIVAL ]; then
        NUM=$(fpacman)
        ACOUNT=$NUM
        PPM="$NUM"
        PMCOUNTER=0
    fi

    if [ $MAILCOUNTER -ge $MAILIVAL ]; then
        COUNT=$(fmail)
        GCOUNT=$COUNT
        blink --c -r $COUNT
        PMAIL=$COUNT
        MAILCOUNTER=0
    fi

    if [ $BLINKCOUNTER -ge $BLINKIVAL ]; then
        if [ $GCOUNT -ne 0 ]; then
            if [ $GBLINK -ne 0 ]; then
                PMICON="^fg($ICONCOL2)^i($ICONDIR/mail.xbm)^fg(#)"
                GBLINK=0
            else
                PMICON="^i($ICONDIR/mail.xbm)"
                GBLINK=1
            fi
        else
            PMICON="^i($ICONDIR/mail.xbm)"
        fi

        if [ $ACOUNT -ne 0 ]; then
            if [ $ABLINK -ne 0 ]; then
                AICON="^fg($ICONCOL2)^i($ICONDIR/arch_10x10.xbm)^fg(#)"
                ABLINK=0
            else
                AICON="^i($ICONDIR/arch_10x10.xbm)"
                ABLINK=1
            fi
        else
            AICON="^fg(#0066bb)^i($ICONDIR/arch_10x10.xbm)^fg(#)"
        fi
        BLINKCOUNTER=0
    fi

    if [ $DISKCOUNTER -ge $DISKIVAL ]; then
        DISK1=$(fdiskusage1bar)
        DISK2=$(fdiskusage2bar)
        PER1=$(fdiskusage1per)
        PER2=$(fdiskusage2per)
        PDISK1="^fg($ICONCOL1)^i($ICONDIR/diskette.xbm)^fg(#) root: $PER1 $DISK1"
        PDISK2="shared: $PER2 $DISK2"
        DISKCOUNTER=0
    fi

    if [ $MEMCOUNTER -ge $SYSIVAL ]; then
        PMEM="^fg($ICONCOL1)^i($ICONDIR/mem.xbm)^fg(#) $(fmem)"
        MEMCOUNTER=0
    fi

    if [ $CPUCOUNTER -ge $SYSIVAL ]; then
        PCPU="^fg($ICONCOL1)^i($ICONDIR/cpu.xbm)^fg(#) $(fcpu)"
        CPUCOUNTER=0
    fi

    if [ $SNAPSHOTCOUNTER -ge $SYSIVAL ]; then
        PSSHOT="^fg($SEPCOL)^i($ICONDIR/check.xbm)^fg(#) $(fsnapshot)"
        SNAPSHOTCOUNTER=0
    fi

    if [ $WEATHERCOUNTER -ge $WEATHERIVAL ]; then
        PWEATHER=$(fweather)
        WEATHERCOUNTER=0
    fi

    SEP=^fg($ICONCOL1)^i($ICONDIR/ac.xbm)^fg(#)
    print "$PWEATHER [$PMICON $PMAIL $AICON $PPM] [$PSSHOT] [$PCPU] $PMEM $PDISK1 $PDISK2 $SEP $PDATE"

    DATECOUNTER=$((DATECOUNTER+1))
    MAILCOUNTER=$((MAILCOUNTER+1))
    PMCOUNTER=$((PMCOUNTER+1))
    DISKCOUNTER=$((DISKCOUNTER+1))
    MEMCOUNTER=$((MEMCOUNTER+1))
    CPUCOUNTER=$((CPUCOUNTER+1))
    SNAPSHOTCOUNTER=$((SNAPSHOTCOUNTER+1))
    NETCOUNTER=$((NETCOUNTER+1))
    WEATHERCOUNTER=$((WEATHERCOUNTER+1))
    BLINKCOUNTER=$((BLINKCOUNTER+1))


    sleep $INTERVAL
done

zsh.rc

# Created by Scott for 4.3.10

#---------------------------------------
# Variables
#---------------------------------------
export EDITOR="vim"
export PAGER="vimpager"
export PDF="epdfview"
export BROWSER="firefox"
export VIDEO="vlc"
export MPD_HOST="archlinux"
export PATH=$PATH:~/.cabal/bin/:~/.scripts/

#---------------------------------------
# History stuff
#---------------------------------------
HISTSIZE=1000
SAVEHIST=1000
HISTFILE=~/.history
setopt APPEND_HISTORY
setopt INC_APPEND_HISTORY
setopt SHARE_HISTORY

#---------------------------------------
# Comp stuff
#---------------------------------------
zmodload zsh/complist
autoload -U compinit
compinit
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.zsh/cache
zstyle ':completion:*' completer _complete _match _approximate
zstyle ':completion:*:match:*' original only
zstyle ':completion:*:approximate:*' \
        max-errors 'reply=($((($#PREFIX+$#SUFFIX)/3))numeric)' 
zstyle ':completion:*:functions' ignored-patterns '_*'
zstyle ':completion:*:*:kill:*' menu yes select
zstyle ':completion:*:kill:*' force-list always 
zstyle ':completion:*' squeeze-slashes true 

#---------------------------------------
# Prompt 
#---------------------------------------
autoload -U promptinit
promptinit
PROMPT='%F{red}%B%K{red}█▓▒░%F{white}%K{red}%B%n@%m%b%F{red}%K{black}█▓▒░%F{white}%K{black}%B%~%b%f%k %B%F{red}>%b%f%F{red}>%f%F{white}>%f '

RPROMPT='%B%F{red}[%* on %D]'
#---------------------------------------
# Keybindings
#---------------------------------------
bindkey -v

#---------------------------------------
# zsh things
#---------------------------------------
setopt NOBGNICE
setopt NO_BEEP
setopt AUTO_CD
setopt CORRECT
setopt AUTO_LIST
setopt COMPLETE_IN_WORD
setopt ALWAYS_TO_END

#---------------------------------------
# Aliases
#---------------------------------------
#---------------------------------------
# Auto extensions
#---------------------------------------
alias -s pl=$EDITOR
alias -s txt=$EDITOR
alias -s cpp=$EDITOR
alias -s c=$EDITOR
alias -s pdf=$PDF
alias -s java=$EDITOR
alias -s html=$BROWSER
alias -s htm=$BROWSER
alias -s avi=$VIDEO
alias -s mp3=$VIDEO
alias -s doc=soffice
alias -s gz=tar -xzvf
alias -s bz2=tar -xjvf
alias -s jpeg=feh
alias -s jpg=feh
alias -s png=feh
alias -s gif=feh

#---------------------------------------
# Regular Aliases
#---------------------------------------
alias ls='ls --color=auto -F'
alias ll='ls --color=auto -la'
alias pp='sudo powerpill'
alias pps='sudo powerpill -S'
alias ppss='sudo powerpill -Ss'
alias ppsy='sudo powerpill -S --noconfirm'
alias ppu='sudo powerpill -Su --noconfirm && notify-send "System Upgrade Done!" && echo -e "\a"'
alias logisim='java -jar ~/logisim/.logisim'
alias h='history'
alias bp='echo -e "\a"'
alias cabal='nocorrect cabal'
alias sr='.scripts/snapshotRecover'
alias ec='vim ~/.xmonad/xmonad.hs'
alias es='vim ~/.dzen/script.zsh'
alias todo='vim ~/notes/todo.txt'


#---------------------------------------
# Special
#---------------------------------------
alias -g L='|less'

Last edited by Inxsible (2010-11-07 04:54:21)


archlinux|xmonad
++++++++++[>++++++++>+++++++>+++<<<-]>+++.>---.<----.+++++..>>++.<++++++++.--.-----..+.<--.

Offline

#15 2010-05-10 16:28:38

Paul-S
Member
From: Wales
Registered: 2008-02-04
Posts: 353

Re: Share your xmonad desktop!

Looking good ScottKidder

Cheers
Paul-S

Offline

#16 2010-05-15 19:03:00

Nepherte
Member
From: Singapore
Registered: 2008-09-09
Posts: 427
Website

Re: Share your xmonad desktop!

My current XMonad setup:
desktop_march_2010_1.jpg desktop_march_2010_2.jpg

xmonad.hs:

-- Import statements
import XMonad

import XMonad.Operations

import System.IO
import System.Exit

import Control.Monad (liftM2)

import XMonad.Config.Gnome

import XMonad.Util.Run

import XMonad.Actions.CycleWS
import XMonad.Actions.GridSelect

import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.SetWMName
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.UrgencyHook
import XMonad.Hooks.FadeInactive

import XMonad.Layout.NoBorders (smartBorders, noBorders)
import XMonad.Layout.PerWorkspace (onWorkspace)
import XMonad.Layout.Reflect (reflectHoriz)
import XMonad.Layout.IM
import XMonad.Layout.Spacing
import XMonad.Layout.Tabbed

import qualified XMonad.StackSet as W
import qualified Data.Map as M

-- Define terminal
myTerminal      = "urxvtc"

-- Define window focus color
myFocusedBorderColor = "#77a8bf"

-- Define amount and names of workspaces
myWorkspaces    = ["main","web","chat","media","graph","browse","dev","mail"]

-- default tiling algorithm partitions the screen into two panes
tiled  x  = spacing 10 $ Tall nmaster delta ratio
    where
        -- The default number of windows in the master pane
        nmaster = x

        -- Default proportion of screen occupied by master pane
        ratio   = 1/2

        -- Percent of screen to increment by when resizing panes
        delta   = 3/100

-- Define default layouts used on most workspaces
defaultLayouts  = (tiled 1) ||| Mirror (tiled 1) ||| fullLayout 

-- Define layout for specific workspaces
fullLayout     = noBorders $ Full
graphLayout    = withIM (0.11) (Role "gimp-toolbox") $ reflectHoriz $ withIM (0.15) (Role "gimp-dock") Full
imLayout       = reflectHoriz $ withIM (1/3) (Role "main") (Mirror (tiled 2))

-- Put all layouts together
myLayout        = avoidStruts $ onWorkspace "web" fullLayout $ onWorkspace "chat" imLayout $ onWorkspace "media" fullLayout $ onWorkspace "graph" graphLayout $ onWorkspace "mail" fullLayout $ defaultLayouts

-- Define keys to add
keysToAdd x     = [ -- Gnome run dialog
                       ((modMask x, xK_F2), spawn "/home/bart/.run/run.py --interface=full")
                    -- Gnome close window
                    ,  ((modMask x, xK_F4), kill)
                    -- Shift to previous workspace
                    ,  (((modMask x .|. controlMask), xK_Left), prevWS)
                    -- Shift to next workspace
                    ,  (((modMask x .|. controlMask), xK_Right), nextWS)
                    -- Shift window to previous workspace
                    ,  (((modMask x .|. shiftMask), xK_Left), shiftToPrev)
                    -- Shift window to next workspace
                    ,  (((modMask x .|. shiftMask), xK_Right), shiftToNext)
                    -- Grid select applications
                    ,  ((controlMask, xK_space), goToSelected defaultGSConfig)
                    -- Decrease volume
                    ,  ((controlMask, xK_KP_Subtract), spawn "amixer -Dpulse set Master 2%-")
                    -- Increase volume
                    ,  ((controlMask, xK_KP_Add), spawn "amixer -Dpulse set Master 2%+")
                    -- Play/pause mpd
                    ,  ((controlMask, xK_p), spawn "ncmpcpp toggle")
                    -- Play next song in mpd
                    ,  ((controlMask, xK_Right), spawn "ncmpcpp next")
                    -- Play previous song in mpd
                    ,  ((controlMask, xK_Left), spawn "ncmpcpp prev")
                    -- Lock screen with gnome screensaver
                    ,  (((modMask x .|. controlMask), xK_l), spawn "i3lock -d")
                    -- Turn off screen
                    ,  ((controlMask, xK_b), spawn "xset dpms force off")
                    -- Increase master pane count
                    , ((modMask x, xK_KP_Add), sendMessage (IncMasterN 1))
                    -- Decrease master pane count
                    , ((modMask x, xK_KP_Subtract), sendMessage (IncMasterN (-1)))
                    -- Quit xmonad
                    , ((modMask x .|. shiftMask, xK_q), io (exitWith ExitSuccess))
                  ]
                  ++
                  [
                    -- Focus workspace with Ctrl + F1..F8, Shift window to workspace with Ctrl + Shift + F1..F8
                    (  (m .|. controlMask, k), windows $ f i)
                       | (i, k) <- zip (myWorkspaces) [xK_F1 .. xK_F8]
                       , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]
                  ]


-- Define keys to remove
keysToRemove x  = [ -- Old run dialog binding
                       (modMask x , xK_p)
                    -- Old close window binding
                    ,  (modMask x, xK_c)
                    -- Unused gmrun binding
                    ,  (modMask x .|. shiftMask, xK_p)
                    -- Unused gnome session logout dialog
                    ,  (modMask x .|. shiftMask, xK_q)
                    -- Unused increase master pane count
                    ,  (modMask x, xK_comma)
                    -- Unused decrease master pane count
                    ,  (modMask x, xK_period)
                  ]
                  ++
                  [
                       (shiftMask .|. modMask x, k) | k <- [xK_1 .. xK_9]
                  ]
                  ++
                  [
                       ( modMask x, k) | k <- [xK_1 .. xK_9]
                  ]

-- Merge keys to add and existing keys
newKeys x       = M.union (keys gnomeConfig x) (M.fromList (keysToAdd x))

-- Delete the keys to remove from existing keys
myKeys x        = foldr M.delete (newKeys x) (keysToRemove x)

-- Define the workspace an application has to go to
myManageHook    = composeAll . concat $
                  [ 
                    -- The applications that go to web
                    [ className =? b --> viewShift "web"    | b <- myClassWebShifts]
                    -- The applications that go to chat
                  , [ className =? c --> viewShift "chat"   | c <- myClassChatShifts]
                    -- The applications that go to media
                  , [ className =? d --> viewShift "media"  | d <- myClassMediaShifts]
                    -- The applications that go the graph
                  , [ className =? e --> viewShift "graph"  | e <- myClassGraphShifts]
                    -- The applications that go to browse
                  , [ className =? f --> viewShift "browse" | f <- myClassBrowseShifts]
                    -- The applications that go to dev
                  , [ className =? g --> viewShift "dev"    | g <- myClassDevShifts]
                  , [ title     =? k --> viewShift "dev"    | k <- myTitleDevShifts]
                    -- The applications that go to mail
                  , [ className =? h --> viewShift "mail"   | h <- myClassMailShifts]
                    -- The applications that float
                  , [ className =? i --> doFloat            | i <- myClassFloats]
                  , [ title     =? j --> doFloat            | j <- myTitleFloats]
                  ]
                  where
                        viewShift           = doF . liftM2 (.) W.greedyView W.shift
                        myClassWebShifts    = ["Firefox","Filezilla","Uzbl-core"]
                        myClassChatShifts   = ["emesene"]
                        myClassMediaShifts  = ["MPlayer"]
                        myClassGraphShifts  = ["Gimp", "feh"]
                        myClassBrowseShifts = ["Nautilus","File-roller"]
                        myClassDevShifts    = ["Eclipse","."]
                        myTitleDevShifts    = ["MATLAB","MATLAB  7.6.0 (R2008a)"]
                        myClassMailShifts   = ["Thunderbird"]
                        myClassFloats       = ["feh","Dialog",".","File-roller"]
                        myTitleFloats       = ["MATLAB","Run Command"]

myWorkspaceBar = "dzen2 -x '0' -y '0' -h '24' -w '970' -ta 'l' -fg '#FFFFFF' -bg '#161616' -fn '-*-bitstream vera sans-medium-r-normal-*-11-*-*-*-*-*-*-*'"
myStatusBar = "conky -c .conkyrc_console | dzen2 -x '970' -y '0' -h '24' -w '850' -ta 'r' -fg '#77a8bf' -bg '#161616' -fn '-*-bitstream vera sans-medium-r-normal-*-11-*-*-*-*-*-*-*'"
conkyMpdBar = "conky -c .conkyrc_mpd | dzen2 -x '0' -y '1176' -h '24' -w '960' -ta 'l' -fg '#77a8bf' -bg '#161616' -fn '-*-bitstream vera sans-medium-r-normal-*-11-*-*-*-*-*-*-*'"
conkyTimeBar = "conky -c .conkyrc_date | dzen2 -x '960' -y '1176' -h '24' -w '960' -ta 'r' -fg '#FFFFFF' -bg '#161616' -fn '-*-bitstream vera sans-medium-r-normal-*-11-*-*-*-*-*-*-*'"

myLogHook :: Handle -> X ()
myLogHook h = dynamicLogWithPP $ dzenPP
    {
        ppCurrent           =   dzenColor "#ebac54" "#161616" . pad 
      , ppVisible           =   dzenColor "white" "#161616" . pad
      , ppHidden            =   dzenColor "white" "#161616" . pad
      , ppHiddenNoWindows   =   dzenColor "#444444" "#161616" . pad 
      , ppUrgent            =   dzenColor "#ff0000" "#161616" . dzenStrip
      , ppWsSep             =   " "
      , ppSep               =   "  |  "
      , ppLayout            =   dzenColor "#77a8bf" "#161616" . 
                                (\x -> case x of
                                        "Spacing 10 Tall"         ->      "Tall"
                                        "Spacing 10 Full"         ->      "Full"
                                        "Mirror Spacing 10 Tall"  ->      "Mirror Tall"
                                        "IM ReflectX IM Full"     ->      "IM"
                                        "ReflectX IM Mirror Spacing 10 Tall" ->  "IM"
                                        _                         ->      x
                                )
      , ppTitle             =   (" " ++) . dzenColor "white" "#161616" . dzenEscape
      , ppOutput            =   hPutStrLn h
    }

main = do
    workspaceBar <- spawnPipe myWorkspaceBar
    statusBar <- spawnPipe myStatusBar
    conkyMpd <- spawnPipe conkyMpdBar
    conkyTime <- spawnPipe conkyTimeBar
    terminal1 <- spawn myTerminal
    terminal2 <- spawn myTerminal
    terminal3 <- spawn myTerminal
    terminal4 <- spawn myTerminal
    xmonad $ ewmh $ withUrgencyHook NoUrgencyHook $ defaultConfig {
        terminal            = myTerminal
      , focusedBorderColor  = myFocusedBorderColor
      , workspaces          = myWorkspaces
      , keys                = myKeys
      , layoutHook          = myLayout
      , manageHook          = manageDocks <+> myManageHook
      , logHook             = myLogHook workspaceBar  >> setWMName "LG3D"
}

Offline

#17 2010-08-29 22:24:18

gtklocker
Member
Registered: 2009-09-01
Posts: 462

Re: Share your xmonad desktop!

Can someone help me with xmobar?
It hides when a window opens.

.xmobarrc:

Config { font = "-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*"
       , bgColor = "black"
       , fgColor = "grey"
       , position = Top
       , commands = [ Run Network "eth0" ["-L","0","-H","32","--normal","green","--high","red"] 10
                    , Run Cpu ["-L","3","-H","50","--normal","green","--high","red"] 10
                    , Run Memory ["-t","Mem: <usedratio>%"] 10
                    , Run Swap [] 10
                    , Run Com "uname" ["-s","-r"] "" 36000
                    , Run Date "%a %b %_d %Y %H:%M" "date" 10
                    ]
       , sepChar = "%"
       , alignSep = "}{"
       , template = "%cpu% | %memory% * %swap% | %eth0% }{ <fc=#ee9a00>%date%</fc> | %uname%"
       }

Offline

#18 2010-08-30 02:32:49

dsdeiz
Member
Registered: 2009-08-17
Posts: 69

Re: Share your xmonad desktop!

Not entirely sure but I think it has something to do with avoidStruts if windows overlap... big_smile

Offline

#19 2010-08-30 18:30:05

dagle
Member
Registered: 2009-01-04
Posts: 13

Re: Share your xmonad desktop!

tNWUwcQ
xmonad.hs:

{-# OPTIONS_GHC -W -fno-warn-missing-signatures #-}
{-# LANGUAGE DeriveDataTypeable, GeneralizedNewtypeDeriving, NoMonomorphismRestriction, FlexibleInstances, PatternGuards #-}
import XMonad
import qualified XMonad.StackSet as W
import qualified Data.Map as M
import qualified XMonad.Util.ExtensibleState as XS
 
import Control.Monad.Instances ()
import System
import XMonad.Layout.IndependentScreens
import XMonad.Util.WorkspaceCompare
import XMonad.Layout.Tabbed
 
-- Update these with:  ghc -ddump-minimal-imports
import Data.Function
import Data.List
import Data.Maybe
import System.IO
import XMonad.Actions.DwmPromote
import XMonad.Actions.Search
import XMonad.Actions.SpawnOn
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.EwmhDesktops(ewmh)
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.UrgencyHook
import XMonad.Layout.NoBorders
import XMonad.Layout.PerWorkspace
import XMonad.Layout.Tabbed
import XMonad.Prompt.XMonad
import XMonad.Util.Run
import XMonad.Util.StringProp(setStringProp, getStringProp)
import XMonad.Util.EZConfig
import XMonad.Util.Replace (replace)
 
import XMonad.Layout.SimplestFloat
 
import Data.List
import Control.Monad
import Control.Monad.Writer
 
import XMonad.Layout.SimplestFloat
 
import Data.Maybe
 
import System.Process
 
import XMonad.Util.Paste
import XMonad.Layout.WorkspaceDir
import XMonad.Prompt.Directory
import XMonad.Prompt

import XMonad.Util.NamedWindows
import Codec.Binary.UTF8.String

main :: IO ()
main = do
    hLeft <- spawnPipe "xmobar"
    hRight <- spawnPipe "xmobar -x 1 ~/.xmobarrc2"
    xmonad $ withUrgencyHook NoUrgencyHook $ defaultConfig {
        keys = myKeys
        , layoutHook = myLayout
        , focusFollowsMouse = False
        , normalBorderColor  = "#cccccc"
        , focusedBorderColor = "#cd8b00"
    --, startupHook = do
        , terminal = "urxvt"
        , modMask = mod1Mask
        , logHook = do 
                        winset <- gets windowset
                        let log screen handle mypp= dynamicLogWithPP . marshallPP screen . mypp $ handle
                            in if getSid winset == 0 then log 0 hLeft pp1 >> visible 1 hRight pp2 else visible 0 hLeft pp1 >> log 1 hRight pp2
        , workspaces = withScreens 2 $ map (show) [1..9]
        , manageHook = manageDocks <+> myManageHook
    } 


myManageHook = composeAll . concat $
    [ [ className =? "Namoroka" --> doShift (marshall 0 "2") ]
     ,[ className =? "Vimprobable2" --> doShift (marshall 0 "2") ]
    ]

getSid = W.screen . W.current

visible screen handle mypp= dynamicLogVisiblePP . marshallPP screen . mypp $ handle

-------------------- Layout ----------------------------------
myLayout = workspaceDir "~" $ avoidStruts ( tall ||| Mirror tall ||| simplestFloat ||| tabbed shrinkText defaultTheme )
                 where  tall = Tall 1 (3/100) (1/2)
--------------------------------------------------------------

{- Ugly hack section!!! -}
-- only works with 2 screens atm
depa s = head $ W.visible s
peek = with Nothing (return . W.focus)
with dflt f = maybe dflt f . W.stack . W.workspace . depa
currentlog screen pp handle = dynamicLogWithPP . marshallPP screen . pp $ handle

sepBy :: String   -- ^ separator
      -> [String] -- ^ fields to output
      -> String
sepBy sep = concat . intersperse sep . filter (not . null)

dynamicLogVisiblePP :: PP -> X ()
dynamicLogVisiblePP pp =  dynamicLogVisibleString pp >>= io . ppOutput pp

dynamicLogVisibleString :: PP -> X String
dynamicLogVisibleString pp = do
    winset <- gets windowset
    urgents <- readUrgents
    sort' <- ppSort pp

    let ld = description . W.layout . W.workspace . depa $ winset
    
    let ws = pprWindowSet sort' urgents pp winset
    
    wt <- maybe (return "") (fmap show . getName) . peek $ winset

    extras <- mapM (flip catchX (return Nothing)) $ ppExtras pp

    return $ encodeString . sepBy (ppSep pp) . ppOrder pp $
                        [ ws
                        , ppLayout pp ld
                        , ppTitle  pp wt
                        ]
                        ++ catMaybes extras


replace' :: [(String, String)] -> String -> String
replace' [] virt = virt
replace' (x:xs) virt 
    | virt == fst x = snd x
    | otherwise = replace' xs virt

swap1 = [("1", "std"), ("2", "www")]
swap2 = [("1", "irc")]

-- multiple configuration files, which gets messy
pp1 h = sjanssenPP { 
    ppLayout = xmobarColor "orange" "" 
    , ppCurrent         = wrap "[" "]" . replace' swap1
    , ppVisible         = wrap "[" "]" . replace' swap1
    , ppHidden          = id . replace' swap1
    , ppHiddenNoWindows = xmobarColor "Gray20" "" . replace' swap1
    , ppUrgent          = xmobarColor "Red" "" . replace' swap1
    , ppOutput = hPutStrLn h
    , ppSort            = getSortByIndex
    }

pp2 h = sjanssenPP { 
    ppLayout = xmobarColor "orange" "" 
    , ppCurrent         = wrap "[" "]" . replace' swap2
    , ppVisible         = wrap "[" "]" . replace' swap2
    , ppHidden          = id . replace' swap2
    , ppHiddenNoWindows = xmobarColor "Gray20" "" . replace' swap2
    , ppUrgent          = xmobarColor "Red" "" . replace' swap2
    , ppOutput = hPutStrLn h
    , ppSort            = getSortByIndex
    }

myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
    [ ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
    , ((modm,               xK_p     ), spawn "exe=`dmenu_path | dmenu` && eval \"exec $exe\"")
    , ((modm,               xK_a     ), spawn "mpc pause")
    , ((modm,               xK_o     ), spawn "mpc play")
    , ((modm,               xK_e     ), spawn "mpc prev")
    , ((modm,               xK_u     ), spawn "mpc next")
    , ((modm              , xK_b     ), sendMessage ToggleStruts)
    , ((modm ,                 xK_d     ), changeDir defaultXPConfig)
    , ((modm .|. shiftMask, xK_c     ), kill)
    , ((modm,               xK_space ), sendMessage NextLayout)
    , ((modm,               xK_j     ), windows W.focusDown)
    , ((modm,               xK_k     ), windows W.focusUp  )
    , ((modm,               xK_Return), windows W.swapMaster)
    , ((modm .|. shiftMask, xK_j     ), windows W.swapDown  )
    , ((modm .|. shiftMask, xK_k     ), windows W.swapUp    )
    , ((modm,               xK_h     ), sendMessage Shrink)
    , ((modm,               xK_l     ), sendMessage Expand)
    , ((modm,               xK_t     ), withFocused $ windows . W.sink)
    , ((modm              , xK_comma ), sendMessage (IncMasterN 1))
    , ((modm              , xK_period), sendMessage (IncMasterN (-1)))
    , ((modm .|. shiftMask, xK_q     ), io (exitWith ExitSuccess))
    , ((modm              , xK_q     ), spawn "xmonad --recompile; xmonad --restart")
    ]
    ++
--    [((m .|. modm, k), windows $ f i)
--        | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
--        , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]

    [((m .|. modm, k), windows $ onCurrentScreen f i)
       | (i, k) <- zip (workspaces' conf) [xK_1 .. xK_9]
        , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]

   ++
    [((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
        | (key, sc) <- zip [xK_aring, xK_adiaeresis, xK_r] [0..]
        , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]

The code is currently a bit hacky. The biggest hack is to make the logging to work like the statusbar in dwm. (9 workspaces on each screen and both are logged induvidual)
Individual statusbars with induvidual logging. Only works with 2 screen atm, so I will need to rewrite everything I was to upload it some day.

Offline

#20 2010-09-25 10:13:25

b52
Member
From: Germany
Registered: 2009-03-20
Posts: 49
Website

Re: Share your xmonad desktop!

Here is mine
thumb.png
Another shot http://reaktor42.de/~b52/s/2010-09-02-0 … _scrot.png

Setup can be found here


srsly?

Offline

#21 2010-09-25 10:40:45

Stalafin
Member
From: Berlin, Germany
Registered: 2007-10-26
Posts: 617

Re: Share your xmonad desktop!

Pretty, I like it! :-) I like your dzen... I am still running Xmobar, never got my hands on getting dzen to run. Seems like such a hassle. :-P

Offline

#22 2010-10-11 20:24:41

ScottKidder
Member
Registered: 2008-10-27
Posts: 23

Re: Share your xmonad desktop!

Here's my latest:

--MOD EDIT : - Follow posting rules and size regulations for screenshots. Consider yourself warned -- Inxsible.

FULLSCREEN

http://github.com/scottkidder/dotfiles

Last edited by Inxsible (2010-11-07 04:53:16)


archlinux|xmonad
++++++++++[>++++++++>+++++++>+++<<<-]>+++.>---.<----.+++++..>>++.<++++++++.--.-----..+.<--.

Offline

#23 2010-12-15 12:21:24

moljac024
Member
From: Serbia
Registered: 2008-01-29
Posts: 2,676

Re: Share your xmonad desktop!

tNmtuMg

Gnome/XMonad - the red circle on the panel is a button that closes the currently focused window, a neat trick possible with XMonad.Hooks.ServerMode wink

xmonad.hs:

import Control.OldException(catchDyn,try)
import Control.Concurrent
import DBus
import DBus.Connection
import DBus.Message
import System.Cmd
import System.Exit
import XMonad
import XMonad.ManageHook
import XMonad.Prompt
import XMonad.Config.Gnome
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.SetWMName
import XMonad.Hooks.UrgencyHook
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.ServerMode
import XMonad.Util.Run
import XMonad.Util.EZConfig
import XMonad.Util.Replace
import XMonad.Actions.CycleWS
import XMonad.Actions.UpdatePointer
import XMonad.Actions.WindowBringer
import XMonad.Actions.Commands
import XMonad.Actions.GridSelect
import XMonad.Actions.FloatKeys
import XMonad.Layout.LayoutHints
import XMonad.Layout.NoBorders
import XMonad.Layout.Maximize
import XMonad.Layout.Grid
import XMonad.Layout.TwoPane
import XMonad.Layout.SimplestFloat
import XMonad.Layout.CenteredMaster
import XMonad.Layout.MagicFocus

import qualified XMonad.StackSet as W
import qualified Data.Map        as M

main = withConnection Session $ \ dbus -> do
  getWellKnownName dbus
  replace
  xmonad $ withUrgencyHook NoUrgencyHook
         $ gnomeConfig {
           normalBorderColor  = "#000000",
           -- focusedBorderColor = "#ffffff",
           focusedBorderColor = "#8BAFDB",
           modMask            = mod4Mask,
           terminal           = "gnome-terminal --profile=XMonad",
           borderWidth        = 1,
           focusFollowsMouse  = False,
           keys               = myKeys,
           mouseBindings      = myMouseBindings,
           manageHook         = manageHook gnomeConfig <+> composeAll managementHooks <+> manageDocks,
           logHook            = updatePointer (Relative 0 0) >> dynamicLogWithPP (myPrettyPrinter dbus),
           startupHook        = startupHook gnomeConfig >> setWMName "LG3D",
           layoutHook         = myLayout,
           handleEventHook    = serverModeEventHook
           }

-- -----------------------------------------------------------------------------

myLayout =  avoidStruts $ smartBorders $ layoutHintsWithPlacement (0.5, 0.5) 
            $ maximize ( simplestFloat ||| TwoPane (3/100) (1/2) ||| tiled ||| Mirror tiled ||| Grid ||| Full )
  where
    -- default tiling algorithm partitions the screen into two panes
    tiled   = Tall nmaster delta ratio
 
    -- The default number of windows in the master pane
    nmaster = 1
 
    -- Default proportion of screen occupied by master pane
    ratio   = 1/2
 
    -- Percent of screen to increment by when resizing panes
    delta   = 3/100
 
------------------------------------------------------------------------

myPrettyPrinter :: Connection -> PP
myPrettyPrinter dbus = defaultPP {
    ppOutput  = outputThroughDBus dbus
  , ppUrgent  = pangoColor "#ff0000" . wrap "" "!" . pangoSanitize
  , ppTitle   = pangoColor "#003366" . shorten 50 . pangoSanitize
  , ppCurrent = pangoColor "#006666" . wrap "[" "]" . pangoSanitize
  , ppVisible = pangoColor "#663366" . wrap "(" ")" . pangoSanitize
  , ppSep     = " | "
  , ppWsSep   = ""
  , ppHidden  = wrap " " " "
  , ppLayout  = pangoColor "black" .
                (\x -> case x of
                    "Hinted Maximize SimplestFloat"   -> "Float"
                    "Hinted Maximize TwoPane"         -> "TwoPane"
                    "Hinted Maximize Tall"            -> "Tall"
                    "Hinted Maximize Mirror Tall"     -> "Wide"
                    "Hinted Maximize Full"            -> "Full"
                    "Hinted Maximize Grid"            -> "Grid"
                    _                                 -> x
                )
  }

managementHooks :: [ManageHook]
managementHooks = [
    resource        =? "Do"                          --> doIgnore
    , resource      =? "desktop_window"              --> doIgnore
    , resource      =? "kdesktop"                    --> doIgnore
    , className     =? "MPlayer"                     --> doFloat
    , className     =? "Gimp"                        --> doFloat
    , className     =? "VirtualBox"                  --> doFloat
    , className     =? "Xmessage"                    --> doCenterFloat      
    , className     =? "term-htop"                   --> doCenterFloat
    , isFullscreen                                   --> doFullFloat
  ]

------------------------------------------------------------------------
-- Key bindings. Add, modify or remove key bindings here.
--
myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
 
    -- launch a terminal
    [ ((modm,               xK_Return), spawn $ XMonad.terminal conf)
 
    -- launch dmenu
    --, ((modm,               xK_p     ), spawn "exe=`dmenu_path | dmenu` && eval \"exec $exe\"")
    , ((mod1Mask,           xK_F2    ), spawn "custom-run")

    -- launch gmrun
    --, ((modm .|. shiftMask, xK_p     ), spawn "gmrun")
 
    -- close focused window
    , ((modm .|. shiftMask, xK_c     ), kill)
 
    -- close focused window
    , ((mod1Mask,           xK_F4    ), kill)
 
     -- Rotate through the available layout algorithms
    , ((modm,               xK_space ), sendMessage NextLayout)
 
    --  Reset the layouts on the current workspace to default
    , ((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
 
    -- Resize viewed windows to the correct size
    , ((modm,               xK_n     ), refresh)
 
    -- Move focus to the next window
    , ((mod1Mask,           xK_Tab   ), windows W.focusDown)
 
    -- Move focus to the next window
    , ((modm,               xK_j     ), windows W.focusDown)
 
    -- Move focus to the previous window
    , ((modm,               xK_k     ), windows W.focusUp  )
    , ((mod1Mask .|. shiftMask, xK_Tab     ), windows W.focusUp  )

    -- Move focus to the master window
    , ((modm,               xK_m     ), windows W.focusMaster  )
 
    -- Swap the focused window and the master window
    , ((modm .|. shiftMask, xK_Return), windows W.swapMaster)
 
    -- Swap the focused window with the next window
    , ((modm,                xK_j     ), windows W.swapDown  )

    -- Swap the focused window with the previous window
    , ((modm,                xK_k     ), windows W.swapUp    )

    -- Shrink the master area
    --, ((modm,               xK_h     ), sendMessage Shrink)
    , ((modm .|. shiftMask, xK_j     ), sendMessage Shrink)

    -- Expand the master area
    --, ((modm,               xK_l     ), sendMessage Expand)
    , ((modm .|. shiftMask, xK_k     ), sendMessage Expand)
 
    -- Push window back into tiling
    , ((modm,               xK_t     ), withFocused $ windows . W.sink)
 
    -- Increment the number of windows in the master area
    , ((modm              , xK_comma ), sendMessage (IncMasterN 1))
 
    -- Deincrement the number of windows in the master area
    , ((modm              , xK_period), sendMessage (IncMasterN (-1)))
 
    -- Toggle the status bar gap
    -- Use this binding with avoidStruts from Hooks.ManageDocks.
    -- See also the statusBar function from Hooks.DynamicLog.
    --
    -- , ((modm              , xK_b     ), sendMessage ToggleStruts)
 
    -- Quit xmonad
    --, ((modm .|. shiftMask, xK_q     ), io (exitWith ExitSuccess))
    , ((modm .|. shiftMask, xK_q     ), spawn "gnome-session-save --logout")
 
    -- Restart xmonad
    , ((modm              , xK_BackSpace     ), spawn "xmonad --recompile; xmonad --restart")
      
    -- Extra WM actions          
    , ((mod1Mask,           xK_Escape  ), withFocused (sendMessage . maximizeRestore))
    -- , ((modm,               xK_Left    ), prevWS)
    -- , ((modm,               xK_Right   ), nextWS)
    , ((modm,               xK_Left    ), withFocused (keysMoveWindow (-10, 0)))
    , ((modm,               xK_Right   ), withFocused (keysMoveWindow (10, 0)))
    , ((modm,               xK_Up      ), withFocused (keysMoveWindow (0, -10)))
    , ((modm,               xK_Down    ), withFocused (keysMoveWindow (0, 10)))
    , ((modm .|. shiftMask, xK_Left    ), shiftToPrev)
    , ((modm .|. shiftMask, xK_Right   ), shiftToNext)
    , ((modm,               xK_Tab     ), toggleWS)
    , ((modm,               xK_w       ), gotoMenu)
    , ((modm,               xK_e       ), goToSelected defaultGSConfig)
      
    -- Launching applications
    , ((modm,                 xK_r     ), spawn "bashwall -sr")
    , ((modm,                 xK_f     ), spawn "gnome-open ~/")
    , ((modm,                 xK_s     ), spawn "toggle-htop")
    , ((modm,                 xK_m     ), spawnSelected defaultGSConfig ["mpd-Play-Pause", "mpd-Stop", "mpd-Next", "mpd-Prev"])
    , ((modm .|. shiftMask,   xK_e     ), spawn "emacsclient -c")
    , ((modm .|. shiftMask,   xK_w     ), spawn "gnome-appearance-properties -p background")
    , ((modm .|. shiftMask,   xK_F4    ), spawn "xkill")
    , ((modm .|. controlMask, xK_F4    ), spawn "xkill")
    --, ((mod1Mask,             xK_F1    ), spawn "gnome-panel-control --main-menu")
    , ((0,                    xK_Print ), spawn "custom-screenshot")

    ]
    ++
 
    --
    -- mod-[1..9], Switch to workspace N
    --
    -- mod-[1..9], Switch to workspace N
    -- mod-shift-[1..9], Move client to workspace N
    --
    [((m .|. modm, k), windows $ f i)
        | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
        , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
    ++
 
    --
    -- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3
    -- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3
    --
    [((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
        | (key, sc) <- zip [xK_F1, xK_F2, xK_F3] [0..]
        , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]

------------------------------------------------------------------------
-- Mouse bindings: default actions bound to mouse events
--
myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $
 
    -- mod-button1, Set the window to floating mode and move by dragging
    [ ((modm, button1), (\w -> focus w >> mouseMoveWindow w
                                       >> windows W.shiftMaster))
 
    -- mod-button2, Raise the window to the top of the stack
    , ((modm, button2), (\w -> focus w >> windows W.shiftMaster))
 
    -- mod-button3, Set the window to floating mode and resize by dragging
    , ((modm, button3), (\w -> focus w >> mouseResizeWindow w
                                       >> windows W.shiftMaster))
 
    -- you may also bind events to the mouse scroll wheel (button4 and button5)
    ]
 

------------------------------------------------------------------------
-- My Functions

-- gridSelectMusic = do 
--   selected <- gridselect defaultGSConfig [("Play/Pause", "a"), ("Next", "a"), ("Previous", "a"), ("Stop", "a") ]
--   case selected of
--     "Play/Pause"  -> spawn "mpc toggle"
--     "Next"        -> spawn "mpc next"
--     "Previous"    -> spawn "mpc prev"
--     "Stop"        -> spawn "mpc stop"
--     _             -> putStrLn "Uknown action - gridSelectMusic"

------------------------------------------------------------------------
-- Boring DBus stuff

-- This retry is really awkward, but sometimes DBus won't let us get our
-- name unless we retry a couple times.
getWellKnownName :: Connection -> IO ()
getWellKnownName dbus = tryGetName `catchDyn` (\ (DBus.Error _ _) ->
                                                getWellKnownName dbus)
 where
  tryGetName = do
    namereq <- newMethodCall serviceDBus pathDBus interfaceDBus "RequestName"
    addArgs namereq [String "org.xmonad.Log", Word32 5]
    sendWithReplyAndBlock dbus namereq 0
    return ()

outputThroughDBus :: Connection -> String -> IO ()
outputThroughDBus dbus str = do
  let str' = "<span font=\"Terminus 9 Bold\">" ++ str ++ "</span>"
  msg <- newSignal "/org/xmonad/Log" "org.xmonad.Log" "Update"
  addArgs msg [String str']
  send dbus msg 0 `catchDyn` (\ (DBus.Error _ _ ) -> return 0)
  return ()

pangoColor :: String -> String -> String
pangoColor fg = wrap left right
 where
  left  = "<span foreground=\"" ++ fg ++ "\">"
  right = "</span>"

pangoSanitize :: String -> String
pangoSanitize = foldr sanitize ""
 where
  sanitize '>'  acc = "&gt;" ++ acc
  sanitize '<'  acc = "&lt;" ++ acc
  sanitize '\"' acc = "&quot;" ++ acc
  sanitize '&'  acc = "&amp;" ++ acc
  sanitize x    acc = x:acc

try_ :: MonadIO m => IO a -> m ()
try_ action = liftIO $ try action >> return ()

The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...

Offline

#24 2010-12-15 20:28:46

Paul-S
Member
From: Wales
Registered: 2008-02-04
Posts: 353

Re: Share your xmonad desktop!

tNmt1dQ.jpg

Cheers
Paul-S

import XMonad hiding ((|||))
import XMonad.ManageHook
import XMonad.Config (defaultConfig)
import qualified XMonad.StackSet as W
import qualified XMonad.Prompt         as P
import qualified XMonad.Actions.Submap as SM
import qualified XMonad.Actions.Search as S
import qualified Data.Map        as M

import XMonad.Actions.CycleWS
import XMonad.Actions.Promote
import XMonad.Actions.UpdatePointer
import XMonad.Actions.GridSelect
import XMonad.Actions.Search

import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.UrgencyHook

import XMonad.Layout.DwmStyle
import XMonad.Layout.SimplestFloat
import XMonad.Layout.IM
import XMonad.Layout.LayoutCombinators
import XMonad.Layout.Named
import XMonad.Layout.NoBorders
import XMonad.Layout.PerWorkspace
import XMonad.Layout.Reflect
import XMonad.Layout.ResizableTile
import XMonad.Layout.Tabbed
import XMonad.Layout.OneBig

import XMonad.Prompt
import XMonad.Prompt.Shell
import XMonad.Prompt.Theme
import XMonad.Prompt.AppendFile

import XMonad.Util.EZConfig
import XMonad.Util.Run (safeSpawn, unsafeSpawn, runInTerm, spawnPipe, hPutStrLn)
import XMonad.Util.Font
import XMonad.Util.Scratchpad (scratchpadSpawnAction, scratchpadManageHook, scratchpadFilterOutWorkspace)
import XMonad.Util.WorkspaceCompare

import Data.Ratio ((%))

statusBarCmd = "dzen2 -e '' -w 1280 -ta l -fn 'Droid Sans-9' -x 0 -y 781 -w 640 -h 20 -bg '#3f3f3f' -fg #d3d7cf "
statusBarCmd1 = "/home/paul/bin/conky -c ~/.conkyrc.bot.right | dzen2 -p -ta right -fn 'Droid Sans-9' -x 600 -y 781 -h 20 -w 495  -bg '#3f3f3f'"
statusBarCmd2 = "/home/paul/bin/conky -c ~/.conkyrc.top.right | dzen2 -p -ta right -fn 'Droid Sans-9' -x 640 -y 0 -h 20 -w 535 -bg '#3f3f3f'"
statusBarCmd3 = "/home/paul/bin/conky -c ~/.conkyrc.top.left | dzen2 -p -ta left -fn 'Droid Sans-9' -x 105 -y 0 -h 20 -w 535 -bg '#3f3f3f'"

main = do
       din <- spawnPipe statusBarCmd
       din2 <- spawnPipe statusBarCmd1
       din3 <- spawnPipe statusBarCmd2
       din4 <- spawnPipe statusBarCmd3
       xmonad $ withUrgencyHook dzenUrgencyHook { args = ["-fn", "Droid Sans-9","-bg", "yellow", "-fg", "red"] } $ defaultConfig
                     { borderWidth        = 1
                     , workspaces         = myWorkspaces
                     , terminal           = myTerminal
                     , modMask            = mod4Mask
                     , normalBorderColor  = myNormalBorderColor
                     , focusedBorderColor = myFocusedBorderColor
                     , manageHook         = newManageHook <+> manageDocks
                     , logHook            = myLogHook din
                     , layoutHook         = myLayouts
                     }
                     `additionalKeysP` myKeys din

newManageHook = myManageHook <+> manageHook defaultConfig <+> manageScratchPad

myWorkspaces = [supWsNum "1" "net",supWsNum "2" "screen",supWsNum "3" "files",supWsNum "4" "chat",supWsNum "5" "hotot",supWsNum "6" "",supWsNum "7" "",supWsNum "8" "",supWsNum "9" ""]
              where
                          supWsNum wsName wsNum =" " ++ wsName ++  "^p(;_TOP)^fn(" ++ mySmallFont  ++ ")" ++ wsNum ++ "  ^fn()^p()"

paulXPConfig = defaultXPConfig
       {     font = "xft:Droid Sans:size=9"
           , bgColor = "#505050"
           , fgColor = "snow1"
           , fgHLight = "#505050"
           , bgHLight = "#505050"
           , promptBorderWidth = 0
           , position = Bottom
           , height = 20
           , historySize = 32 
           , defaultText = []
       }

searchEngineMap method = M.fromList $
    [ ((0, xK_g), method S.google)
    , ((0, xK_w), method $ S.searchEngine "Wikipedia" "http://en.wikipedia.org/w/index.php?title=Special:Search&redirs=0&search=")
    , ((0, xK_i), method $ S.searchEngine "Imdb" "http://www.imdb.com/find?s=all&q=")
    , ((0, xK_y), method S.youtube)
    , ((0, xK_d), method S.dictionary)
    , ((0, xK_b), method $ S.searchEngine "archbbs" "http://bbs.archlinux.org/search.php?action=search&keywords=")
 -- , ((0, xK_r), method $ S.searchEngine "AUR" "http://aur.archlinux.org/packages.php?O=0&L=0&C=0&K=")
    , ((0, xK_r), method $ S.searchEngine "archwiki" "http://wiki.archlinux.org/index.php/Special:Search?search=")
    , ((0, xK_p), method $ S.searchEngine "Play" "http://www.play.com/Search.aspx?searchtype=allproducts&searchstring=")
    , ((0, xK_a), method $ S.searchEngine "Amazon" "http://www.amazon.co.uk/s/ref=nb_ss?url=search-alias%3Daps&field-keywords=")
    , ((0, xK_u), method $ S.searchEngine "Urban" "http://urbandictionary.com/define.php?term=")
    , ((0, xK_e), method $ S.searchEngine "Epguides" "http://www.google.com/search?hl=en&q=allintitle:&q=site:epguides.com&q=")
    ]

manageScratchPad = scratchpadManageHook (W.RationalRect l t w h)

  where

    h = 0.3 
    w = 0.8     
    t = 0.9 - h
    l = 0.9 - w

myManageHook  = composeAll 
                           [ className =? "Pidgin"         --> moveTo 3
                           , className =? "Firefox"        --> moveTo 0
                           , className =? "Namoroka"       --> moveTo 0
                           , className =? "Hotot"          --> moveTo 4
                           , className =? "Chromium"       --> moveTo 0
                           , className =? "uzbl-browser"   --> moveTo 0
                           , className =? "jumanji"        --> moveTo 0
                           , className =? "MPlayer"        --> moveTo 0
                           , manageDocks
                           ]
                 where moveTo i = doF . W.shift $ if i == -1 then last myWorkspaces else myWorkspaces !! i

myKeys conf = [ ("M-<Return>", spawn "urxvt")
              , ("M-p",        spawn "/home/paul/scripts/launch.sh")
              --, ("M-p",        spawn "exe=`dmenu_path | dmenu -nb 'snow1' -nf '#543532' -sb '#ffffff' -sf '#ffffff' -fn 'Liberation Sans-10'` && eval \"exec $exe\"")
              , ("M-c",        spawn "chromium")
              , ("M-S-p",      spawn "/home/paul/scripts/dmenu-edit.sh")
              , ("M-S-c",      kill)
              , ("M-r",        spawn "/usr/local/bin/rodent") 
              , ("M-t",        spawn "thunar")
              , ("M-S-s",      scratchpadSpawnAction defaultConfig { terminal = myTerminal })
              , ("M-S-n",      appendFilePrompt paulXPConfig "/home/paul/Desktop/.todo")
              , ("M-a",        sendMessage MirrorShrink)
              , ("M-z",        sendMessage MirrorExpand)
              , ("M-s",        SM.submap $ searchEngineMap $ S.promptSearchBrowser paulXPConfig "chromium")
              , ("M-g",        goToSelected defaultGSConfig)
              , ("M-<Left>",    prevWS)
              , ("M-<Right>",   nextWS)
              , ("M-S-<Left>",  shiftToPrev)
              , ("M-S-<Right>", shiftToNext)
              , ("M-<Tab>",     toggleWS)
              , ("M-S-<Return>", promote)
              , ("M-S-u", focusUrgent)
              , ("M-S-r",       spawn "killall battery cpu disk volume conky dzen-status volume1 cpu1 dzen-cal dzen2" >> restart "/home/paul/bin/xmonad" True)
              ]

myNormalBorderColor = "#3f3f3f"
myFocusedBorderColor = "#3f3f3f"
mySmallFont = "xft:monospace:size=6"
myTerminal = "urxvt +sb -bg '#181818' -fg '#ddeedd'"
myLogHook h = (dynamicLogWithPP $ defaultPP
                 {  ppSort = fmap (.scratchpadFilterOutWorkspace) getSortByTag
                  , ppCurrent = wrap "^fg(snow1)^bg(#357EC7) " " ^fg()^bg()"
                  , ppHidden  = dzenColor "snow1" "#3F3F3F"
                  , ppHiddenNoWindows  = dzenColor "#505050" "#3f3f3f"
                  , ppSep     = " ^fg(grey60)^r(3x3)^fg() "
                  , ppWsSep   = " "
                  , ppLayout  = dzenColor "#dcd7cf" "" .
                                (\x -> case x of
                                         "Tall"  -> "^i(/home/paul/icons/rob/tall.xbm)"
                                         "Mirror" -> "^i(/home/paul/icons/rob/mtall.xbm)"
                                         "Tabs" -> "T"
                                         "IM"  -> "Im"
                                         "Float" -> "F"
                                )
                  , ppTitle   = dzenColor "white" "" . wrap "< " " >" . shorten 55
                  , ppOutput  = hPutStrLn h
                  , ppUrgent = dzenColor "yellow" "red" . dzenStrip
                  }) >> updatePointer (Relative 0.95 0.95) 
                  where
                   namedOnly ws = if any (`elem` ws) ['a'..'z'] then pad ws else ""

myTheme = defaultTheme { decoHeight          = 20
                       , fontName            = "xft:Liberation Sans:size=9"
                       , activeColor         = "#000066"
                       , activeBorderColor   = "#111199"
                       , activeTextColor     = "white"
                       , inactiveColor       = "#9999ee"
                       , inactiveBorderColor = "#6666cc"
                       , inactiveTextColor   = "black"
                       }

myLayouts = avoidStruts $ smartBorders $
  onWorkspace (myWorkspaces !! 3) (named "IM" (reflectHoriz $ withIM (1%8) (Title "Buddy List") (reflectHoriz $ dwmStyle shrinkText myTheme tiled ||| (smartBorders $ tabs)))) $
  onWorkspace (myWorkspaces !! 5) (named "Float" (simplestFloat)) $
  onWorkspace (myWorkspaces !! 0) (tabs) $
  (tiled ||| named "Mirror" (Mirror tiled) ||| tabs)
    where
     tiled = named "Tall" (ResizableTall 1 (3/100) (1/2) [])
     tabs = named "Tabs" (tabbed shrinkText myTheme)

Offline

#25 2010-12-15 21:55:00

Aeva
Member
Registered: 2010-12-01
Posts: 29

Re: Share your xmonad desktop!

I've recently switched from AwesomeWM to XMonad, and I'm really enjoying the control so far.

I'd like to thank everyone who posted here already, without all these code examples I couldn't have done it. smile

It's currently a work in progress, but here's what I have so far:

Image:
tNmt2eA

Code:

-- Imports {{{

import XMonad
import System.Exit
import System.IO
import qualified XMonad.StackSet as W
import qualified Data.Map as M
-- actions
import XMonad.Actions.CycleWS
import XMonad.Actions.GridSelect
-- layouts
import XMonad.Layout.Grid
import XMonad.Layout.NoBorders
import XMonad.Layout.Spacing
-- hooks
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.SetWMName
import XMonad.Hooks.UrgencyHook
-- utils
import XMonad.Util.EZConfig
import XMonad.Util.Run

-- }}}
-- The basics {{{

myTerminal      = "urxvt"
myFocusFollowsMouse :: Bool
myFocusFollowsMouse = True
myBorderWidth   = 2
myModMask       = mod4Mask
myWorkspaces    = ["1:main","2:www","3:progr","4:fm","5:chat","6:anime","7:music","8:misc"]
myNormalBorderColor = "white"
myFocusedBorderColor = "#26A96F"

-- }}}
-- Taskbar config {{{

myDzenPP h = defaultPP
    { ppCurrent         = dzenColor myFFGColor myFBGColor . wrap (" ^fg(" ++ myFFGColor ++ ")^i(" ++ myIconDir ++ "/xbm8x8/eye_l.xbm)" ++ " ^fg(" ++ myFFGColor ++ ")") " "
    , ppVisible         = dzenColor myVFGColor myVBGColor . wrap (" ^fg(" ++ myVFGColor ++ ")^i(" ++ myIconDir ++ "/xbm8x8/eye_r.xbm)" ++ " ^fg(" ++ myVFGColor ++ ")") " "
    , ppHidden          = dzenColor myDFGColor myDBGColor . wrap (" ^i(" ++ myIconDir ++ "/dzen_bitmaps/has_win.xbm) ") " "
    , ppHiddenNoWindows = dzenColor myDFGColor myDBGColor . wrap (" ^i(" ++ myIconDir ++ "/dzen_bitmaps/has_win_nv.xbm) ") " "
    , ppUrgent          = dzenColor myUFGColor myUBGColor . wrap (" ^i(" ++ myIconDir ++ "/xbm8x8/info_03.xbm) ") " " . dzenStrip
    , ppWsSep           = ""
    , ppSep             = " | "
    , ppLayout          = dzenColor myDFGColor myDBGColor .
                          (\x -> case x of
                          "Full"            -> "^fg(" ++ myDFGColor ++ ")^i(" ++ myIconDir ++ "/dzen_bitmaps/full.xbm)"
                          "Spacing 10 Grid" -> "^fg(" ++ myDFGColor ++ ")^i(" ++ myIconDir ++ "/dzen_bitmaps/mtall.xbm)"
                          "Spacing 10 Tall" -> "^fg(" ++ myDFGColor ++ ")^i(" ++ myIconDir ++ "/dzen_bitmaps/tall.xbm)"
                          _                 -> x
                          )
    , ppTitle           = (" " ++) . dzenColor myDFGColor myDBGColor . dzenEscape
    , ppOutput          = hPutStrLn h 
    }

myDFGColor = "#ffffff" -- normal text color; white
myDBGColor = "#292929" -- normal bg color, black
myFFGColor = myDBGColor -- highlighted bg color, black
myFBGColor = "#26A96F" -- highlighted text color, green
myVFGColor = "#8abfb0"
myVBGColor = "#3b848c"
myUFGColor = "#4390B1"
myUBGColor = "#d91e0d"
myIFGColor = "#8abfd0"
myIBGColor = myDBGColor
mySColor   = myDFGColor

myStatusBar = "dzen2 -x '0' -y '0' -h '20' -w '1150' -ta 'l' -bg '" ++ myDBGColor ++ "' -fn '" ++ myFont ++ "'"
myTrayBar = "/home/lilith/.xmonad/traybarscript.zsh | dzen2 -x '1150' -y '0' -h '20' -ta 'r' -bg '" ++ myDBGColor ++ "' -fg '" ++ myDFGColor ++ "' -fn '" ++ myFont ++ "'"
myBottomBar = "conky -c ~/.conky_bottom | dzen2 -x '0' -y '880' -h '20' -ta 'c' -bg '" ++ myDBGColor ++ "' -fg '" ++ myDFGColor ++ "' -fn '" ++ myFont ++ "'"
myIconDir = "/home/lilith/.dzen/"

myFont = "-*-liberation mono-medium-r-normal-*-10-*-*-*-*-*-*-*"

-- }}}
-- Key bindings {{{

myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
 
    -- launch a terminal
    [ ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
 
    -- launch dmenu
    , ((modm,               xK_p     ), spawn "exe=`dmenu_path | dmenu` && eval \"exec $exe\"")
 
    -- close focused window
    , ((modm .|. shiftMask, xK_c     ), kill)
 
     -- Rotate through the available layout algorithms
    , ((modm,               xK_space ), sendMessage NextLayout)
 
    --  Reset the layouts on the current workspace to default
    , ((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
 
    -- Resize viewed windows to the correct size
    , ((modm,               xK_n     ), refresh)
 
    -- Select an application from a grid
    , ((modm,               xK_e     ), goToSelected defaultGSConfig)

    -- Move focus to the next window
    , ((modm,               xK_Tab   ), windows W.focusDown)
 
    -- Move focus to the next window
    , ((modm,               xK_j     ), windows W.focusDown)
 
    -- Move focus to the previous window
    , ((modm,               xK_k     ), windows W.focusUp  )
 
    -- Move focus to the master window
    , ((modm,               xK_m     ), windows W.focusMaster  )
 
    -- Swap the focused window and the master window
    , ((modm,               xK_Return), windows W.swapMaster)
 
    -- Swap the focused window with the next window
    , ((modm .|. shiftMask, xK_j     ), windows W.swapDown  )
 
    -- Swap the focused window with the previous window
    , ((modm .|. shiftMask, xK_k     ), windows W.swapUp    )
 
    -- Shrink the master area
    , ((modm,               xK_h     ), sendMessage Shrink)
 
    -- Expand the master area
    , ((modm,               xK_l     ), sendMessage Expand)
 
    -- Push window back into tiling
    , ((modm,               xK_t     ), withFocused $ windows . W.sink)
 
    -- Increment the number of windows in the master area
    , ((modm              , xK_comma ), sendMessage (IncMasterN 1))
 
    -- Deincrement the number of windows in the master area
    , ((modm              , xK_period), sendMessage (IncMasterN (-1)))
 
    -- Toggle the status bar gap
    -- Use this binding with avoidStruts from Hooks.ManageDocks.
    -- See also the statusBar function from Hooks.DynamicLog.
    --
    , ((modm              , xK_b     ), sendMessage ToggleStruts)
 
    -- Quit xmonad
    , ((modm .|. shiftMask, xK_q     ), io (exitWith ExitSuccess))
 
    -- Restart xmonad
    , ((modm              , xK_q     ), spawn "xmonad --recompile; xmonad --restart")

    , ((modm              , xK_Right ), nextWS)

    , ((modm              , xK_Left  ), prevWS)

    ]
    ++
 
    --
    -- mod-[1..9], Switch to workspace N
    -- mod-shift-[1..9], Move client to workspace N
    --
    [ ((m .|. modm, k), windows $ f i)
        | (i, k) <- zip (myWorkspaces) [xK_1 .. xK_8]
        , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]
    ]

-- }}}
-- Mouse bindings {{{

myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $
    [ ((modm, button1), (\w -> focus w >> mouseMoveWindow w
                                       >> windows W.shiftMaster))
    , ((modm, button2), (\w -> focus w >> windows W.shiftMaster))
    , ((modm, button3), (\w -> focus w >> mouseResizeWindow w
                                       >> windows W.shiftMaster))
    ]

-- }}}
-- Hooks & Layouts {{{

myLayoutHook = tiled ||| grid ||| full
  where
    tiled = spacing 10 $ Tall nmaster delta ratio
    nmaster = 1
    ratio = 1/2
    delta = 3/100
    grid = spacing 10 $ Grid
    full = noBorders $ Full

myManageHook = ( composeAll . concat $
    [ [className =? "Gimp"           --> doFloat] -- float
    , [className =? "MPlayer"        --> doFloat]
    , [className =? "Pidgin"         --> doFloat]
    , [className =? "Chromium"       --> doShift "2:www"] --shift
    , [className =? "Firefox"        --> doShift "2:www"]
    , [className =? "Namoroka"       --> doShift "2:www"]
    , [className =? "Opera"          --> doShift "2:www"]
    , [className =? "Thunar"         --> doShift "4:fm"]
    , [className =? "Pidgin"         --> doShift "5:chat"]
    , [className =? "MPlayer"        --> doShift "6:anime"]
    , [className =? "ncmpcpp"        --> doShift "7:music"]
    , [resource  =? "desktop_window" --> doIgnore] -- ignore
    , [resource  =? "kdesktop"       --> doIgnore]
    ])

    where

        role    = stringProperty "WM_WINDOW_ROLE"
        name    = stringProperty "WM_NAME"

myLogHook = return ()

-- }}}
-- Main {{{

main = do
    dzen <- spawnPipe myStatusBar
    tray <- spawnPipe myTrayBar
    bottom <- spawnPipe myBottomBar
    programs <- spawnPipe "sh /home/lilith/.xmonad/autostart.sh"
    xmonad $ ewmh $ withUrgencyHook NoUrgencyHook defaultConfig {
       -- the basics
        terminal = myTerminal,
        focusFollowsMouse = myFocusFollowsMouse,
        borderWidth = myBorderWidth,
        modMask = myModMask,
        workspaces = myWorkspaces,
        normalBorderColor = myNormalBorderColor,
        focusedBorderColor = myFocusedBorderColor,
       -- keybinds
        keys = myKeys,
        mouseBindings = myMouseBindings,
       -- hooks & layouts
        layoutHook = avoidStruts $ myLayoutHook,
        manageHook = manageHook defaultConfig <+> myManageHook,
        logHook = myLogHook >> (dynamicLogWithPP $ myDzenPP dzen) >> setWMName "LG3D"
--        startupHook = ewmhDesktopsStartup >> setWMName "LG3D"
    }

-- }}}
-- vim:foldmethod=marker sw=4 sts=4 ts=4 tw=0 et ai nowrap

By the way, the key combination modkey + 1-9 doesn't seem to work at all for me, did I miss an import statement or something? Everyone seems to have the exact same syntax yet it won't work for me...

Last edited by Aeva (2010-12-15 21:56:32)

Offline

Board footer

Powered by FluxBB