Skip to main content

My minimalistic xinitrc, xmonad.hs and xmobarrc

put this in ~/.xinitrc

ck-launch-session

# start trayer to contain apps like nm-applet
trayer --edge top --align right --SetDockType true --SetPartialStrut true --expand true --width 5 --transparent true --tint 0x191970 --height 12 &

kmix &

# some cool effects
xcompmgr -c -f -F &

# Set the background color
hsetroot -tile /home/sven/Wallpapers/abstract-bluelights-1280x800-.jpg

xset b 100 0 0
xset r rate 190 90
dbus-launch --exit-with-session xmonad


put this in ~/.xmonad/xmonad.hs
import XMonad

import qualified XMonad.StackSet as W
import XMonad.ManageHook
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.FadeInactive()
import XMonad.Hooks.SetWMName(setWMName)
import XMonad.Layout.NoBorders(smartBorders)
import XMonad.Layout.Tabbed(tabbed, shrinkText, defaultTheme)
import XMonad.Layout.LayoutHints(layoutHints)
import XMonad.Layout.LayoutModifier
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeys)
import System.IO

import XMonad.Prompt(defaultXPConfig, autoComplete, XPPosition(Bottom), position)
import XMonad.Prompt.RunOrRaise(runOrRaisePrompt)
import XMonad.Actions.WindowGo(runOrRaiseNext)
import XMonad.Actions.UpdatePointer()
import XMonad.Prompt.Man(manPrompt)
import XMonad.Prompt.Window(windowPromptGoto)
import XMonad.Util.Themes()

main = do
mobar <- spawnPipe "/usr/bin/xmobar ~/.xmonad/xmobarrc"
xmonad $ defaultConfig { manageHook = manageDocks <+> customManageHooks <+> manageHook defaultConfig
, layoutHook = avoidStruts sheyllLayouts
, modMask = windowsKey -- rebind ALT modifier key to WIN
, logHook = myLogHook mobar
, terminal = "konsole"
, startupHook = setWMName "LG3D"
} `additionalKeys` sheyllShortCuts
where myLogHook mobar = dynamicLogWithPP sjanssenPP { ppOutput = hPutStrLn mobar
}

customManageHooks = composeAll [ className =? "ioUrbanTerror" --> doFullFloat
, className =? "XConsole" --> doFloat
, className =? "Kcalc" --> doFloat
, className =? "Pidgin" --> doFloat
, className =? "Kmix" --> doFloat]

windowsKey = mod4Mask

sheyllLayouts = smartBorders $
tabbed shrinkText defaultTheme
||| layoutHints (layoutHook defaultConfig)

sheyllShortCuts = [ ((windowsKey, xK_p), runOrRaisePrompt defaultXPConfig
{ position = Bottom
, autoComplete = Just 500000 })
-- important apps
, ((windowsKey, xK_Return), runOrRaiseNext "konsole"
(className =? "Konsole"))
, ((windowsKey, xK_f), runOrRaiseNext "google-chrome"
(className =? "Google-chrome"))
, ((windowsKey .|. shiftMask, xK_f), spawn "google-chrome")

, ((windowsKey, xK_a), runOrRaiseNext "emacs" (className =?
"Emacs"))
, ((windowsKey .|. shiftMask, xK_a), spawn "emacs")

, ((windowsKey, xK_d), runOrRaiseNext "dolphin" (className
=? "Dolphin"))
, ((windowsKey .|. shiftMask, xK_d), spawn "dolphin")

, ((windowsKey, xK_End), kill)

-- eclipse IDE
, ((windowsKey, xK_x), runOrRaiseNext "eclipse" (className =?
"Eclipse"))
, ((windowsKey .|. shiftMask, xK_x), spawn "eclipse")


-- launch a mail programm
, ((windowsKey, xK_m ), runOrRaiseNext "kmail" (className =? "Kmail"))

-- switch kb to de
, ((windowsKey, xK_BackSpace), spawn "setxkbmap de")

-- switch kb to us
, ((windowsKey .|. shiftMask, xK_BackSpace), spawn "setxkbmap us")

-- launch pidgin
, ((windowsKey, xK_i ), runOrRaiseNext "pidgin" (className =? "Pidgin"))

-- sound & media
, ((windowsKey, xK_v), runOrRaiseNext "rhythmbox" (className
=? "Rhythmbox"))

-- put system into hibernate mode
, ((windowsKey .|. shiftMask .|. controlMask, xK_r), spawn "sudo reboot")


-- Toggle docks gaps
, ((windowsKey , xK_b), sendMessage ToggleStruts)

-- prompt, runOrRaise
, ((windowsKey .|. controlMask, xK_x), runOrRaisePrompt
defaultXPConfig)
, ((windowsKey, xK_F1), manPrompt defaultXPConfig)

-- finding windows
, ((windowsKey, xK_g ), windowPromptGoto
defaultXPConfig { autoComplete = Just 500000 } )
]
++
-- 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 .|. windowsKey, key), screenWorkspace sc >>= flip whenJust (windows . f))
| (key, sc) <- zip [xK_e, xK_w, xK_r] [0..]
, (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]



