You are not logged in.

#401 2010-09-02 08:37:39

dudell
Member
Registered: 2009-09-05
Posts: 8

Re: xmonad Hacking Thread

My problem is that I want to run or raise cmus which runs in an urxvt terminal. I can't match on the class name because it is URxvt. The title of the windows is changed with the id3 tag.
Is it possible to set the WM_Class of a window? Or is there another attribute on which I can match?

, ((0, 0x1008ff81), runOrRaise "urxvt -e '/usr/bin/cmus'"  (className =? "cmus"))

Offline

#402 2010-09-02 13:00:44

soderstrom
Member
Registered: 2010-08-30
Posts: 10

Re: xmonad Hacking Thread

Knute wrote:

Haskell is pickier than other languages about white space. 

That's saying that line 15  space zero  of your xmonad.hs file is not indented correctly.

From my experience it could be even a line before that or after it, but it is helpful.  All you need to do is go in and check your indenting.  If all you did was a cut and paste, then you may need to go back in and adjust indenting so that it looks like what was posted.
(Indenting and such is also why we use code tags when we post code, because some languages are picky about indenting, like haskell, and some, like perl and awk, don't care if you have extra spaces or not.)

HTH

I got it now and the basics works like it should. Thanks for helping out smile

Offline

#403 2010-09-02 15:42:56

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

Re: xmonad Hacking Thread

dudell wrote:

My problem is that I want to run or raise cmus which runs in an urxvt terminal. I can't match on the class name because it is URxvt. The title of the windows is changed with the id3 tag.
Is it possible to set the WM_Class of a window? Or is there another attribute on which I can match?

, ((0, 0x1008ff81), runOrRaise "urxvt -e '/usr/bin/cmus'"  (className =? "cmus"))

try explicitly setting a resource and finding it my that.  i use it for in-terminal scratchpads:

, ((0, 0x1008ff81), runOrRaise "urxvt -name MYNAME -e /usr/bin/cmus"  (resource =? "MYNAME"))

Last edited by brisbin33 (2010-09-02 15:43:36)

Offline

#404 2010-10-02 19:50:52

Arthenik
Member
Registered: 2010-02-13
Posts: 44

Re: xmonad Hacking Thread

I'm currently trying to configure the width of borders around windows, but the following happens (sorry for the low quality screenshot):

2010-10-02-2140_1366x768.png

http://s7.photobucket.com/albums/y260/A … 66x768.png

There is no border on the left side of the leftmost window and there are no borders at the top where windows touch my dzen2 status bar (which is unfinished - this is a user configuration from xmonad.org which really caught my eye and I haven't yet found the time to finish it). I also get the feeling that a few rows pixels on the left are cut off.

Is there a way to have a left and top border?

Thanks. smile

Offline

#405 2010-10-02 23:53:32

Runiq
Member
From: Germany
Registered: 2008-10-29
Posts: 1,053

Re: xmonad Hacking Thread

Arthenik wrote:

There is no border on the left side of the leftmost window and there are no borders at the top where windows touch my dzen2 status bar […].

The same happens here whenever I use a compositing manager such as xcompmgr or cairo-compmgr. Disable them, and the borders will be displayed right (I hope).

I don't know how to resolve this, though—I think there's a bug report on the XMonad tracker somewhere.

Offline

#406 2010-10-03 09:07:50

hume's doona
Member
Registered: 2009-12-11
Posts: 206

Re: xmonad Hacking Thread

My .xmobarrc won't parse, running it from the command line doesn't give output, it just has "could not parse the template" in the bar

.xmobarrc

Config { bgColor = "black"
       , fgColor = "green"
       , position = Top
       , lowerOnStart = True
       , commands = [ Run StdinReader
                    , Run Network "eth0" ["-L","0","-H","32","--normal","green","--high","red"] 10
                    , Run Network "PPP0" ["-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:%S" "date" 10
                    ]
       , sepChar = "%"
       , alignSep = "}{"
       , template = "%cpu% | %memory% * %swap% | %eth0% - %PPP0% }{ <fc=#ee9a00>%date%</fc> | %uname% | %StdinReader%"
       }

Can anyone help with this please?

edit: It'll run from command line with the -b option

Last edited by hume's doona (2010-10-03 12:17:02)

Offline

#407 2010-10-03 11:33:09

Arthenik
Member
Registered: 2010-02-13
Posts: 44

Re: xmonad Hacking Thread

Runiq wrote:
Arthenik wrote:

There is no border on the left side of the leftmost window and there are no borders at the top where windows touch my dzen2 status bar […].

The same happens here whenever I use a compositing manager such as xcompmgr or cairo-compmgr. Disable them, and the borders will be displayed right (I hope).

I don't know how to resolve this, though—I think there's a bug report on the XMonad tracker somewhere.

I don't want to give up cairo-compmgr, it's just so pretty. smile

I guess I'll just have to wait until the dev team sorts it out. Thanks for the information though.

Offline

#408 2010-10-04 06:21:14

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

Re: xmonad Hacking Thread

Hi all,

I would like to use the FadeInactive hook in my xmonad.hs in addition to the DynamicLog hook.

The documentation for FadeInactive gives the following usage example:

myLogHook = fadeInactiveLogHook fadeAmount
     where fadeAmount = 0.8

Currently the logHook section of my xmonad.hs looks like this:

    , logHook            = dynamicLogWithPP $ xmobarPP
                               { ppOutput = hPutStrLn myStatusBarPipe
                               , ppLayout = xmobarColor "grey" "" .
                                            (\x -> case x of
                                                     "Tall"        -> "[]-"
                                                     "Mirror Tall" -> "TT"
                                                     "Grid"        -> "+"
                                                     "Full"        -> "[_]"
                                                     _             -> ""
                                           )
                               , ppTitle  = xmobarColor "yellow" "" . shorten 100
                               } 

How can I combine FadeInactive with dynamicLogWithPP? I have tried various things like putting '>> fadeInactiveLogHook fadeAmount' after the last bracket, or 'fadeInactiveLogHook fadeAmount >>' before the dynamicLog stuff, but can't seem to find where to put the 'where fadeAmount = 0.8' part.

Offline

#409 2010-10-04 10:59:50

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,092

Re: xmonad Hacking Thread

fadeInactiveLogHook 0.8 >> dynamicLogWithPP xmobarPP { ... }

Btw: you could use the statusBar function to avoid having to spawn the pipe and mess with the loghook yourself, and you can replace that case in ppLayout with X.L.NamedLayouts


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#410 2010-10-04 16:31:51

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

Re: xmonad Hacking Thread

Thanks Elendig. Although Xmonad is generally pretty easy to configure, Haskell is a complete mystery to me, so I sometimes have trouble with some stuff. Your simple solution for the fadeInactiveLogHook worked perfectly. I have also taken your suggestion about named layouts; thanks for that. I'll have to leave the tweaking of the status bar for another day, but thanks for the tip.

Offline

#411 2010-10-08 09:19:19

Runiq
Member
From: Germany
Registered: 2008-10-29
Posts: 1,053

Re: xmonad Hacking Thread

Arthenik wrote:

I guess I'll just have to wait until the dev team sorts it out. Thanks for the information though.

I just looked and couldn't find this on the tracker, so I reported it. Has anybody else noticed this, or is it just the two of us?

Offline

#412 2010-10-08 09:24:04

Runiq
Member
From: Germany
Registered: 2008-10-29
Posts: 1,053

Re: xmonad Hacking Thread

By the way, has anybody else noticed that urxvt doesn't have borders at all if used with -depth 32? This seems to happen whether a compositing manager is active or not.

Offline

#413 2010-10-08 10:08:27

Anntoin
Member
Registered: 2009-08-10
Posts: 42
Website

Re: xmonad Hacking Thread

@Runiq and Arthenik

What are your xmonad configs like? I've used xcompmgr and cairo-compmgr (with several xmonad configs) and never had this type of problem. Although I did find cairo-compmgr a bit unstable (which is a shame as it is very pretty).

Offline

#414 2010-10-08 11:01:49

Runiq
Member
From: Germany
Registered: 2008-10-29
Posts: 1,053

Re: xmonad Hacking Thread

Anntoin wrote:

@Runiq and Arthenik

What are your xmonad configs like? I've used xcompmgr and cairo-compmgr (with several xmonad configs) and never had this type of problem. Although I did find cairo-compmgr a bit unstable (which is a shame as it is very pretty).

import XMonad
import List
import Data.Monoid
import System.Exit
import System.IO
import Graphics.X11.ExtraTypes.XF86
import qualified XMonad.StackSet as W
import qualified Data.Map        as M

import XMonad.Layout.IM
import XMonad.Layout.NoBorders
import XMonad.Layout.PerWorkspace
import XMonad.Layout.ResizableTile
import XMonad.Layout.Reflect
import XMonad.Layout.Spacing

import XMonad.Hooks.DynamicLog
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.UrgencyHook

--------------------------
-- Miscellaneous stuff: --
--------------------------

myTerminal      = "urxvtc"

myModMask       = mod4Mask

dmenuCmd = "`dmenu_path | dmenu -i -b -p 'Execute:' " 
    ++ -nb '" ++ myVisibleBgColor 
    ++ "' -nf '" ++ myVisibleFgColor 
    ++ "' -sb '" ++ myGeneralBgColor 
    ++ "' -sf '" ++ myGeneralFgColor 
    ++ "' -fa '" ++ myFont 
    ++ "'`"

myNumlockMask   = mod2Mask

myVolStep = "1"

myWorkspaces    = ["一","二","三","四","五","六","七","八","九"]

myBorderWidth = 2
myNormalBorderColor  = "#1550aa"
myFocusedBorderColor = "#fafafa"

myIconPath = "/home/runiq/.config/dzen2/icons/"

myFontName = "Inconsolata"
myFontSize = "11"
myFont = myFontName ++ "-" ++ myFontSize

myJapFontName = "IPAGothic"
myJapFontSize = "18"
myJapaneseFont = myJapFontName ++ "-" ++ myJapFontSize

myGeneralFgColor = "#262729"
myGeneralBgColor = "#ffffff"

-----------------------------
-- Status bars and logging --
-----------------------------

myStatusBar = statusBar dzenBar myPP toggleStrutsKey

toggleStrutsKey XConfig {XMonad.modMask = modMask} = (myModMask, xK_z)

dzenBar = "dzen2 -y -1 -e '' -w 1280 -ta l " 
    ++ "-h 20 -fg '" ++ myGeneralFgColor 
    ++ "' -bg '" ++ myGeneralBgColor 
    ++ "' -fn '" ++ myFont 
    ++ "'"

myCurrentFgColor = myGeneralFgColor
myCurrentBgColor = myGeneralBgColor
myVisibleFgColor = "#1994d1"
myVisibleBgColor = myGeneralBgColor
myHiddenFgColor  = "#1550aa"
myHiddenBgColor  = myGeneralBgColor
myHiddenNWFgColor = "#888888"
myHiddenNWBgColor = myGeneralBgColor
myUrgentFgColor  = "#e04613"
myUrgentBgColor  = myGeneralBgColor
myTitleFgColor = myGeneralFgColor
myTitleBgColor = myGeneralBgColor
myLayoutFgColor = "#1550aa"
myLayoutBgColor = myGeneralBgColor
mySep = " "
myWsSep = " "

myPP = defaultPP
    { ppCurrent = wrapFont myJapaneseFont . dzenColor myCurrentFgColor myCurrentBgColor
    , ppVisible = wrapFont myJapaneseFont . dzenColor myVisibleFgColor myVisibleBgColor . wrapWorkspace
    , ppHidden = wrapFont myJapaneseFont . dzenColor myHiddenFgColor myHiddenBgColor . wrapWorkspace
    , ppUrgent = wrapFont myJapaneseFont . dzenColor myUrgentFgColor myUrgentBgColor . wrapWorkspace . dzenStrip
    , ppSep = mySep
    , ppWsSep = myWsSep
    , ppTitle = dzenColor myTitleFgColor myTitleBgColor
    , ppLayout = wrapLayout "space" . dzenColor myLayoutFgColor"" . layoutNames
    }
    where
        layoutNames x
            | x == "Spacing 2 ResizableTall" = wrapBitmap "dzen_bitmaps/tall.xbm"
            | x == "Spacing 2 Mirror ResizableTall" = wrapBitmap "dzen_bitmaps/mtall.xbm"
            | x == "Spacing 2 Full" = wrapBitmap "dzen_bitmaps/full.xbm"
            | x == "Spacing 2 IM ReflectX IM ResizableTall" = wrapBitmap "dzen_bitmaps/tall.xbm"
            | x == "Spacing 2 IM ReflectX IM Mirror ResizableTall" = wrapBitmap "dzen_bitmaps/mtall.xbm"
            | x == "Spacing 2 IM ReflectX IM Full" = wrapBitmap "dzen_bitmaps/full.xbm"
            | otherwise = x
            where
                wrapBitmap bitmap = "^p(5)^i(" ++ myIconPath ++ bitmap ++ ")^p(5)"

        currentWsIndex w = case (elemIndex w myWorkspaces) of
                                Nothing -> "1"
                                Just n -> show (n + 1)

        wrapWorkspace content = wrap ("^ca(1,xdotool key super+" ++ (currentWsIndex content) ++ ")") "^ca()" content

        wrapLayout key = wrap ("^ca(1,xdotool key super+" ++ key ++ ")") "^ca()"

        wrapFont font = wrap ("^fn(" ++ font ++ ")") "^fn()"


--------------
-- Layouts: --
--------------

myLayout = spacing 5 $ smartBorders $ onWorkspace "六" gimpLayout $ standardLayouts
  where
     standardLayouts = tiled ||| Mirror tiled ||| Full
     gimpLayout = withIM (0.11) (Role "gimp-toolbox") $
         reflectHoriz $
         withIM (0.15) (Role "gimp-dock") standardLayouts
     tiled   = ResizableTall nmaster delta ratio slaves
         where
             nmaster = 1
             -- Golden ratio:
             ratio   = toRational (2 / (1 + sqrt 5 :: Double))
             delta   = 3/100
             slaves  = []


-------------------
-- Manage Hook --
-------------------

myManageHook = composeAll 
    [ isFullscreen                  --> doF W.focusDown <+> doFullFloat
    , isDialog                      --> doFloat
    , className =? "Galculator"     --> doFloat
    , className =? "Firefox"        --> doShift "一"
    , title =? "mcabber"            --> doShift "三"
    , className =? "MPlayer"        --> doFloat <+> doShift "四" 
    , className =? "feh"            --> doFloat
    , title =? "ncmpc" <||> title =? "ncmpcpp" --> doShift "四"
    , className =? "Ossxmix"        --> doShift "四"
    , (className =? "Gimp") <||> (className =? "Gimp-2.6") --> doShift "六"
    , className =? "mednafen"       --> doFloat <+> doShift "五"
    , className =? "jd-Main"        --> doShift "七" 
    , title =? "rtorrent"            --> doShift "七"
    ]


------------------
-- Key bindings --
------------------

myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $

    -- launch a terminal
    [ ((modm,               xK_y     ), spawn $ XMonad.terminal conf)
    -- launch dmenu
    , ((modm,               xK_x     ), spawn ("eval exec " ++ dmenuCmd))
    -- close focused window
    , ((modm .|. shiftMask, xK_x     ), 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_z     ), refresh)
    -- Move focus to the next window
    , ((modm,               xK_n     ), windows W.focusDown)
    -- Move focus to the previous window
    , ((modm,               xK_r     ), 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_n     ), windows W.swapDown  )
    -- Swap the focused window with the previous window
    , ((modm .|. shiftMask, xK_r     ), windows W.swapUp    )
    -- Shrink the master area
    , ((modm,               xK_s     ), sendMessage Shrink)
    -- Expand the master area
    , ((modm,               xK_t     ), sendMessage Expand)
    -- Push window back into tiling
    , ((modm,               xK_b     ), 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)))
    -- Quit xmonad
    , ((modm .|. shiftMask, xK_q     ), io (exitWith ExitSuccess))
    -- Restart xmonad
    , ((modm              , xK_q     ), spawn "xmonad --recompile; xmonad --restart")

    -- my own keybindings

    -- Control MPD
    , ((modm              , xK_Left   ), spawn "mpc prev")
    , ((modm              , xK_Right  ), spawn "mpc next")
    , ((modm              , xK_Down   ), spawn "mpc toggle")
    , ((modm              , xK_Up     ), spawn "mpc random")
    -- Toggle between Mute and non-mute
    , ((0                 , xF86XK_AudioMute), spawn "ossmix misc.front-mute toggle")
    -- Lower volume by <myVolStep> Db
    , ((0                 , xF86XK_AudioLowerVolume), spawn ("ossmix vmix0-outvol -- -" ++ myVolStep))
    -- Raise volume by <myVolStep> Db
    , ((0                 , xF86XK_AudioRaiseVolume), spawn ("ossmix vmix0-outvol -- +" ++ myVolStep))
    -- TODO: Write a function to display headphone/speaker output
    -- Shrink slave windows
    , ((modm .|. shiftMask, xK_t      ), sendMessage MirrorShrink)
    -- Expand slave windows
    , ((modm .|. shiftMask, xK_s      ), sendMessage MirrorExpand)
    ]
    ++
    -- 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.view, 0), (W.shift, shiftMask)]]
    ++
    -- mod-{v,l,c}, Switch to physical/Xinerama screens 1, 2, or 3
    -- mod-shift-{v,l,c}, Move client to screen 1, 2, or 3
    -- No greedyView --> no swapping of workspaces (which is weird anyway)
    [((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
        | (key, sc) <- zip [xK_v, xK_l, xK_c] [1,0,2]
        , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]



--------------------
-- Mouse bindings --
--------------------

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)
    ]

