You are not logged in.

#551 2012-02-24 23:12:48

bslackr
Member
Registered: 2012-01-27
Posts: 131

Re: xmonad Hacking Thread

I'm trying to setup dzen with xmonad. My conky instance of dzen runs fine and I can see that, but the left instance of dzen that is supposed to show the workspaces and other information from xmonad doesn't even show up, it's just my desktop wallpaper. I've been hacking together a few different xmonad.hs's so I'm sure I missed something, but I havent been able to figure it out. Below is my xmonad.hs, I would appreciate it if someone could pinpoint what is wrong:

Edit: I'm not sure what I did, but neither dzen bar is working now.

import XMonad
import qualified XMonad.StackSet as W
import qualified Data.Map as M
import System.Exit
import XMonad.Util.Cursor
import XMonad.Util.Run(spawnPipe)
import XMonad.Actions.GridSelect
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.UrgencyHook
import XMonad.Hooks.InsertPosition
import XMonad.Hooks.ManageDocks
import XMonad.Layout.NoBorders
import XMonad.Layout.ResizableTile
import XMonad.Layout.Named
import XMonad.Layout.Tabbed
import XMonad.Hooks.EwmhDesktops
import System.IO

main :: IO ()
main = do
        status  <- spawnPipe myDzenStatus
        conky   <- spawnPipe myDzenConky
        xmonad $ withUrgencyHook NoUrgencyHook $ defaultConfig
            { workspaces = myWorkspaces
            , modMask = myModMask
            , borderWidth = myBorderWidth
            , normalBorderColor = myNormalBorderColor
            , focusedBorderColor = myFocusedBorderColor
            , terminal = myTerminal
            , keys = myKeys
            , handleEventHook = fullscreenEventHook
            , layoutHook = myLayoutHook
            , manageHook = manageDocks <+> myManageHook
            , startupHook = setDefaultCursor xC_left_ptr
            , logHook = myLogHook status
            }

-- Window Management --
myManageHook = composeAll [ isFullscreen             --> doFullFloat
                         , className =? "MPlayer"   --> doFloat
                         , className =? "Gimp"      --> doFloat
                         , className =? "Vlc"       --> doFloat
			 , insertPosition Below Newer
			 , transience'
                         ]


-- bar
myDzenStatus = "dzen2 -w '320' -ta 'l'" ++ myDzenStyle
myDzenConky = "conky -c ~/.xmonad/conkyrc | dzen2 -x '320' -w '1046' -ta 'r'" ++ myDzenStyle
myDzenStyle = "-h '20' -fg '#ffffff' -bg '#000000' -fn 'terminus:size=9'"

myDzenPP  = dzenPP
    { ppCurrent = dzenColor "#3399ff" "" . wrap " " " "
    , ppHidden  = dzenColor "#dddddd" "" . wrap " " " "
    , ppHiddenNoWindows = dzenColor "#777777" "" . wrap " " " "
    , ppUrgent  = dzenColor "#ff0000" "" . wrap " " " "
    , ppSep     = "     "
    , ppLayout  = dzenColor "#aaaaaa" "" . wrap "^ca(1,xdotool key super+space)? " " ?^ca()"
    , ppTitle   = dzenColor "#ffffff" "" 
                    . wrap "^ca(1,xdotool key super+k)^ca(2,xdotool key super+shift+c)"
                           "                          ^ca()^ca()" . shorten 20 . dzenEscape
    }

myLogHook h = dynamicLogWithPP $ myDzenPP { ppOutput = hPutStrLn h }
myGSConfig = defaultGSConfig { gs_cellwidth = 160 }
urgentConfig = UrgencyConfig { suppressWhen = Focused, remindWhen = Dont }
myBorderWidth = 1
myNormalBorderColor  = "#333333"
myFocusedBorderColor = "#AFAF87"
tabTheme1 = defaultTheme { decoHeight = 16
                         , activeColor = "#a6c292"
                         , activeBorderColor = "#a6c292"
                         , activeTextColor = "#000000"
                         , inactiveBorderColor = "#000000"
                         }

myWorkspaces = ["1-main", "2-net", "3-dev", "4-conf", "5", "6", "7", "8", "9"]
myLayoutHook = avoidStruts $ ( tile ||| mtile ||| tab ||| full )
  where
    rt = ResizableTall 1 (2/100) (1/2) []
    tile = named "[]=" $ smartBorders rt
    mtile = named "M[]=" $ smartBorders $ Mirror rt
    tab = named "T" $ noBorders $ tabbed shrinkText tabTheme1
    full = named "[]" $ noBorders Full 
