[solved] xmonad issue

I'm trying to get it so that when I open a new program, it is set as the slave and not the master. I did this by putting "insertPosition Below Newer" into my manageHook, and it works well except this causes dialog boxes to be opened up behind the active window and I have to move the window in order to find them. A good example of this is in GIMP; when I go to open a file, the open file dialog box can't be seen because the main GIMP windowis blocking it. If I remove the insertPosition line, it goes back to normal. Is there anyway for me to make only new instances of urxvt to be inserted Below Newer? I tried className =? "urxvt" --> insertPosition Below Newer, but that didn't work.
Edit: here's my entire xmonad.hs
import XMonad
import XMonad.Actions.GridSelect
import XMonad.Hooks.DynamicLog -- statusbar
import XMonad.Hooks.EwmhDesktops -- fullscreenEventHook fixes chrome fullscreen
import XMonad.Hooks.ManageDocks -- dock/tray mgmt
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.UrgencyHook -- window alert bells
import XMonad.Hooks.InsertPosition
import XMonad.Layout.NoBorders
import XMonad.Layout.ResizableTile
import XMonad.Layout.Named
import XMonad.Layout.Tabbed
import XMonad.Layout.Spiral
import XMonad.Util.Run(spawnPipe) -- spawnPipe and hPutStrLn
import XMonad.Util.Cursor
import System.IO -- hPutStrLn scope
import System.Exit
import qualified XMonad.StackSet as W -- manageHook rules
import qualified Data.Map as M
main = do
status <- spawnPipe myDzenStatus -- xmonad status on the left
conky <- spawnPipe myDzenConky -- conky stats on the right
xmonad $ withUrgencyHook NoUrgencyHook $ defaultConfig
{ modMask = mod4Mask
, terminal = "urxvtc"
, borderWidth = 1
, normalBorderColor = "#333333"
, focusedBorderColor = "#AFAF97"
, handleEventHook = fullscreenEventHook
, workspaces = myWorkspaces
, layoutHook = myLayoutHook
, manageHook = manageDocks <+> myManageHook
<+> manageHook defaultConfig
, logHook = myLogHook status
, keys = myKeys
, startupHook = setDefaultCursor xC_left_ptr
-- Tags/Workspaces
-- clickable workspaces via dzen/xdotool
myWorkspaces :: [String]
myWorkspaces = clickable . (map dzenEscape) $ ["1-main","2-web","3-dev","4-games","5","6","7","8","9"]
where clickable l = [ "^ca(1,xdotool key super+" ++ show (n) ++ ")" ++ ws ++ "^ca()" |
(i,ws) <- zip [1..] l,
let n = i ]
-- Layouts
-- the default layout is fullscreen with smartborders applied to all
myLayoutHook = avoidStruts $ tile ||| mtile ||| fib ||| tab ||| full
where
rt = ResizableTall 1 (2/100) (1/2) []
tile = named "[]=" $ smartBorders rt
mtile = named "M[]=" $ smartBorders $ Mirror rt
fib = named "[F]" $ smartBorders $ spiral (6/7)
tab = named "T" $ noBorders $ tabbed shrinkText tabTheme1
full = named "[]" $ noBorders Full
-- Window management
myManageHook = composeAll
[ isFullscreen --> doFullFloat
, isDialog --> doCenterFloat
, className =? "MPlayer" --> doCenterFloat
, className =? "Vlc" --> doCenterFloat
, className =? "Gimp" --> doFloat
--, insertPosition Below Newer
, transience'
-- tabs
tabTheme1 = defaultTheme { decoHeight = 16
, activeColor = "#a6c292"
, activeBorderColor = "#a6c292"
, activeTextColor = "#000000"
, inactiveBorderColor = "#000000"
-- Statusbar
myLogHook h = dynamicLogWithPP $ myDzenPP { ppOutput = hPutStrLn h }
cleanDzen = "killall dzen2"
myDzenStatus = "dzen2 -w '500' -ta 'l'" ++ myDzenStyle
myDzenConky = "conky -c ~/.xmonad/conkyrc | dzen2 -x '500' -w '866' -ta 'r'" ++ myDzenStyle
myDzenStyle = " -h '20' -fg '#777777' -bg '#222222' -fn 'terminus:size=9'"
myDzenPP = dzenPP
{ ppCurrent = dzenColor "#65ac35" "" . wrap "<" ">"
, ppHidden = dzenColor "#f85708" "" . wrap " " " "
, ppHiddenNoWindows = dzenColor "#a8a8a8" "" . wrap " " " "
, ppUrgent = dzenColor "#18618f" "" . wrap "[" "]"
, ppSep = dzenColor "#18618f" "" " | "
, ppLayout = dzenColor "#65ac35" "" . wrap "^ca(1,xdotool key super+space)· " " ·^ca()"
, ppTitle = dzenColor "#f85708" ""
. wrap "^ca(1,xdotool key super+k)^ca(2,xdotool key super+shift+c)"
" ^ca()^ca()" . shorten 20 . dzenEscape
myGSConfig = defaultGSConfig { gs_cellwidth = 160 }
-- Key bindings
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 $
-- launching and killing programs
[ ((modMask, xK_Return), spawn $ XMonad.terminal conf)
, ((modMask, xK_r ), spawn "dmenu_run")
, ((modMask, xK_d ), spawn "dwb")
, ((modMask .|. shiftMask, xK_m ), spawn "claws-mail")
, ((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")
-- grid
, ((modMask, xK_g ), goToSelected myGSConfig)
-- layouts
, ((modMask, xK_space ), sendMessage NextLayout)
, ((modMask .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
-- floating layer stuff
, ((modMask, xK_t ), withFocused $ windows . W.sink)
-- refresh
, ((modMask, xK_n ), refresh)
-- focus
, ((modMask, xK_Tab ), windows W.focusDown)
, ((modMask, xK_j ), windows W.focusDown)
, ((modMask, xK_k ), windows W.focusUp)
, ((modMask, xK_m ), windows W.focusMaster)
-- swapping
, ((modMask .|. shiftMask, xK_Return), windows W.swapMaster)
, ((modMask .|. shiftMask, xK_j ), windows W.swapDown )
, ((modMask .|. shiftMask, xK_k ), windows W.swapUp )
-- increase or decrease number of windows in the master area
, ((modMask , xK_comma ), sendMessage (IncMasterN 1))
, ((modMask , xK_period), sendMessage (IncMasterN (-1)))
-- resizing
, ((modMask, xK_h ), sendMessage Shrink)
, ((modMask, xK_l ), sendMessage Expand)
, ((modMask .|. shiftMask, xK_h ), sendMessage MirrorShrink)
, ((modMask .|. shiftMask, xK_l ), sendMessage MirrorExpand)
-- brightness
, ((0, 0x1008FF02), spawn "/home/bslackr/bin/bsetbacklight inc")
, ((0, 0x1008FF03), spawn "/home/bslackr/bin/bsetbacklight dec")
-- volume
, ((0, 0x1008FF11), spawn "amixer set Master 10%-")
, ((0, 0x1008FF12), spawn "amixer set Master toggle")
, ((0, 0x1008FF13), spawn "amixer set Master 10%+")
-- quit, or restart
, ((modMask .|. shiftMask, xK_q ), io (exitWith ExitSuccess))
, ((modMask , xK_q ), spawn "xmonad --recompile; killall dzen2; xmonad --restart")
++
-- mod-[1..9] %! Switch to workspace N
-- mod-shift-[1..9] %! Move client to workspace N
[((m .|. modMask, k), windows import XMonad
import XMonad.Actions.GridSelect
import XMonad.Hooks.DynamicLog -- statusbar
import XMonad.Hooks.EwmhDesktops -- fullscreenEventHook fixes chrome fullscreen
import XMonad.Hooks.ManageDocks -- dock/tray mgmt
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.UrgencyHook -- window alert bells
import XMonad.Hooks.InsertPosition
import XMonad.Layout.NoBorders
import XMonad.Layout.ResizableTile
import XMonad.Layout.Named
import XMonad.Layout.Tabbed
import XMonad.Layout.Spiral
import XMonad.Util.Run(spawnPipe) -- spawnPipe and hPutStrLn
import XMonad.Util.Cursor
import System.IO -- hPutStrLn scope
import System.Exit
import qualified XMonad.StackSet as W -- manageHook rules
import qualified Data.Map as M
main = do
status <- spawnPipe myDzenStatus -- xmonad status on the left
conky <- spawnPipe myDzenConky -- conky stats on the right
xmonad $ withUrgencyHook NoUrgencyHook $ defaultConfig
{ modMask = mod4Mask
, terminal = "urxvtc"
, borderWidth = 1
, normalBorderColor = "#333333"
, focusedBorderColor = "#AFAF97"
, handleEventHook = fullscreenEventHook -- Only in darcs xmonad-contrib
, workspaces = myWorkspaces
, layoutHook = myLayoutHook
, manageHook = manageDocks <+> myManageHook
<+> manageHook defaultConfig
, logHook = myLogHook status
, keys = myKeys
, startupHook = setDefaultCursor xC_left_ptr
-- Tags/Workspaces
-- clickable workspaces via dzen/xdotool
myWorkspaces :: [String]
myWorkspaces = clickable . (map dzenEscape) $ ["1-main","2-web","3-dev","4-games","5","6","7","8","9"]
where clickable l = [ "^ca(1,xdotool key super+" ++ show (n) ++ ")" ++ ws ++ "^ca()" |
(i,ws) <- zip [1..] l,
let n = i ]
-- Layouts
-- the default layout is fullscreen with smartborders applied to all
myLayoutHook = avoidStruts $ tile ||| mtile ||| fib ||| tab ||| full
where
rt = ResizableTall 1 (2/100) (1/2) []
tile = named "[]=" $ smartBorders rt
mtile = named "M[]=" $ smartBorders $ Mirror rt
fib = named "[F]" $ smartBorders $ spiral (6/7)
tab = named "T" $ noBorders $ tabbed shrinkText tabTheme1
full = named "[]" $ noBorders Full
-- Window management
myManageHook = composeAll
[ isFullscreen --> doFullFloat
, isDialog --> doCenterFloat
, className =? "MPlayer" --> doCenterFloat
, className =? "Vlc" --> doCenterFloat
, className =? "Gimp" --> doFloat
--, insertPosition Below Newer
, transience'
-- tabs
tabTheme1 = defaultTheme { decoHeight = 16
, activeColor = "#a6c292"
, activeBorderColor = "#a6c292"
, activeTextColor = "#000000"
, inactiveBorderColor = "#000000"
-- Statusbar
myLogHook h = dynamicLogWithPP $ myDzenPP { ppOutput = hPutStrLn h }
cleanDzen = "killall dzen2"
myDzenStatus = "dzen2 -w '500' -ta 'l'" ++ myDzenStyle
myDzenConky = "conky -c ~/.xmonad/conkyrc | dzen2 -x '500' -w '866' -ta 'r'" ++ myDzenStyle
myDzenStyle = " -h '20' -fg '#777777' -bg '#222222' -fn 'terminus:size=9'"
myDzenPP = dzenPP
{ ppCurrent = dzenColor "#65ac35" "" . wrap "<" ">"
, ppHidden = dzenColor "#f85708" "" . wrap " " " "
, ppHiddenNoWindows = dzenColor "#a8a8a8" "" . wrap " " " "
, ppUrgent = dzenColor "#18618f" "" . wrap "[" "]"
, ppSep = dzenColor "#18618f" "" " | "
, ppLayout = dzenColor "#65ac35" "" . wrap "^ca(1,xdotool key super+space)· " " ·^ca()"
, ppTitle = dzenColor "#f85708" ""
. wrap "^ca(1,xdotool key super+k)^ca(2,xdotool key super+shift+c)"
" ^ca()^ca()" . shorten 20 . dzenEscape
myGSConfig = defaultGSConfig { gs_cellwidth = 160 }
-- Key bindings
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 $
-- launching and killing programs
[ ((modMask, xK_Return), spawn $ XMonad.terminal conf)
, ((modMask, xK_r ), spawn "dmenu_run")
, ((modMask, xK_d ), spawn "dwb")
, ((modMask .|. shiftMask, xK_m ), spawn "claws-mail")
, ((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")
-- grid
, ((modMask, xK_g ), goToSelected myGSConfig)
-- layouts
, ((modMask, xK_space ), sendMessage NextLayout)
, ((modMask .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
-- floating layer stuff
, ((modMask, xK_t ), withFocused $ windows . W.sink)
-- refresh
, ((modMask, xK_n ), refresh)
-- focus
, ((modMask, xK_Tab ), windows W.focusDown)
, ((modMask, xK_j ), windows W.focusDown)
, ((modMask, xK_k ), windows W.focusUp)
, ((modMask, xK_m ), windows W.focusMaster)
-- swapping
, ((modMask .|. shiftMask, xK_Return), windows W.swapMaster)
, ((modMask .|. shiftMask, xK_j ), windows W.swapDown )
, ((modMask .|. shiftMask, xK_k ), windows W.swapUp )
-- increase or decrease number of windows in the master area
, ((modMask , xK_comma ), sendMessage (IncMasterN 1))
, ((modMask , xK_period), sendMessage (IncMasterN (-1)))
-- resizing
, ((modMask, xK_h ), sendMessage Shrink)
, ((modMask, xK_l ), sendMessage Expand)
, ((modMask .|. shiftMask, xK_h ), sendMessage MirrorShrink)
, ((modMask .|. shiftMask, xK_l ), sendMessage MirrorExpand)
-- brightness
, ((0, 0x1008FF02), spawn "/home/bslackr/bin/bsetbacklight inc")
, ((0, 0x1008FF03), spawn "/home/bslackr/bin/bsetbacklight dec")
-- volume
, ((0, 0x1008FF11), spawn "amixer set Master 10%-")
, ((0, 0x1008FF12), spawn "amixer set Master toggle")
, ((0, 0x1008FF13), spawn "amixer set Master 10%+")
-- quit, or restart
, ((modMask .|. shiftMask, xK_q ), io (exitWith ExitSuccess))
, ((modMask , xK_q ), spawn "xmonad --recompile; killall dzen2; xmonad --restart")
++
-- mod-[1..9] %! Switch to workspace N
-- mod-shift-[1..9] %! Move client to workspace N
[((m .|. modMask, k), windows $ f i)
| (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
++
-- mod-[w,e] %! switch to twinview screen 1/2
-- mod-shift-[w,e] %! move window to screen 1/2
[((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)]]
-- vim:sw=4 sts=4 ts=4 tw=0 et ai
$ f i)
| (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
++
-- mod-[w,e] %! switch to twinview screen 1/2
-- mod-shift-[w,e] %! move window to screen 1/2
[((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)]]
-- vim:sw=4 sts=4 ts=4 tw=0 et ai
Last edited by bslackr (2012-03-20 21:37:04)

I use avoidMaster from the xmonad FAQ to do this. Mine is a little modified though.
http://www.haskell.org/haskellwiki/Xmon … s_normally
Here's the relevent parts from my xmonad.hs as well:
myManageHook = composeOne . concat $
[ [ title =? c -?> doF (avoidMaster) | c <- myAMTitle ]
where
myAMTitle = ["xterm", "urxvt", "mrxvt", "gnome-terminal", "Gnome-terminal"]
-- here's the part from the xmonad faq
avoidMaster :: W.StackSet i l a s sd -> W.StackSet i l a s sd
avoidMaster = W.modify' $ \c -> case c of
W.Stack t [] (r:rs) -> W.Stack t [r] rs
otherwise -> c
Hope that helps
Last edited by vernonrj (2012-03-20 04:19:49)

Similar Messages

Maybe you are looking for