------------
-- Config --
------------

myConfig = withUrgencyHook NoUrgencyHook $ ewmh defaultConfig {
        terminal           = myTerminal,
        modMask            = myModMask,
        numlockMask        = myNumlockMask,
        workspaces         = myWorkspaces,
        borderWidth        = myBorderWidth,
        normalBorderColor  = myNormalBorderColor,
        focusedBorderColor = myFocusedBorderColor,
        keys               = myKeys,
        mouseBindings      = myMouseBindings,
        layoutHook         = myLayout,
        manageHook         = myManageHook,
    }


------------
-- Start! --
------------

main = do
    xmonad =<< myStatusBar myConfig

If it works for you, it must be something in my config. I'll try and change one thing at a time and report back *sigh*.

Last edited by Runiq (2010-10-08 11:02:43)

Offline

#415 2010-10-09 09:54:40

Arthenik
Member
Registered: 2010-02-13
Posts: 44

Re: xmonad Hacking Thread

Anntoin wrote:

@Runiq and Arthenik

What are your xmonad configs like? I've used xcompmgr and cairo-compmgr (with several xmonad configs) and never had this type of problem. Although I did find cairo-compmgr a bit unstable (which is a shame as it is very pretty).

-----------------------------------------------------------------------
--
-- Module      :  xmonad.hs
-- Copyright   :  (c) Sean Escriva 2008
-- License     :  BSD3-style (see LICENSE)
--
-- Maintainer  :  sean.escriva@gmail.com
-- Stability   :  unstable
-- Portability :  not portable,
--
-- customization for the xmonad window manager
-----------------------------------------------------------------------
 