myTerminal = "urxvtc"
myModMask = mod4Mask
secModMask = mod1Mask
toggleStrutsKey :: XConfig Layout -> (KeyMask, KeySym)
toggleStrutsKey XConfig {XMonad.modMask = modMask} = (modMask, xK_b)
myKeys :: XConfig Layout -> M.Map (KeyMask, KeySym) (X ())
myKeys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
    [ ((modMask,               xK_Return), spawn $ XMonad.terminal conf) 
    , ((modMask,               xK_r     ), spawn "dmenu_run") 
    , ((modMask,               xK_d     ), spawn "dwb") 
    , ((modMask .|. shiftMask, xK_p     ), spawn "gmrun")
    , ((modMask .|. shiftMask, xK_m     ), spawn "urxvtc -e mutt")
    , ((modMask .|. shiftMask, xK_c     ), kill)
    , ((0,                     xK_Print ), spawn "scrot '%Y-%m-%d-$wx$h.png' -e 'mv $f ~/pictures/screens/'") 
    , ((modMask .|. secModMask, xK_space ), spawn "/home/bslackr/bin/toggletouchpad")
    , ((modMask,               xK_g     ), goToSelected myGSConfig)
    , ((modMask,               xK_space ), sendMessage NextLayout)
    , ((modMask .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
    , ((modMask,               xK_t     ), withFocused $ windows . W.sink)
    , ((modMask,               xK_n     ), refresh)
    , ((modMask,               xK_Tab   ), windows W.focusDown)
    , ((modMask,               xK_j     ), windows W.focusDown)
    , ((modMask,               xK_k     ), windows W.focusUp)
    , ((modMask,               xK_m     ), windows W.focusMaster)
    , ((modMask .|. shiftMask, xK_Return), windows W.swapMaster)
    , ((modMask .|. shiftMask, xK_j     ), windows W.swapDown  )
    , ((modMask .|. shiftMask, xK_k     ), windows W.swapUp    )
    , ((modMask              , xK_comma ), sendMessage (IncMasterN 1))
    , ((modMask              , xK_period), sendMessage (IncMasterN (-1)))
    , ((modMask,               xK_h     ), sendMessage Shrink)
    , ((modMask,               xK_l     ), sendMessage Expand)
    , ((modMask .|. shiftMask, xK_h     ), sendMessage MirrorShrink)
    , ((modMask .|. shiftMask, xK_l     ), sendMessage MirrorExpand)
    , ((modMask .|. shiftMask, xK_q     ), io (exitWith ExitSuccess))
    , ((modMask              , xK_q     ), spawn "xmonad --recompile; xmonad --restart")
    ]
    ++
    [((m .|. modMask, k), windows $ f i)
        | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
        , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
    ++
    [((m .|. modMask, key), screenWorkspace sc >>= flip whenJust (windows . f))
        | (key, sc) <- zip [xK_w, xK_e] [0..]
        , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]

Last edited by bslackr (2012-02-24 23:48:48)

Offline

#552 2012-02-25 19:47:10

bslackr
Member
Registered: 2012-01-27
Posts: 131

Re: xmonad Hacking Thread

I still don't know what is wrong about the abov setup, and if someone knows why it doesn't work I'd still like to know for learning purposes, but I started editing a different config file that was already setup for dzen and was able to achieve what I wanted.

Offline

#553 2012-04-19 22:40:11

stiffy420
Member
Registered: 2009-12-11
Posts: 99

Re: xmonad Hacking Thread

hi.

fullscreen flash videos doesnt work properly.

my hs file looks like this: http://pastebin.com/FBPcnzdK

i would like to add this : http://pastebin.com/hmUmky3Z

but i always get error while --recompile.

any help would be appreciated.

Offline

#554 2012-04-26 19:38:52

pyro539
Member
Registered: 2011-08-08
Posts: 18

Re: xmonad Hacking Thread

Hi,

is it possible to show alle open windows of the current workspace with pretty print?

I can only find options how to display the current active window, but i would like to show all windows and highlight the current active.

Offline

#555 2012-04-26 20:06:43

Ashren
Member
From: Denmark
Registered: 2007-06-13
Posts: 1,229
Website

Re: xmonad Hacking Thread

pyro539 wrote:

Hi,

is it possible to show alle open windows of the current workspace with pretty print?

I can only find options how to display the current active window, but i would like to show all windows and highlight the current active.

You could use XMonad.Layout.Grid to achieve an effect like that.

Offline

#556 2012-04-26 20:37:57

pyro539
Member
Registered: 2011-08-08
Posts: 18

Re: xmonad Hacking Thread

Ashren wrote:

You could use XMonad.Layout.Grid to achieve an effect like that.

Oh, i think i used the wrong words here.

I actually wanted to ask if it is possible to show all window titles in the dzen2/xmobar tool using pretty print. like in the following picture:

http://img132.imageshack.us/img132/8872/a64awd.png

as you can see, all window titles are in the status bar and the current active is highlighted. i wanted to ask if thats possible with xmonad too.

Offline

#557 2012-06-08 04:32:49

securitybreach
Member
From: In front of my computers
Registered: 2007-11-18
Posts: 416
Website

Re: xmonad Hacking Thread

Is it possible to run a second session of Xmonad on a separate X session? I have 2  Radeon cards with four monitors and the fourth monitor is on the second video card set as a Separate X session(running the latest version of Catalyst-total). Currently, the second video card/fourth monitor shows a X cursor and does not respond to Xmonad shortcuts so I figured I would need to run a second Xmonad session.

Any help would be greatly appreciated!!

BTW the setup works fine with Xinerama but I need composting (xcompmgr) to get full screen flash working properly. The setup also works fine on both Awesome and KDE but I am an Xmonad user (for the last 3 years) so I need it to work correctly. If anyone knows why fullscreen flash does not work without stuttering on x86_64, then I can deal with xinerama?

Thanks

More info here: https://bbs.archlinux.org/viewtopic.php … 5#p1110065

Last edited by securitybreach (2012-06-08 19:31:03)


"Every normal man must be tempted at times to spit upon his hands, hoist the black flag, and begin slitting throats." -- H.L. Mencken
Website      Configs
Forum Admin: Bruno's All Things Linux   
securitybreach<a>archlinux.us

Offline

#558 2012-06-11 11:13:34

myle
Member
Registered: 2011-08-11
Posts: 35

Re: xmonad Hacking Thread

If I run the following, it overlaps with xmobar.

trayer --edge top --align right --SetDockType true --SetPartialStrut true  --expand true --width 10 --transparent true --tint 0x191970 --height 12 &

EDIT:  Using this in my .xmobarrc fixed it.

, position = TopW L 90

How can I set default layout per workspace?

Last edited by myle (2012-06-11 16:05:53)

Offline

#559 2012-07-10 21:49:45

jsteel
Package Maintainer (PM)
From: England
Registered: 2008-03-18
Posts: 119

Re: xmonad Hacking Thread

Hi,

I would like to show the number of windows on the current workspace (like dwm does in full-screen mode) in xmobar. For example where it says "Full", I would like it to say "Full [5]". I don't mind if the number is shown for other layouts too. Is this possible?

Thanks


PGP key: F40D2072
Key fingerprint: 8742 F753 5E7B 394A 1B04  8163 332C 9C40 F40D 2072

Offline

#560 2012-08-11 16:18:11

kamaradclimber
Member
Registered: 2012-07-29
Posts: 8

Re: xmonad Hacking Thread

Hi,

I am under the impression that my toggleStruts command does not work properly.

When I use my key binding, the dzen bar does not disappear. The strut however  disappear, so my dzen bar is placed above all my windows.
Is that normal ?
I have noticed this behavior recently so I think this might be linked to an update.

My xmonad is here : http://pastebin.com/GhULSH2K

Can you help me finding out what's wrong ?
Any suggestion would be welcomed !

Last edited by kamaradclimber (2012-08-11 16:18:43)

Offline

#561 2012-08-11 16:25:25

hellomynameisphil
Member
From: /home/phil/Vancouver
Registered: 2009-10-02
Posts: 257
Website

Re: xmonad Hacking Thread

Try adding this to your dzen2 command:

-e 'onstart=lower'

Offline

#562 2012-09-01 15:43:21

nemamradfazole
Member
Registered: 2010-03-18
Posts: 40
Website

Re: xmonad Hacking Thread

Hi, do you too have a grey bottom-right corner using Evince or EOG in fullscreen? I don't know how to get rid of that.

Offline

#563 2012-09-23 21:14:09

tammer
Member
From: Philadelphia
Registered: 2010-06-18
Posts: 11

Re: xmonad Hacking Thread

Hello, quick question for all you xmonad masters out there:

So if I run

xdotool key --clearmodifiers "Shift+Insert"

my xsel is pasted insto-magically. However, when I press my modmask + P when my config contains:

    , ((modm,                        xK_p), spawn "xdotool key --clearmodifiers 'Shift+Insert'")

I get nothing. What gives?

edit: After much trial and error, it seems this is a bug with xdotool - the 'clearmodifiers' option doesn't appear to work with a window manager. I just changed the paste key to a submap (prefix) hotkey, so there are no modifiers held down when I actually activate the hotkey.

Last edited by tammer (2012-12-09 01:49:04)

Offline

#564 2012-12-03 06:14:28

sw2wolf
Member
From: China
Registered: 2009-06-08
Posts: 99
Website

Re: xmonad Hacking Thread

Has anybody here used XMonad.Prompt.EVal ? I want use it so that i can own a haskell REPL at anytime and anywhere. However, i cannot install it with the following error:

$cabal install xmonad-extras
...   
[10 of 22] Compiling Hint.Reflection  ( src/Hint/Reflection.hs, dist/build/Hint/Reflection.o)
src/Hint/Reflection.hs:75:41:
Couldn't match expected type `[Char]' with actual type `a0 -> String'
Expected type: Id
Actual type: a0 -> String
In the return type of a call of `getUnqualName'
In the first argument of `Class', namely `(getUnqualName c)'
Failed to install hint-0.3.3.5
cabal: Error: some packages failed to install:
hint-0.3.3.5 failed during the building phase. The exception was:
ExitFailure 1
xmonad-extras-0.10.1.2 depends on hint-0.3.3.5 which failed to install.

Best Regards!


e^(π⋅i) + 1 = 0

Offline

#565 2012-12-03 10:10:12

X-dark
Member
From: France
Registered: 2009-10-25
Posts: 142
Website

Re: xmonad Hacking Thread

I strongly advise you to use the unofficial [haskell] repo: https://wiki.archlinux.org/index.php/Un … Unsigned_2


Cedric Girard

Offline

#566 2012-12-20 05:59:43

sw2wolf
Member
From: China
Registered: 2009-06-08
Posts: 99
Website

Re: xmonad Hacking Thread

X-dark wrote:

I strongly advise you to use the unofficial [haskell] repo: https://wiki.archlinux.org/index.php/Un … Unsigned_2

Now i can install xmonad-extras using new ghc. However it is VERY hard to make `eval*` work sad


e^(π⋅i) + 1 = 0

Offline

#567 2013-01-30 02:35:35

earsplit
Member
Registered: 2012-03-31
Posts: 187
Website

Re: xmonad Hacking Thread

Booting up powertop, I saw that Xmonad was creating a HUGE number of wakeups/second (about 100). Doing a little research, I learned that this was because xmonad is not compiled with the -threaded switch in GHC.

I've created a hackish workaround that you all could find useful... it replaces the xmonad --recompile xmonad --restart mechanism to include the proper flags for GHC. Place with the rest of your keyboard commands. be sure to change x86_64 to reflect your architecture

,((mod1Mask , xK_q), spawn "killall dzen2; killall conky; cd ~/.xmonad; ghc -threaded xmonad.hs; mv xmonad xmonad-x86_64-linux; xmonad --restart" )

((( configs :: website )))

Offline

#568 2013-01-30 05:31:57

sw2wolf
Member
From: China
Registered: 2009-06-08
Posts: 99
Website

Re: xmonad Hacking Thread

the threaded version doesnot work on my FreeBSD box. I use the following script to build xmonad:

#!/bin/sh
ghc -fllvm xmonad.hs
strip -p --strip-unneeded --remove-section=.comment -o xmonad-small xmonad

then i have to manually `rm xmonad` and `mv xmonad-small xmonad-i386-freebsd`. How can i get "xmonad-i386-freebsd" in sh script ?

Regards!

Last edited by sw2wolf (2013-04-09 00:21:29)


e^(π⋅i) + 1 = 0

Offline

#569 2013-02-02 19:22:35

AncientPC
Member
Registered: 2012-02-11
Posts: 52

Re: xmonad Hacking Thread

Here's my xmonad.hs. I also listed as this a bug on Xmonad project page a while back.

I like the behavior of updatePointer. However it breaks Chrome's bookmark dialog because it immediately clicks somewhere and hides the pop up bookmark box. Is there some way to fix this?

Offline

#570 2013-02-08 20:18:10

kanikuleet
Member
Registered: 2012-12-22
Posts: 36

Re: xmonad Hacking Thread

I use xmonad on my Laptop and it has no 'Mouse3'
But I want to be able to resize floating windows
Is there a way to bind mod+ctrl+mouse1 to resize floating windows and remove the default key binding?

Offline

#571 2013-04-08 18:36:52

Malb
Member
Registered: 2012-07-31
Posts: 2

Re: xmonad Hacking Thread

Hi! I was having trouble with getting xmobar's volume display plugin to work, but found a script to replace it that worked beautifully. However, when I dug up an old laptop and used the script there, I discovered that it didn't work on computers without stereo speakers. I'm posting a modified version of the script that fixes the problem, just in case someone bumps into the same problem and can't solve it by themselves.

#!/bin/bash 

# Get L/R volume info
left=`amixer sget Master | grep Left:`
right=`amixer sget Master | grep Right:`
llevel=${left#*[}
llevel=${llevel%\%]*}
rlevel=${right#*[}
rlevel=${rlevel%\%]*}
active=${left##*[}
active=${active%]}
 
# Get mono volume info
mono=`amixer sget Master | grep Mono:`
mlevel=${mono#*[}
mlevel=${mlevel%\%]*}
mactive=${mono##*[}
mactive=${mactive%]}

# Find average level (stereo)
if [ $llevel == $rlevel ]
then
    level=$llevel
else
    level=$(($llevel + $rlevel))
    level=$(($level / 2))
fi

# Create displays
if [ -z $level ] # If $level is empty there is no stereo  
then
  if [ $mactive == "off" ] || [ $mlevel == "0" ] 
  then
    echo "Mute"
  else 
    echo $mlevel% 
  fi
else
 if [ $active == "off" ] || [ $level == "0" ] 
  then
      echo "Mute"
  else
      echo $level% 
  fi 
fi

Here's an xmobar config example:

Config {
    commands = [
        Run Com "~/.xmonad/volume" [] "volume" 10,
        Run StdinReader
    ],
    sepChar = "%",
    alignSep = "}{",
    template = "%StdinReader% }{ Vol: %volume%"}

Last edited by Malb (2013-11-18 22:56:39)

Offline

#572 2013-04-27 00:02:56

AncientPC
Member
Registered: 2012-02-11
Posts: 52

Re: xmonad Hacking Thread

Does anybody here know how to get xmonad working with GNOME 3.8? It's been working for me since GNOME 3.4 and GNOME 3.6, but this latest upgrade to 3.8 has broken it for me...

Offline

#573 2013-07-12 21:50:56

renodesper
Member
From: Bandung
Registered: 2010-12-26
Posts: 43
Website

Re: xmonad Hacking Thread

Hi guys, I'm using an example config from xmonad config archive (you can find it here: https://github.com/nnoell/dotfiles/tree … v4/xmonad). It's working but I have a problem. The creator says that I should compile it manually with ghc because the config file use non-official module. It compiled without problem but when I try to restart it using "xmonad --restart",  it just close my X. I thought it was slim problem but it also happen when I try to log in with startx. Here is my xmonad.hs:

--------------------------------------------------------------------------------------------
-- File   : ~/.xmonad/xmonad.hs                                                           --
-- Author : Nnoell <nnoell3[at]gmail.com>                                                 --
-- Deps   : DzenBoxLogger.hs                                                              --
-- Desc   : My XMonad config                                                              --
-- Note   : Do not use "xmonad --recompile", it will throw errors because of non-official --
--          modules. Compile it manually with "ghc -o <outputName> xmonad.hs". EG:        --
--          $ cd ~/.xmonad/                                                               --
--          $ ghc -o xmonad-x86_64-linux xmonad.hs                                        --
--------------------------------------------------------------------------------------------

-- Language
{-# LANGUAGE DeriveDataTypeable, NoMonomorphismRestriction, MultiParamTypeClasses, ImplicitParams #-}

-- Modules
import XMonad
import XMonad.Layout
import XMonad.Layout.IM
import XMonad.Layout.Named
import XMonad.Layout.Tabbed
import XMonad.Layout.OneBig
import XMonad.Layout.Master
import XMonad.Layout.Reflect
import XMonad.Layout.MosaicAlt
import XMonad.Layout.NoFrillsDecoration
import XMonad.Layout.SimplestFloat
import XMonad.Layout.NoBorders
import XMonad.Layout.ResizableTile
import XMonad.Layout.MultiToggle
import XMonad.Layout.MultiToggle.Instances
import XMonad.Layout.PerWorkspace (onWorkspace)
import XMonad.Layout.Minimize
import XMonad.Layout.Maximize
import XMonad.Layout.ToggleLayouts
import XMonad.Layout.ComboP
import XMonad.Layout.MagicFocus
import XMonad.Layout.WindowNavigation
import XMonad.Layout.WindowSwitcherDecoration
import XMonad.Layout.DraggingVisualizer
import XMonad.StackSet (RationalRect(..), currentTag)
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.DynamicHooks
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.UrgencyHook
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.SetWMName
import XMonad.Hooks.ManageHelpers
import XMonad.Prompt
import XMonad.Prompt.Shell
import XMonad.Prompt.XMonad
import XMonad.Prompt.Man
import XMonad.Util.Timer
import XMonad.Util.Cursor
import XMonad.Util.Loggers
import XMonad.Util.Run (spawnPipe)
import XMonad.Util.Scratchpad
import XMonad.Util.NamedScratchpad
import XMonad.Actions.CycleWS
import XMonad.Actions.ShowText
import XMonad.Actions.GridSelect
import XMonad.Actions.MouseResize
import Data.Monoid
import Data.List
import Graphics.X11.ExtraTypes.XF86
import System.Exit
import System.IO (Handle, hPutStrLn)
import Control.Exception as E
import qualified XMonad.StackSet as W
import qualified Data.Map as M
import qualified XMonad.Actions.FlexibleResize as Flex
import qualified XMonad.Util.ExtensibleState as XS

-- non-official modules
import DzenBoxLoggers

-- Main
main :: IO ()
main = do
	spawn "/home/renodesper/.xmonad/haskell-cpu-usage.out 5" --launch haskell-cpu-usage app (See my github repo to get the app)
	topLeftBar  <- spawnPipe $ dzenFlagsToStr dzenTopLeftFlags
	topRightBar <- spawnPipe $ dzenFlagsToStr dzenTopRightFlags
	botLeftBar  <- spawnPipe $ dzenFlagsToStr dzenBotLeftFlags
	botRightBar <- spawnPipe $ dzenFlagsToStr dzenBotRightFlags
	xmonad $ myUrgencyHook $ defaultConfig
		{ terminal           = "urxvtc"
		, modMask            = mod4Mask
		, focusFollowsMouse  = False
		, clickJustFocuses   = False
		, borderWidth        = 2
		, normalBorderColor  = colorBlackAlt
		, focusedBorderColor = colorBlueAlt
		, layoutHook         = myLayoutHook
		, workspaces         = myWorkspaces
		, manageHook         = myManageHook <+> manageScratchPad <+> manageDocks <+> dynamicMasterHook
		, logHook            = myBotLeftLogHook botLeftBar <+> myBotRightLogHook botRightBar <+> myTopLeftLogHook topLeftBar <+> myTopRightLogHook topRightBar <+> ewmhDesktopsLogHook >> setWMName "LG3D"
		, handleEventHook    = myHandleEventHook
		, keys               = myKeys
		, mouseBindings      = myMouseBindings
		, startupHook        = setDefaultCursor xC_left_ptr <+> (startTimer 1 >>= XS.put . TID)
		}


--------------------------------------------------------------------------------------------
-- LOOK AND FEEL CONFIG                                                                   --
--------------------------------------------------------------------------------------------

-- Colors, fonts and paths
dzenFont             = "-*-montecarlo-medium-r-normal-*-11-*-*-*-*-*-*-*"
colorBlack           = "#020202" --Background
colorBlackAlt        = "#1c1c1c" --Black Xdefaults
colorGray            = "#444444" --Gray
colorGrayAlt         = "#101010" --Gray dark
colorWhite           = "#a9a6af" --Foreground
colorWhiteAlt        = "#9d9d9d" --White dark
colorMagenta         = "#8e82a2"
colorBlue            = "#44aacc"
colorBlueAlt         = "#3955c4"
colorRed             = "#f7a16e"
colorRedAlt          = "#e0105f"
colorGreen           = "#66ff66"
colorGreenAlt        = "#558965"
boxLeftIcon          = "/home/renodesper/.xmonad/dzen2/boxleft.xbm"   --left icon of dzen logger boxes
boxLeftIcon2         = "/home/renodesper/.xmonad/dzen2/boxleft2.xbm"  --left icon2 of dzen logger boxes
boxRightIcon         = "/home/renodesper/.xmonad/dzen2/boxright.xbm"  --right icon of dzen logger boxes
xRes                 = 1366
yRes                 = 768
panelHeight          = 16  --height of top and bottom panels
boxHeight            = 12  --height of dzen logger box
topPanelSepPos       = 950 --left-right alignment pos of top panel
botPanelSepPos       = 400 --left-right alignment pos of bottom panel

-- Title theme
myTitleTheme :: Theme
myTitleTheme = defaultTheme
	{ fontName            = dzenFont
	, inactiveBorderColor = colorBlackAlt
	, inactiveColor       = colorBlack
	, inactiveTextColor   = colorGray
	, activeBorderColor   = colorGray
	, activeColor         = colorBlackAlt
	, activeTextColor     = colorRed
	, urgentBorderColor   = colorGray
	, urgentTextColor     = colorGreen
	, decoHeight          = 14
	}

-- Prompt theme
myXPConfig :: XPConfig
myXPConfig = defaultXPConfig
	{ font                = dzenFont
	, bgColor             = colorBlack
	, fgColor             = colorWhite
	, bgHLight            = colorBlue
	, fgHLight            = colorBlack
	, borderColor         = colorGrayAlt
	, promptBorderWidth   = 1
	, height              = panelHeight
	, position            = Top
	, historySize         = 100
	, historyFilter       = deleteConsecutive
	, autoComplete        = Nothing
	}

-- GridSelect color scheme
myColorizer :: Window -> Bool -> X (String, String)
myColorizer = colorRangeFromClassName
	(0x00,0x00,0x00) --lowest inactive bg
	(0x1C,0x1C,0x1C) --highest inactive bg
	(0x44,0xAA,0xCC) --active bg
	(0xBB,0xBB,0xBB) --inactive fg
	(0x00,0x00,0x00) --active fg

-- GridSelect theme
myGSConfig :: t -> GSConfig Window
myGSConfig colorizer = (buildDefaultGSConfig myColorizer)
	{ gs_cellheight  = 50
	, gs_cellwidth   = 200
	, gs_cellpadding = 10
	, gs_font        = dzenFont
	}

-- Flash text config
myTextConfig :: ShowTextConfig
myTextConfig = STC
	{ st_font = dzenFont
	, st_bg   = colorBlack
	, st_fg   = colorWhite
	}

-- Dzen logger box pretty printing themes
gray2BoxPP :: BoxPP
gray2BoxPP = BoxPP
	{ bgColorBPP   = colorBlack
	, fgColorBPP   = colorGray
	, boxColorBPP  = colorGrayAlt
	, leftIconBPP  = boxLeftIcon2
	, rightIconBPP = boxRightIcon
	, boxHeightBPP = boxHeight
	}

blueBoxPP :: BoxPP
blueBoxPP = BoxPP
	{ bgColorBPP   = colorBlack
	, fgColorBPP   = colorBlue
	, boxColorBPP  = colorGrayAlt
	, leftIconBPP  = boxLeftIcon
	, rightIconBPP = boxRightIcon
	, boxHeightBPP = boxHeight
	}

blue2BoxPP :: BoxPP
blue2BoxPP = BoxPP
	{ bgColorBPP   = colorBlack
	, fgColorBPP   = colorBlue
	, boxColorBPP  = colorGrayAlt
	, leftIconBPP  = boxLeftIcon2
	, rightIconBPP = boxRightIcon
	, boxHeightBPP = boxHeight
	}

whiteBoxPP :: BoxPP
whiteBoxPP = BoxPP
	{ bgColorBPP   = colorBlack
	, fgColorBPP   = colorWhiteAlt
	, boxColorBPP  = colorGrayAlt
	, leftIconBPP  = boxLeftIcon
	, rightIconBPP = boxRightIcon
	, boxHeightBPP = boxHeight
	}

blackBoxPP :: BoxPP
blackBoxPP = BoxPP
	{ bgColorBPP   = colorBlack
	, fgColorBPP   = colorBlack
	, boxColorBPP  = colorGrayAlt
	, leftIconBPP  = boxLeftIcon
	, rightIconBPP = boxRightIcon
	, boxHeightBPP = boxHeight
	}

white2BBoxPP :: BoxPP
white2BBoxPP = BoxPP
	{ bgColorBPP   = colorBlack
	, fgColorBPP   = colorBlack
	, boxColorBPP  = colorWhiteAlt
	, leftIconBPP  = boxLeftIcon2
	, rightIconBPP = boxRightIcon
	, boxHeightBPP = boxHeight
	}

blue2BBoxPP :: BoxPP --current workspace
blue2BBoxPP = BoxPP
	{ bgColorBPP   = colorBlack
	, fgColorBPP   = colorBlack
	, boxColorBPP  = colorBlue
	, leftIconBPP  = boxLeftIcon2
	, rightIconBPP = boxRightIcon
	, boxHeightBPP = boxHeight
	}

green2BBoxPP :: BoxPP --urgent workspace
green2BBoxPP = BoxPP
	{ bgColorBPP   = colorBlack
	, fgColorBPP   = colorBlack
	, boxColorBPP  = colorGreen
	, leftIconBPP  = boxLeftIcon2
	, rightIconBPP = boxRightIcon
	, boxHeightBPP = boxHeight
	}

-- Dzen logger clickable areas
calendarCA :: CA
calendarCA = CA
	{ leftClickCA   = "/home/renodesper/.xmonad/dzencal.sh"
	, middleClickCA = ""
	, rightClickCA  = ""
	, wheelUpCA     = ""
	, wheelDownCA   = ""
	}

layoutCA :: CA
layoutCA = CA
	{ leftClickCA   = "xdotool key super+space"
	, middleClickCA = ""
	, rightClickCA  = "xdotool key super+shift+space"
	, wheelUpCA     = ""
	, wheelDownCA   = ""
	}

workspaceCA :: CA
workspaceCA = CA
	{ leftClickCA   = "xdotool key super+1"
	, middleClickCA = "xdotool key super+g"
	, rightClickCA  = "xdotool key super+0"
	, wheelUpCA     = "xdotool key ctrl+alt+Right"
	, wheelDownCA   = "xdotool key ctrl+alt+Left"
	}

focusCA :: CA
focusCA = CA
	{ leftClickCA   = "xdotool key super+m"
	, middleClickCA = "xdotool key super+c"
	, rightClickCA  = "xdotool key super+shift+m"
	, wheelUpCA     = "xdotool key super+shift+j"
	, wheelDownCA   = "xdotool key super+shift+k"
	}

-- Workspace index
myWorkspaces :: [WorkspaceId]
myWorkspaces = map show $ [1..9] ++ [0]

-- Workspace names
workspacesNames :: [WorkspaceId]
workspacesNames = ["Terminal", "Network", "Development", "Graphics", "Chatting", "Video", "Alternate", "Alternate", "Alternate", "Alternate" ]


--------------------------------------------------------------------------------------------
-- LAYOUT CONFIG                                                                          --
--------------------------------------------------------------------------------------------

-- Main Layouts
myTile  = smartBorders $ toggleLayouts (named "ResizableTall [S]" myTileS) $ named "ResizableTall" $ ResizableTall 1 0.03 0.5 [] where
	myTileS = windowSwitcherDecoration shrinkText myTitleTheme (draggingVisualizer $ ResizableTall 1 0.03 0.5 [])
myMirr  = smartBorders $ toggleLayouts (named "MirrResizableTall [S]" myMirrS) $ named "MirrResizableTall" $ Mirror $ ResizableTall 1 0.03 0.5 [] where
	myMirrS = windowSwitcherDecoration shrinkText myTitleTheme (draggingVisualizer $ Mirror $ ResizableTall 1 0.03 0.5 [])
myMosA  = smartBorders $ toggleLayouts (named "MosaicAlt [S]" myMosAS) $ named "MosaicAlt" $ MosaicAlt M.empty where
	myMosAS = windowSwitcherDecoration shrinkText myTitleTheme (draggingVisualizer $ MosaicAlt M.empty)
myOneB  = smartBorders $ toggleLayouts (named "OneBig [S]" myOneBS) $ named "OneBig" $ OneBig 0.75 0.65 where
	myOneBS = windowSwitcherDecoration shrinkText myTitleTheme (draggingVisualizer $ OneBig 0.75 0.65)
myMTab  = smartBorders $ toggleLayouts (named "Mastered Tabbed [S]" myMTabS) $ named "Mastered Tabbed" $ mastered 0.01 0.4 $ tabbed shrinkText myTitleTheme where
	myMTabS = windowSwitcherDecoration shrinkText myTitleTheme (draggingVisualizer $ mastered 0.01 0.4 $ tabbed shrinkText myTitleTheme)

-- Special Layouts
myTabb  = smartBorders $ named "Tabbed" $ tabbed shrinkText myTitleTheme
myTTab  = smartBorders $ named "Two Tabbed" $ combineTwoP (OneBig 0.75 0.75) (tabbed shrinkText myTitleTheme) (tabbed shrinkText myTitleTheme) (ClassName "Chromium")
myFTab  = smartBorders $ named "Full Tabbed" $ tabbedAlways shrinkText myTitleTheme
myFloat = named "Simplest Float" $ mouseResize  $ noFrillsDeco shrinkText myTitleTheme simplestFloat
myGimp  = named "Gimp MosaicAlt" $ withIM (0.15) (Role "gimp-toolbox") $ reflectHoriz $ withIM (0.20) (Role "gimp-dock") myMosA
myChat  = named "Pidgin MirrResizableTall" $ withIM (0.20) (Title "Buddy List") $ myMirr

-- Tabbed transformer (W+f)
data TABBED = TABBED deriving (Read, Show, Eq, Typeable)
instance Transformer TABBED Window where
	transform TABBED x k = k myFTab (\_ -> x)

-- Floated transformer (W+ctl+f)
data FLOATED = FLOATED deriving (Read, Show, Eq, Typeable)
instance Transformer FLOATED Window where
	transform FLOATED x k = k myFloat (\_ -> x)

-- Layout hook
myLayoutHook = avoidStruts
	$ windowNavigation
	$ minimize
	$ maximize
	$ mkToggle (single TABBED)
	$ mkToggle (single FLOATED)
	$ mkToggle (single MIRROR)
	$ mkToggle (single REFLECTX)
	$ mkToggle (single REFLECTY)
	$ onWorkspace (myWorkspaces !! 1) webLayouts  --Workspace 1 layouts
	$ onWorkspace (myWorkspaces !! 2) codeLayouts --Workspace 2 layouts
	$ onWorkspace (myWorkspaces !! 3) gimpLayouts --Workspace 3 layouts
	$ onWorkspace (myWorkspaces !! 4) chatLayouts --Workspace 4 layouts
	$ allLayouts where
		allLayouts  = myTile ||| myOneB ||| myMirr ||| myMosA ||| myMTab
		webLayouts  = myTabb ||| myTTab
		codeLayouts = myMTab ||| myTile
		gimpLayouts = myGimp
		chatLayouts = myChat


--------------------------------------------------------------------------------------------
-- HANDLE EVENT HOOK CONFIG                                                               --
--------------------------------------------------------------------------------------------

-- wrapper for the Timer id, so it can be stored as custom mutable state
data TidState = TID TimerId deriving Typeable

instance ExtensionClass TidState where
	initialValue = TID 0

-- Handle event hook
myHandleEventHook = fullscreenEventHook <+> docksEventHook <+> clockEventHook <+> handleTimerEvent <+> notFocusFloat where
	clockEventHook e = do                 --thanks to DarthFennec
		(TID t) <- XS.get                 --get the recent Timer id
		handleTimer t e $ do              --run the following if e matches the id
		    startTimer 1 >>= XS.put . TID --restart the timer, store the new id
		    ask >>= logHook.config        --get the loghook and run it
		    return Nothing                --return required type
		return $ All True                 --return required type
	notFocusFloat = followOnlyIf (fmap not isFloat) where --Do not focusFollowMouse on Float layout
		isFloat = fmap (isSuffixOf "Simple Float") $ gets (description . W.layout . W.workspace . W.current . windowset)


--------------------------------------------------------------------------------------------
-- MANAGE HOOK CONFIG                                                                     --
--------------------------------------------------------------------------------------------

-- Scratchpad (W+º)
manageScratchPad :: ManageHook
manageScratchPad = scratchpadManageHook (W.RationalRect (0) (1/50) (1) (3/4))
scratchPad = scratchpadSpawnActionCustom "urxvtc -name scratchpad"

-- Manage hook
myManageHook :: ManageHook
myManageHook = composeAll . concat $
	[ [resource  =? r --> doIgnore                         | r <- myIgnores] --ignore desktop
	, [className =? c --> doShift (myWorkspaces !! 1)      | c <- myWebS   ] --move myWebS windows to workspace 1 by classname
	, [className =? c --> doShift (myWorkspaces !! 2)      | c <- myCodeS  ] --move myCodeS windows to workspace 2 by classname
	, [className =? c --> doShift (myWorkspaces !! 4)      | c <- myChatS  ] --move myChatS windows to workspace 4 by classname
	, [className =? c --> doShift (myWorkspaces !! 3)      | c <- myGfxS   ] --move myGfxS windows to workspace 4 by classname
	, [className =? c --> doShiftAndGo (myWorkspaces !! 5) | c <- myAlt1S  ] --move myGameS windows to workspace 5 by classname and shift
	, [className =? c --> doShift (myWorkspaces !! 7)      | c <- myAlt3S  ] --move myOtherS windows to workspace 5 by classname and shift
	, [className =? c --> doCenterFloat                    | c <- myFloatCC] --float center geometry by classname
	, [name      =? n --> doCenterFloat                    | n <- myFloatCN] --float center geometry by name
	, [name      =? n --> doSideFloat NW                   | n <- myFloatSN] --float side NW geometry by name
	, [className =? c --> doF W.focusDown                  | c <- myFocusDC] --dont focus on launching by classname
	, [isFullscreen   --> doFullFloat]
	] where
		doShiftAndGo ws = doF (W.greedyView ws) <+> doShift ws
		role            = stringProperty "WM_WINDOW_ROLE"
		name            = stringProperty "WM_NAME"
		myIgnores       = ["desktop","desktop_window"]
		myWebS          = ["Chromium","Firefox", "Opera"]
		myCodeS         = ["NetBeans IDE 7.2"]
		myGfxS          = ["Gimp", "gimp", "GIMP"]
		myChatS         = ["Pidgin", "Xchat"]
		myAlt1S         = ["zsnes"]
		myAlt3S         = ["Amule", "Transmission-gtk"]
		myFloatCC       = ["MPlayer", "mplayer2", "File-roller", "zsnes", "Gcalctool", "Exo-helper-1", "Gksu", "PSX", "Galculator", "Nvidia-settings", "XFontSel"
						  , "XCalc", "XClock", "Desmume", "Ossxmix", "Xvidcap", "Main", "Wicd-client.py", "com-mathworks-util-PostVMInit", "MATLAB"]
		myFloatCN       = ["ePSXe - Enhanced PSX emulator", "Seleccione Archivo", "Config Video", "Testing plugin", "Config Sound", "Config Cdrom", "Config Bios"
						  , "Config Netplay", "Config Memcards", "About ePSXe", "Config Controller", "Config Gamepads", "Select one or more files to open"
						  , "Add media", "Choose a file", "Open Image", "File Operation Progress", "Firefox Preferences", "Preferences", "Search Engines"
						  , "Set up sync", "Passwords and Exceptions", "Autofill Options", "Rename File", "Copying files", "Moving files", "File Properties", "Replace", ""]
		myFloatSN       = ["Event Tester"]
		myFocusDC       = ["Event Tester", "Notify-osd"]


--------------------------------------------------------------------------------------------
-- DZEN STATUS BARS CONFIG                                                                     --
--------------------------------------------------------------------------------------------

-- urgencyHook
myUrgencyHook :: LayoutClass l Window => XConfig l -> XConfig l
myUrgencyHook = withUrgencyHook dzenUrgencyHook
	{ duration = 2000000
	, args     = ["-x", "0", "-y", "0", "-h", show panelHeight, "-w", show topPanelSepPos, "-fn", dzenFont, "-bg", colorBlack, "-fg", colorGreen]
	}

-- Dzen top left bar flags
dzenTopLeftFlags :: DF
dzenTopLeftFlags = DF
	{ xPosDF       = 0
	, yPosDF       = 0
	, widthDF      = topPanelSepPos
	, heightDF     = panelHeight
	, alignementDF = "l"
	, fgColorDF    = colorWhiteAlt
	, bgColorDF    = colorBlack
	, fontDF       = dzenFont
	, eventDF      = "onstart=lower"
	, extrasDF     = "-p"
	}

-- Top left bar logHook
myTopLeftLogHook :: Handle -> X ()
myTopLeftLogHook h = dynamicLogWithPP $ defaultPP
	{ ppOutput = hPutStrLn h
	, ppOrder = \(_:_:_:x) -> x
	, ppSep = " "
	, ppExtras = [ myLayoutL, myWorkspaceL, myFocusL ]
	}

-- Dzen top right bar flags
dzenTopRightFlags :: DF
dzenTopRightFlags = DF
	{ xPosDF       = topPanelSepPos
	, yPosDF       = 0
	, widthDF      = xRes - topPanelSepPos
	, heightDF     = panelHeight
	, alignementDF = "r"
	, fgColorDF    = colorWhiteAlt
	, bgColorDF    = colorBlack
	, fontDF       = dzenFont
	, eventDF      = "onstart=lower"
	, extrasDF     = "-p"
	}

-- Top right bar logHook
myTopRightLogHook :: Handle -> X ()
myTopRightLogHook h = dynamicLogWithPP $ defaultPP
	{ ppOutput  = hPutStrLn h
	, ppOrder = \(_:_:_:x) -> x
	, ppSep = " "
	, ppExtras  = [ myUptimeL, myDateL ]
	}

-- Dzen bottom left bar flags
dzenBotLeftFlags :: DF
dzenBotLeftFlags = DF
	{ xPosDF       = 0
	, yPosDF       = yRes - panelHeight
	, widthDF      = botPanelSepPos
	, heightDF     = panelHeight
	, alignementDF = "l"
	, fgColorDF    = colorWhiteAlt
	, bgColorDF    = colorBlack
	, fontDF       = dzenFont
	, eventDF      = "onstart=lower"
	, extrasDF     = "-p"
	}

-- Bottom left bar logHook
myBotLeftLogHook :: Handle -> X ()
myBotLeftLogHook h = dynamicLogWithPP $ defaultPP
	{ ppOutput          = hPutStrLn h
	, ppSort            = fmap (namedScratchpadFilterOutWorkspace .) (ppSort defaultPP) --hide "NSP" from workspace list
	, ppOrder           = \(ws:l:_:x) -> [ws] ++ x
	, ppSep             = " "
	, ppWsSep           = ""
	, ppCurrent         = dzenBoxStyle blue2BBoxPP
	, ppUrgent          = dzenBoxStyle green2BBoxPP . dzenClickWorkspace
	, ppVisible         = dzenBoxStyle blackBoxPP . dzenClickWorkspace
	, ppHiddenNoWindows = dzenBoxStyle blackBoxPP . dzenClickWorkspace
	, ppHidden          = dzenBoxStyle whiteBoxPP . dzenClickWorkspace
	, ppExtras          = [ myFsL ]
	} where
		dzenClickWorkspace ws = "^ca(1," ++ xdo "w;" ++ xdo index ++ ")" ++ "^ca(3," ++ xdo "w;" ++ xdo index ++ ")" ++ ws ++ "^ca()^ca()" where
			wsIdxToString Nothing = "1"
			wsIdxToString (Just n) = show $ mod (n+1) $ length myWorkspaces
			index = wsIdxToString (elemIndex ws myWorkspaces)
			xdo key = "xdotool key super+" ++ key

-- Dzen bottom right bar flags
dzenBotRightFlags :: DF
dzenBotRightFlags = DF
	{ xPosDF       = botPanelSepPos
	, yPosDF       = yRes - panelHeight
	, widthDF      = xRes - botPanelSepPos
	, heightDF     = panelHeight
	, alignementDF = "r"
	, fgColorDF    = colorWhiteAlt
	, bgColorDF    = colorBlack
	, fontDF       = dzenFont
	, eventDF      = "onstart=lower"
	, extrasDF     = "-p"
	}

-- Bottom right bar logHook
myBotRightLogHook :: Handle -> X ()
myBotRightLogHook h = dynamicLogWithPP $ defaultPP
	{ ppOutput          = hPutStrLn h
	, ppOrder           = \(_:_:_:x) -> x
	, ppSep             = " "
	, ppExtras          = [ myCpuL, myMemL, myTempL, myWifiL, myBatL ]
	}


--------------------------------------------------------------------------------------------
-- LOGGERS CONFIG                                                                         --
--------------------------------------------------------------------------------------------

myBatL       = (dzenBoxStyleL gray2BoxPP $ labelL "BATTERY") ++! (dzenBoxStyleL blueBoxPP batPercent) ++! (dzenBoxStyleL whiteBoxPP batStatus)
myWifiL      = (dzenBoxStyleL gray2BoxPP $ labelL "WIFI") ++! (dzenBoxStyleL blueBoxPP wifiSignal)
myBrightL    = (dzenBoxStyleL gray2BoxPP $ labelL "BRIGHT") ++! (dzenBoxStyleL blueBoxPP brightPerc)
myTempL      = (dzenBoxStyleL gray2BoxPP $ labelL "TEMP") ++! (dzenBoxStyleL blueBoxPP cpuTemp)
myMemL       = (dzenBoxStyleL gray2BoxPP $ labelL "MEM") ++! (dzenBoxStyleL blueBoxPP memUsage)
myCpuL       = (dzenBoxStyleL gray2BoxPP $ labelL "CPU") ++! (dzenBoxStyleL blueBoxPP $ cpuUsage "/tmp/haskell-cpu-usage.txt")
myFsL        = (dzenBoxStyleL blue2BoxPP $ labelL "ROOT") ++! (dzenBoxStyleL whiteBoxPP $ fsPerc "/") ++! (dzenBoxStyleL blueBoxPP $ labelL "HOME") ++! (dzenBoxStyleL whiteBoxPP $ fsPerc "/home")
myDateL      = (dzenBoxStyleL white2BBoxPP $ date "%A") ++! (dzenBoxStyleL whiteBoxPP $ date $ "%Y^fg(" ++ colorGray ++ ").^fg()%m^fg(" ++ colorGray ++ ").^fg()^fg(" ++ colorRed ++ ")%d^fg() ^fg(" ++ colorGray ++ ")-^fg() %H^fg(" ++ colorGray ++ "):^fg()%M^fg(" ++ colorGray ++ "):^fg()^fg(" ++ colorGreen ++ ")%S^fg()") ++! (dzenClickStyleL calendarCA $ dzenBoxStyleL blueBoxPP $ labelL "CALENDAR")
myUptimeL    = (dzenBoxStyleL blue2BoxPP $ labelL "UPTIME") ++! (dzenBoxStyleL whiteBoxPP uptime)
myFocusL     = (dzenClickStyleL focusCA $ dzenBoxStyleL white2BBoxPP $ labelL "FOCUS") ++! (dzenBoxStyleL whiteBoxPP $ shortenL 100 logTitle)
myLayoutL    = (dzenClickStyleL layoutCA $ dzenBoxStyleL blue2BoxPP $ labelL "LAYOUT") ++! (dzenBoxStyleL whiteBoxPP $ onLogger (layoutText . removeWord . removeWord) logLayout) where
	removeWord = tail . dropWhile (/= ' ')
	layoutText xs
		| isPrefixOf "Mirror" xs       = layoutText $ removeWord xs ++ " [M]"
		| isPrefixOf "ReflectY" xs     = layoutText $ removeWord xs ++ " [Y]"
		| isPrefixOf "ReflectX" xs     = layoutText $ removeWord xs ++ " [X]"
		| isPrefixOf "Simple Float" xs = "^fg(" ++ colorGreen ++ ")" ++ xs
		| isPrefixOf "Full Tabbed" xs  = "^fg(" ++ colorRed ++ ")" ++ xs
		| otherwise                    = "^fg(" ++ colorWhiteAlt ++ ")" ++ xs
myWorkspaceL = (dzenClickStyleL workspaceCA $ dzenBoxStyleL blue2BoxPP $ labelL "WORKSPACE") ++! (dzenBoxStyleL whiteBoxPP $ onLogger namedWorkspaces logCurrent) where
	namedWorkspaces w
		| (elem w $ map show [0..9]) == True = "^fg(" ++ colorGreen ++ ")" ++ w ++ "^fg(" ++ colorGray ++ ")|^fg()" ++ workspacesNames !! (mod ((read w::Int) - 1) 10)
		| otherwise                          = "^fg(" ++ colorRed ++ ")x^fg(" ++ colorGray ++ ")|^fg()" ++ w


--------------------------------------------------------------------------------------------
-- BINDINGS CONFIG                                                                        --
--------------------------------------------------------------------------------------------

-- Key bindings
myKeys :: XConfig Layout -> M.Map (KeyMask, KeySym) (X ())
myKeys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
	--Xmonad bindings
	[((modMask .|. shiftMask, xK_q), io (exitWith ExitSuccess))          	--Quit xmonad
	--, ((modMask, xK_q), restart "xmonad" True)                           	--Restart xmonad
	, ((modMask, xK_q), spawn "killall conky dzen2 haskell-cpu-usage.out && xmonad --restart")	--Restart xmonad
	, ((mod1Mask, xK_F2), shellPrompt myXPConfig)                        	--Launch Xmonad shell prompt
	, ((modMask, xK_F2), xmonadPrompt myXPConfig)                        	--Launch Xmonad prompt
	, ((mod1Mask, xK_F3), manPrompt myXPConfig)                          	--Launch man prompt
	, ((modMask, xK_g), goToSelected $ myGSConfig myColorizer)           	--Launch GridSelect
	, ((modMask, xK_masculine), scratchPad)                              	--Scratchpad
	, ((modMask .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf) 	--Launch default terminal
	--Window management bindings
	, ((modMask, xK_c), kill)                                              	--Close focused window
	, ((mod1Mask, xK_F4), kill)
	, ((modMask, xK_n), refresh)                                           	--Resize viewed windows to the correct size
	, ((modMask, xK_Tab), windows W.focusDown)                             	--Move focus to the next window
	, ((modMask, xK_j), windows W.focusDown)
	, ((mod1Mask, xK_Tab), windows W.focusDown)
	, ((modMask, xK_k), windows W.focusUp)                                 	--Move focus to the previous window
	, ((modMask, xK_a), windows W.focusMaster)                             	--Move focus to the master window
	, ((modMask .|. shiftMask, xK_a), windows W.swapMaster)                	--Swap the focused window and the master 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, xK_h), sendMessage Shrink)                                	--Shrink the master area
	, ((modMask .|. shiftMask, xK_Left), sendMessage Shrink)
	, ((modMask, xK_l), sendMessage Expand)                                	--Expand the master area
	, ((modMask .|. shiftMask, xK_Right), sendMessage Expand)
	, ((modMask .|. shiftMask, xK_h), sendMessage MirrorShrink)            	--MirrorShrink the master area
	, ((modMask .|. shiftMask, xK_Down), sendMessage MirrorShrink)
	, ((modMask .|. shiftMask, xK_l), sendMessage MirrorExpand)            	--MirrorExpand the master area
	, ((modMask .|. shiftMask, xK_Up), sendMessage MirrorExpand)
	, ((modMask, xK_t), withFocused $ windows . W.sink)                    	--Push window back into tiling
	, ((modMask .|. shiftMask, xK_t), rectFloatFocused)                    	--Push window into float
	, ((modMask, xK_m), withFocused minimizeWindow)                        	--Minimize window
	, ((modMask, xK_b), withFocused (sendMessage . maximizeRestore))       	--Maximize window
	, ((modMask .|. shiftMask, xK_m), sendMessage RestoreNextMinimizedWin) 	--Restore window
	, ((modMask .|. shiftMask, xK_f), fullFloatFocused)                    	--Push window into full screen
	, ((modMask, xK_comma), sendMessage (IncMasterN 1))                    	--Increment the number of windows in the master area
	, ((modMask, xK_period), sendMessage (IncMasterN (-1)))                	--Deincrement the number of windows in the master area
	, ((modMask, xK_Right), sendMessage $ Go R)                            	--Change focus to right
	, ((modMask, xK_Left ), sendMessage $ Go L)                            	--Change focus to left
	, ((modMask, xK_Up   ), sendMessage $ Go U)                            	--Change focus to up
	, ((modMask, xK_Down ), sendMessage $ Go D)                            	--Change focus to down
	, ((modMask .|. controlMask, xK_Right), sendMessage $ Swap R)          	--Swap focused window to right
	, ((modMask .|. controlMask, xK_Left ), sendMessage $ Swap L)          	--Swap focused window to left
	, ((modMask .|. controlMask, xK_Up   ), sendMessage $ Swap U)          	--Swap focused window to up
	, ((modMask .|. controlMask, xK_Down ), sendMessage $ Swap D)          	--Swap focused window to down
	--Layout management bindings
	, ((modMask, xK_space), sendMessage NextLayout)                                                                                    --Rotate through the available layout algorithms
	, ((modMask, xK_v ), sendMessage ToggleLayout)                                                                                     --Toggle window titles (can click drag to move windows)
	, ((modMask .|. shiftMask, xK_space ), flashText myTextConfig 1 " Set to Default Layout " >> (setLayout $ XMonad.layoutHook conf)) --Reset layout to workspaces default
	, ((modMask, xK_f), sendMessage $ XMonad.Layout.MultiToggle.Toggle TABBED)                                                         --Push layout into tabbed
	, ((modMask .|. controlMask, xK_f), sendMessage $ XMonad.Layout.MultiToggle.Toggle FLOATED)                                        --Push layout into float
	, ((modMask .|. shiftMask, xK_z), sendMessage $ XMonad.Layout.MultiToggle.Toggle MIRROR)                                           --Push layout into mirror
	, ((modMask .|. shiftMask, xK_x), sendMessage $ XMonad.Layout.MultiToggle.Toggle REFLECTX)                                         --Reflect layout by X
	, ((modMask .|. shiftMask, xK_y), sendMessage $ XMonad.Layout.MultiToggle.Toggle REFLECTY)                                         --Reflect layout by Y
	--Gaps management bindings
	, ((modMask .|. controlMask, xK_t), sendMessage $ ToggleStruts ) --toogle the all struts
	, ((modMask .|. controlMask, xK_u), sendMessage $ ToggleStrut U) --toogle the top strut
	, ((modMask .|. controlMask, xK_d), sendMessage $ ToggleStrut D) --toogle the bottom strut
	--Scripts management bindings
	, ((modMask, xK_d), spawn "killall dzen2 haskell-cpu-usage.out")                                             	      	--Kill dzen2
	, ((mod1Mask, xK_Up), spawn "/home/renodesper/.xmonad/voldzen.sh + -d")													--Raise volume
	, ((mod1Mask, xK_Down), spawn "/home/renodesper/.xmonad/voldzen.sh - -d")												--Lower volume
	, ((mod1Mask, xK_Right), flashText myTextConfig 1 " Next Song " >> spawn "ncmpcpp next")								--Next song
	, ((mod1Mask, xK_Left), flashText myTextConfig 1 " Previous Song " >> spawn "ncmpcpp prev")								--Prev song
	, ((mod1Mask .|. controlMask, xK_Down), flashText myTextConfig 1 " Song Toggled " >> spawn "ncmpcpp toggle")			--Toggle song
	, ((mod1Mask .|. controlMask, xK_Up), flashText myTextConfig 1 " Song Stopped " >> spawn "ncmpcpp stop")				--Stop song
	, ((0, xK_Print), spawn "scrot '%Y-%m-%d_$wx$h.png'")                                                        			--Take a screenshot
	--Workspaces management bindings
	, ((mod1Mask, xK_comma), flashText myTextConfig 1 " Toggled to Previous Workspace " >> toggleWS)                          --Toggle to the workspace displayed previously
	, ((mod1Mask, xK_masculine), flashText myTextConfig 1 " Switching with Workspace 1 " >> toggleOrView (myWorkspaces !! 0)) --If ws != 0 then move to workspace 0, else move to latest ws I was
	, ((mod1Mask .|. controlMask, xK_Left), flashText myTextConfig 1 " Moved to Previous Workspace " >> prevWS)               --Move to previous Workspace
	, ((mod1Mask .|. controlMask, xK_Right), flashText myTextConfig 1 " Moved to Next Workspace " >> nextWS)                  --Move to next Workspace
	, ((modMask .|. shiftMask, xK_n), flashText myTextConfig 1 " Shifted to Next Workspace " >> shiftToNext)                  --Send client to next workspace
	, ((modMask .|. shiftMask, xK_p), flashText myTextConfig 1 " Shifted to Previous Workspace " >> shiftToPrev)              --Send client to previous workspace
	] ++
	[ ((m .|. modMask, k), windows $ f i)                                                        --Switch to n workspaces and send client to n workspaces
	  | (i, k) <- zip (XMonad.workspaces conf) ([xK_1 .. xK_9] ++ [xK_0])
	  , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]
	] ++
	[ ((m .|. modMask, key), screenWorkspace sc >>= flip whenJust (windows . f))                 --Switch to n screens and send client to n screens
	  | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
	  , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]
	] where
		fullFloatFocused = withFocused $ \f -> windows =<< appEndo `fmap` runQuery doFullFloat f
		rectFloatFocused = withFocused $ \f -> windows =<< appEndo `fmap` runQuery (doRectFloat $ RationalRect 0.05 0.05 0.9 0.9) f

-- Mouse bindings
myMouseBindings :: XConfig Layout -> M.Map (KeyMask, Button) (Window -> X ())
myMouseBindings (XConfig {XMonad.modMask = modMask}) = M.fromList $
	[ ((modMask, button1), (\w -> focus w >> mouseMoveWindow w >> windows W.shiftMaster)) --Set the window to floating mode and move by dragging
	, ((modMask, button2), (\w -> focus w >> windows W.shiftMaster))                      --Raise the window to the top of the stack
	, ((modMask, button3), (\w -> focus w >> Flex.mouseResizeWindow w))                   --Set the window to floating mode and resize by dragging
	, ((modMask, button4), (\_ -> prevWS))                                                --Switch to previous workspace
	, ((modMask, button5), (\_ -> nextWS))                                                --Switch to next workspace
	, (((modMask .|. shiftMask), button4), (\_ -> shiftToPrev))                           --Send client  to previous workspace
	, (((modMask .|. shiftMask), button5), (\_ -> shiftToNext))                           --Send client  to next workspace
	]

I hope you guys can help me with this problem. Thank you smile

PS: xmonad.errors doesn't show anything

Last edited by renodesper (2013-07-12 21:52:12)

Offline

#574 2013-07-14 16:51:25

renodesper
Member
From: Bandung
Registered: 2010-12-26
Posts: 43
Website

Re: xmonad Hacking Thread

renodesper wrote:

Hi guys, I'm using an example config from xmonad config archive (you can find it here: https://github.com/nnoell/dotfiles/tree … v4/xmonad). It's working but I have a problem. The creator says that I should compile it manually with ghc because the config file use non-official module. It compiled without problem but when I try to restart it using "xmonad --restart",  it just close my X. I thought it was slim problem but it also happen when I try to log in with startx. Here is my xmonad.hs:

I hope you guys can help me with this problem. Thank you smile

PS: xmonad.errors doesn't show anything

I found the problem but I don't know how to fix it, it's DzenBoxLoggers. Well, I think I have to find another statusbar for now.

Offline

#575 2013-07-25 12:22:37

billdangerous
Member
Registered: 2013-07-25
Posts: 1

Re: xmonad Hacking Thread

Hi,

I am quite new on xmonad and I'm looking for a tricky feature smile
I would like to manage groups of workspaces. For example, I can work on several activities at the same time and each one needs several workspaces. So I would like to be able to select my activity, and then to select my workspace for this activity.
Default xmonad behavior would be in what I want to have, workspaces with only one activity or workspace group (call it like you want).

I found DynamicWorkspaceGroups that sounds good to me, but I do not succeeded to use it well. And I do not succeed to add workspace in groups. It is like I could tag them, but it is not exactly my goal.

If someone has experience on that problem, It would be very helpful.

Thank you in advance,
Bill

Offline

Board footer

Powered by FluxBB