place this in ~/.xmonad/xmobarrc:


Config { font = "-*-Fixed-Bold-R-Normal-*-13-*-*-*-*-*-*-*"
, bgColor = "black"
, fgColor = "grey"
, position = TopW L 95
, lowerOnStart = True
, commands = [ Run Memory ["-t","Mem: %"] 10
, Run Swap [] 10
, Run Battery ["-t","Batt: "] 10
, Run Thermal "THRM" [] 10
, Run Network "eth0" ["-L","0","-H","32","--normal","green","--high","red"] 10
, Run Memory ["-t","Mem: %"] 10
, Run MultiCpu ["-t", "CPU: ","-L","3","-H","50","--normal","green","--high","red"] 10
, Run Date "%a %b %_d %Y %H:%M:%S" "date" 10
, Run StdinReader
]
, sepChar = "%"
, alignSep = "}{"
, template = "%StdinReader%} {%multicpu% << %memory% << %swap% << %eth0% << %date%"
}

Comments

Popular posts from this blog

Lazy Evaluation(there be dragons and basement cats)

Lazy Evaluation and "undefined" I am on the road to being a haskell programmer, and it still is a long way to go. Yesterday I had some nice guys from #haskell explain to me lazy evaluation. Take a look at this code: Prelude> let x = undefined in "hello world" "hello world" Prelude> Because of Haskells lazyness, x will not be evaluated because it is not used, hence undefined will not be evaluated and no exception will occur. The evaluation of "undefined" will result in a runtime exception: Prelude> undefined *** Exception: Prelude.undefined Prelude> Strictness Strictness means that the result of a function is undefined, if one of the arguments, the function is applied to, is undefined. Classical programming languages are strict. The following example in Java will demonstrate this. When the programm is run, it will throw a RuntimeException, although the variable "evilX" is never actually used, strictness requires that all argu

Learning Haskell, functional music

As you might have realized, I started to learn Haskell. One of the most fun things to do in any programming language is creating some kind of audible side effects with a program. Already back in the days when I started programming, I always played around with audio when toying around with a new language. I have found a wonderful set of lecture slides about haskell and multimedia programming, called school of expression. Inspired by the slides about functional music I implemented a little song. Ahh ... and yes it is intended to sound slightly strange . I used the synthesis toolkit to transform the music to real noise, simply by piping skini message to std-out. I used this command line to achieve the results audible in the table: sven@hhi1214a:~/Mukke$ ghc -o test1 test1.hs && ./test1 | stk-demo Plucked -n 16 -or -ip Sound samples: Plucked play Clarinet play Whistle(attention very crazy!) play As always the source... stueck = anfang :+: mitte :+: ende anfang = groovy :+: (Trans

Erlang mock - erlymock

NOTE THIS POST IS OUTDATED! The project has evolved and can be found here: ErlyMock Some features Easy to use Design based on easymock Works together with otp: can be used even if the clut is called from another process, by invoking mock:verify_after_last_call(Mock,optional: timeout) custom return functions predefined return functions for returning values, receiving message, throwing exceptions, etc.. erlymock automatically purges all modules that were mocked, after verify() Custom argument matchers: %% Orderchecking types: in_order, out_of_order, stub; %% Answering: {return, ...}|{error, ...}|{throw, ...}|{exit, ...}|{rec_msg, Pid}|{function, Fun(Args) -> RetVal} expect(Mock, Type, Module, Function, Arguments, Answer = {AT, _}) when AT==return;AT==error;AT==throw;AT==exit;AT==rec_msg;AT==function -> call(Mock, {expect, Type, Module, Function, length(Arguments), {Arguments, Answer}}). %% this version of expect is suited for useing custom argument matchers expect(Mock, Type,