-- Imports {{{
import XMonad
-- Hooks
import XMonad.Hooks.DynamicLog hiding (xmobar, xmobarPP, xmobarColor, sjanssenPP, byorgeyPP)
import XMonad.Hooks.UrgencyHook (withUrgencyHook, NoUrgencyHook(..), focusUrgent)
import XMonad.Hooks.ManageDocks (avoidStruts, manageDocks, ToggleStruts(..))
import XMonad.Hooks.ManageHelpers (isFullscreen, isDialog,  doFullFloat, doCenterFloat)
import XMonad.Hooks.SetWMName
-- Prompt
import XMonad.Prompt
import XMonad.Prompt.RunOrRaise (runOrRaisePrompt)
import XMonad.Prompt.AppendFile (appendFilePrompt)
-- Actions
import XMonad.Actions.CycleWS (nextWS, prevWS, shiftToNext, shiftToPrev, toggleWS, WSType(..), findWorkspace)
import XMonad.Actions.WindowGo (title, raiseMaybe, runOrRaise) --, (=?))
import XMonad.Actions.UpdatePointer
import qualified XMonad.Actions.Search as S
import XMonad.Actions.GridSelect
-- Util
import XMonad.Util.Run (safeSpawn, unsafeSpawn, runInTerm, spawnPipe)
import XMonad.Util.Scratchpad (scratchpadSpawnAction, scratchpadManageHook, scratchpadFilterOutWorkspace)
import XMonad.Util.XSelection (safePromptSelection)
import XMonad.Util.EZConfig hiding (additionalMouseBindings, removeMouseBindings)
import XMonad.Util.WorkspaceCompare (getSortByIndex)
import XMonad.Util.Loggers
-- Layouts
import XMonad.Layout.NoBorders (smartBorders)
import XMonad.Layout.ResizableTile (ResizableTall(..))
import XMonad.Layout.Grid (Grid(..))
import XMonad.Layout.Magnifier (magnifiercz)
import XMonad.Layout.PerWorkspace (onWorkspace)
import XMonad.Layout.IM
import XMonad.Layout.Reflect (reflectHoriz)
import XMonad.Layout.Named
 
import System.IO (hPutStrLn)
import Data.Char (isSpace)
import qualified XMonad.StackSet as W
--}}}
 
-- Main {{{
main :: IO ()
main = do
    dzpipe <- spawnPipe statusBarCmd
    xmonad $ withUrgencyHook NoUrgencyHook $ defaultConfig
        { terminal              = mTerm
        , focusFollowsMouse     = False
        , borderWidth           = 2
        , modMask               = mod4Mask -- win key
        , workspaces            = ["web","irc","media","term","code","read","math","gfx","misc"]
        , normalBorderColor     = colorNormalBorder
        , focusedBorderColor    = colorFocusedBorder
        , layoutHook            = avoidStruts $ 
                                  smartBorders (
                                               onWorkspace "term" grids $
                                               onWorkspace "web" mostlyTall $
                                               onWorkspace "gfx" gimp standardLayouts)
        , manageHook            = mManageHook -- <+> manageMonitor screenletRingSensor
        , logHook               = (dynamicLogWithPP $ mPP dzpipe) >> updatePointer (Relative 0.95 0.95)
        , startupHook           = return () >> checkKeymap defaultConfig lacKeys >> setWMName "LG3D"
        }
        `additionalKeysP` lacKeys
-- }}}
 
-- Config {{{ 
-- single options here, more complex settings(by comparison) get separated
-- }}}
 
-- Theme {{{
-- Color names are easier to remember:
colorOrange          = "#ff7701"
colorDarkGray        = "#171717"
colorPink            = "#d8bfd8"
-- colorPink            = "#e3008d"
colorGreen           = "#00aa4a"
-- colorGreen           = "#9acd32"
colorBlue            = "#008dd5"
colorYellow          = "#ffc125"
-- colorYellow          = "#fee100"
colorWhite           = "#dddddd"
-- colorWhite           = "#cfbfad"
 
colorNormalBorder    = "#1c2636"
colorFocusedBorder   = "#2797d8"
barFont  = "DejaVu Sans Mono" -- terminus
barXFont = "DejaVu Sans Mono:size=12" -- inconsolata
xftFont = "xft: DejaVu Sans Mono-12" -- inconsolata
--}}}
statusBarCmd = "dzen2" ++
               " -bg '" ++ colorDarkGray ++ "'" ++
               " -fg '" ++ colorBlue ++ "'" ++
               " -sa c" ++
               " -fn '" ++ barXFont ++ "'" ++
               " -w 1366 -x 0 -y 0 -ta l -e ''"
 
mTerm     = "urxvtc"
 
-- Pretty printer {{{
-- dynamiclog pretty printer for dzen
mPP h = defaultPP
        { ppCurrent = wrap ("^fg(" ++ colorOrange ++ ")^bg(" ++ colorDarkGray ++ ")^p(2)") "^p(2)^fg()^bg()"
        , ppVisible = wrap ("^fg(" ++ colorBlue ++ ")^bg(" ++ colorDarkGray ++ ")^p(2)") "^p(2)^fg()^bg()"
        , ppSep     = " ^fg(grey60)^r(1x8)^fg() "
        , ppLayout  = dzenColor colorWhite "". (\x -> case x of
                                                            "Mirror Tall"                               -> "^p(1)^i(/home/dominik/.xmonad/dzen/mtall.xbm)^p(1)"
                                                            "ResizableTall"                             -> "^p(1)^i(/home/dominik/.xmonad/dzen/tall.xbm)^p(1)"
                                                            "Full"                                      -> "^p(1)^i(/home/dominik/.xmonad/dzen/full.xbm)^p(1)"
                                                            "Magnifier GridRatio 1.3333333333333333"    -> "^p(1)^i(/home/dominik/.xmonad/dzen/mgrid.xbm)^p(1)"
                                                            "GridRatio 1.3333333333333333"              -> "^p(1)^i(/home/dominik/.xmonad/dzen/grid.xbm)^p(1)"
                                                            "ReflectX Gimp"                             -> "^p(1)^i(/home/dominik/.xmonad/dzen/reflectx.xbm)^p(1)"
                                                            _                                           -> x
                                                   )
        , ppUrgent  = dzenColor colorDarkGray colorYellow . wrap "[" "]"
        , ppTitle   = dzenColor colorWhite "" . trim
        , ppOutput  = hPutStrLn h
        }
 
--}}}
 
-- Prompt Config {{{
mXPConfig :: XPConfig
mXPConfig =
    defaultXPConfig { font                  = barFont
                    , bgColor               = colorDarkGray
                    , fgColor               = colorGreen
                    , bgHLight              = colorGreen
                    , fgHLight              = colorDarkGray
                    , promptBorderWidth     = 0
                    , height                = 14
                    , historyFilter         = deleteConsecutive
                    }
 
largeXPConfig :: XPConfig
largeXPConfig = mXPConfig
                { font = xftFont
                , height = 20
                }
-- }}}
 
-- Layout Hook{{{
standardLayouts = Mirror tiled  |||
                  defaultTall   |||
                  Full
                where
                  tiled       = Tall nmaster delta ratio
                  defaultTall = ResizableTall 1 (3/100) (1/2) []
                  nmaster     = 1
                  ratio       = toRational (2/(1 + sqrt 5 :: Double)) -- golden, thx Octoploid
                  delta       = 0.03
 
grids = GridRatio (4/3)
--       ||| magnifiercz 1.2 (GridRatio (4/3))
 
mostlyTall = ResizableTall 1 (3/100) (1/2) [] ||| Full
gimp     = reflectHoriz $ 
           named "Gimp" $ 
           withIM (11/64) (Role "gimp-toolbox") $ 
           ResizableTall 2 (1/118) (11/20) [5/4,5/4,5/4]
--}}}
-- Window rules aka Manage Hook {{{
mManageHook :: ManageHook
mManageHook = scratchpadManageHook (W.RationalRect 0.25 0.375 0.5 0.35) <+>
               (composeAll . concat $
    [ [ className =? c --> doFloat        | c <- floats ],
      [ className =? w --> doShift "web"  | w <- webs]   ,
      [ className =? g --> doShift "game" | g <- games]  ,
      [ className =? m --> doShift "mail" | m <- mails]  ,
      [ resource  =? "desktop_window"  --> doIgnore
      , className =? "Kile"            --> doShift "code"
      , className =? "VirtualBox"      --> doShift "win"
      , className =? "Tsclient"        --> doShift "win"
      , className =? "Vncviewer"       --> doShift "win"
      , className =? "Gimp"            --> doShift "gfx"
      , className =? "mtPaint"            --> doShift "gfx"
      , title     =? "irssi"           --> doShift "irc"
      , title     =? "zathura"         --> doShift "read"
      , title     =? "mutt"            --> doShift "mail"
      , title     =? "Save a Bookmark" --> doCenterFloat
      , isFullscreen                   --> doFullFloat
      , isDialog                       --> doCenterFloat
      ] ])
        <+> manageDocks -- make some space
            where floats = ["Mplayer","Tsclient","VirtualBox","Gtklp","smc"]
                  webs   = ["Navigator","Gran Paradiso","Firefox", "Midori", "Namoroka", "Vimperator"]
                  games  = ["roguestar-gl","neverputt","neverball","wesnoth"]
                  mails  = ["Evolution", "Thunderbird-bin", "Shredder"]
-- }}}
lacKeys :: [([Char], X ())]
lacKeys =
    [ ("M-p"        , runOrRaisePrompt largeXPConfig )
    , ("M-S-p"      , spawn "exe=`dmenu_path | dmenu -b` \"exec $exe\"") -- backup launcher
    , ("M-w"        , goToSelected defaultGSConfig)
    , ("M-S-z"      , unsafeSpawn "zathura")
    , ("M-z"        , unsafeSpawn "firefox")
    , ("M-<Esc>"    , focusUrgent)
    , ("M-S-l"      , unsafeSpawn "slock")                  -- screen lock
    , ("M-i"    , raiseMaybe (runInTerm "-title irssi" "sh -c 'screen -D -R -S irc irssi'") (title =? "irssi"))
    , ("M-m"    , raiseMaybe (runInTerm "-title mutt" "sh -c 'screen -D -R -S mail mutt'") (title =? "mutt"))
    , ("M-n"    , raiseMaybe (runInTerm "-title ncmpcpp" "sh -c 'screen -D -R -S music ncmpcpp'") (title =? "ncmpcpp"))
    , ("M-S-e"  , raiseMaybe (runInTerm "-title vifm" "sh -c 'screen -D -R -S files vifm'") (title =? "vifm"))
    , ("M-S-w"  , raiseMaybe (runInTerm "-title wicd" "sh -c 'screen -D -R -S wicd wicd-curses'") (title =? "wicd"))
    , ("M-v"    , raiseMaybe (spawn "vncviewer -passwd ~/.vpasswd 10.0.2.163") (className =? "Vncviewer"))
    , ("M-b"    , sendMessage ToggleStruts)
    -- focus NonEmpty wss except scratchpad
    , ("M-d", windows . W.greedyView =<< findWorkspace getSortByIndexNoSP Next NonEmptyWS 1)
    , ("M-s", windows . W.greedyView =<< findWorkspace getSortByIndexNoSP Prev NonEmptyWS 1)
    -- move window to NonEmpty wss except scratchpad
    , ("M-S-d", windows . W.shift =<< findWorkspace getSortByIndexNoSP Next NonEmptyWS 1)
    , ("M-S-s", windows . W.shift =<< findWorkspace getSortByIndexNoSP Prev NonEmptyWS 1)
    -- move window to and focus NonEmpty wss except scratchpad
    , ("M-C-s"    , shiftAndView Next)
    , ("M-C-d"    , shiftAndView Prev)
    , ("M-f"      , nextWS)
    , ("M-a"      , prevWS)
    , ("M-S-f"    , shiftToNext)
    , ("M-S-a"    , shiftToPrev)
    -- Media keys
    , ("<XF86AudioLowerVolume>" , unsafeSpawn "amixer -q set Master 2dB-"     )
    , ("<XF86AudioMute>"        , unsafeSpawn "amixer -q set Master toggle")
    , ("<XF86AudioRaiseVolume>" , unsafeSpawn "amixer -q set Master 2dB+"     )
    -- Screenshot
    , ("<Print>" , unsafeSpawn "scrot '%Y-%m-%d-%H%M_$wx$h.png' -e 'mv $f ~/screenshots/'")
    ]
    ++
    -- Search methods
    -- mapped to mod-c for 'a căuta'
    -- FIXME: broken after recent 'safeSpawn' String -> [String] changes
    [("M-c " ++ k, S.promptSearch largeXPConfig f) | (k,f) <- searchList ]
    ++
    [("M-C-c " ++ k, S.selectSearch f) | (k,f) <- searchList ]
    where -- | non-empty workspaces less scratchpad
        shiftAndView dir = findWorkspace getSortByIndexNoSP dir NonEmptyWS 1
                >>= \t -> (windows . W.shift $ t) >> (windows . W.greedyView $ t)
        getSortByIndexNoSP =
                fmap (.scratchpadFilterOutWorkspace) getSortByIndex
 
searchList :: [([Char], S.SearchEngine)]
searchList = [ ("g", S.google)
             , ("w", S.wikipedia)
             , ("y", S.youtube)
             ]
 
-- vim:foldmethod=marker sw=4 sts=4 ts=4 tw=0 et ai nowrap 

Offline

#416 2010-10-09 10:05:26

Anntoin
Member
Registered: 2009-08-10
Posts: 42
Website

Re: xmonad Hacking Thread

Your config worked here. I had to change a few things to get it to compile though, these were:
1) a quote in the dmenuCmd function, 2) get rid of the numlockMask in myConfig and 3) get rid of an extra comma at the end of myConfig. Then it worked fine.
The version of Xmonad I'm using is 0.9.1 and GHC is version 6.12.1. (Haven't updated in a bit)
xcompmgr is at version 1.1.4.

If you let me know what exact versions of these you're using I'll have another look tomorrow.

Offline

#417 2010-10-09 10:43:14

Runiq
Member
From: Germany
Registered: 2008-10-29
Posts: 1,053

Re: xmonad Hacking Thread

Anntoin wrote:

Your config worked here. I had to change a few things to get it to compile though, these were:
1) a quote in the dmenuCmd function, 2) get rid of the numlockMask in myConfig and 3) get rid of an extra comma at the end of myConfig.

Yeah, I copied it and changed some things afterwards to make it a bit more readable, but I must have missed those—sorry about that. So you're saying you don't have your windows shifted? Good to know, thanks for looking into it.

Anyway, I'm using XMonad 0.9.1 and GHC 6.12.3.

Offline

#418 2010-10-09 11:17:43

Arthenik
Member
Registered: 2010-02-13
Posts: 44

Re: xmonad Hacking Thread

Could the graphics driver be the culprit?

I have an i915 card and use the latest xf86-video-intel and intel-dri packages.

Offline

#419 2010-10-09 13:03:53

Runiq
Member
From: Germany
Registered: 2008-10-29
Posts: 1,053

Re: xmonad Hacking Thread

Arthenik wrote:

I have an i915 card and use the latest xf86-video-intel and intel-dri packages.

945g here, and I'm using the same drivers… Might very well be.

Offline

#420 2010-10-14 19:52:36

Anntoin
Member
Registered: 2009-08-10
Posts: 42
Website

Re: xmonad Hacking Thread

@Runiq and Arthenik: Sorry for the delay in getting back - busy week.
It seems that my testing last weekend was not thorough enough - had checked my own config with cairo-compmgr and xcompmgr and only checked your configs with xcompmgr.
I can recreate the border issue now with my own config when I add smartBorders to the layout hook.
When I remove smartBorders from Runiqs config this seems to fix the problem. It doesn't for Artheniks though. So there seems to be something else going on here.
I should have some time to look into this in the next few days so I'll let you know if I find anything.

Offline

#421 2010-10-14 20:16:53

Runiq
Member
From: Germany
Registered: 2008-10-29
Posts: 1,053

Re: xmonad Hacking Thread

Anntoin wrote:

@Runiq and Arthenik: Sorry for the delay in getting back - busy week.
It seems that my testing last weekend was not thorough enough - had checked my own config with cairo-compmgr and xcompmgr and only checked your configs with xcompmgr.
I can recreate the border issue now with my own config when I add smartBorders to the layout hook.
When I remove smartBorders from Runiqs config this seems to fix the problem. It doesn't for Artheniks though. So there seems to be something else going on here.
I should have some time to look into this in the next few days so I'll let you know if I find anything.

This is very much appreciated, thanks! You really don't have to, though—I should be doing this, I just don't have time to do so right now. hmm

Offline

#422 2010-10-15 12:12:21

Arthenik
Member
Registered: 2010-02-13
Posts: 44

Re: xmonad Hacking Thread

Thanks Anntoin. smile However, I will be switching to i3 very soon.

Offline

#423 2010-11-01 21:35:53

cbrunos
Member
Registered: 2010-07-22
Posts: 55

Re: xmonad Hacking Thread

Hello
sorry if this has been asked before, but is there a way to have a little pop-up show up when switching desktops? Like in openbox or pekwm? Thanks in advance to whoever has the answer ^^


Xmonad gets sh*t done. Fast.

Offline

#424 2010-11-02 00:40:11

Knute
Member
From: Minot, ND
Registered: 2009-03-17
Posts: 604

Re: xmonad Hacking Thread

cbrunos wrote:

Hello
sorry if this has been asked before, but is there a way to have a little pop-up show up when switching desktops? Like in openbox or pekwm? Thanks in advance to whoever has the answer ^^

Not really an answer, but more of an idea of how to do this.

You could probably have dzen2 pop-up something to show the change.   If you add it to the shortcut to change desktops, it should work ok.


Knute

Offline

#425 2010-11-02 19:17:44

oupsemma
Member
Registered: 2010-01-01
Posts: 70

Re: xmonad Hacking Thread

cbrunos wrote:

Hello
sorry if this has been asked before, but is there a way to have a little pop-up show up when switching desktops? Like in openbox or pekwm? Thanks in advance to whoever has the answer ^^

Hi, it's called a pager and you can get some ideas
from there, post #3 (pagers and Conky)
from the AUR

Offline

Board footer

Powered by FluxBB