xmonad 啟動時,xmobar 不會出現在視窗堆棧的頂部
xmobar
我進入後立即遇到一種奇怪的行為xmonad
。當我xmonad
(來自.xinitrc
,我使用 XDM)我xmobar
出現時,但它既不在視窗堆棧的頂部也不在底部。一旦我啟動一個應用程序(例如,通過按下終端仿真器Mod + Shift + Return
),該應用程序將使用整個螢幕,就好像xmobar
在底部一樣。然後我按下Mod + B
並沒有任何反應,一旦我Mod + B
第二次按下xmobar
就會提升到頂部,從而減小應用程序視窗的大小。之後
Mod + B
在會話的其餘部分正常工作xmonad
,即它降低/提高(隱藏/顯示)xmobar
.我確信我配置錯誤。我的
xmonad.hs
樣子:import XMonad import XMonad.Hooks.SetWMName import XMonad.Hooks.DynamicLog main = do xmonad =<< statusBar "xmobar" myPP toggleStrutsKey defaultConfig { terminal = "urxvt" , focusFollowsMouse = True , clickJustFocuses = False , borderWidth = 1 , modMask = mod4Mask , workspaces = myworkspaces , normalBorderColor = "#dddddd" , focusedBorderColor = "#00dd00" , manageHook = mymanager , startupHook = setWMName "LG3D" } myPP = xmobarPP { ppOutput = putStrLn , ppCurrent = xmobarColor "#336433" "" . wrap "[" "]" --, ppHiddenNoWindows = xmobarColor "grey" "" , ppTitle = xmobarColor "darkgreen" "" . shorten 20 , ppLayout = shorten 6 --, ppVisible = wrap "(" ")" , ppUrgent = xmobarColor "red" "yellow" } toggleStrutsKey XConfig { XMonad.modMask = modMask } = (modMask, xK_b) myworkspaces = [ "code" , "web" , "media" , "irc" , "random" , "mail" , "docs" , "music" , "root" ] mymanager = composeAll [ className =? "gimp" --> doFloat , className =? "vlc" --> doFloat ]
雖然我的開頭
.xmobarrc
看起來如下:Config { -- appearance font = "xft:Bitstream Vera Sans Mono:size=9:bold:antialias=true" , bgColor = "black" , fgColor = "#646464" , position = Top , border = BottomB , borderColor = "#646464" -- layout , sepChar = "%" -- delineator between plugin names and straight text , alignSep = "}{" -- separator between left-right alignment , template = "%battery% | %multicpu% | %coretemp% | %memory% | %dynnetwork% | %StdinReader% }{ %date% || %kbd% " -- general behavior , lowerOnStart = False -- send to bottom of window stack on start , hideOnStart = False -- start with window unmapped (hidden) , allDesktops = True -- show on all desktops , overrideRedirect = True -- set the Override Redirect flag (Xlib) , pickBroadest = False -- choose widest display (multi-monitor) , persistent = True -- enable/disable hiding (True = disabled) -- plugins (i do not use any) , commands = [ -- actually several commands are in here ] }
我嘗試了幾種組合:
, lowerOnStart = , hideOnStart =
(真/真、真/假、假/真和假/假,如現在所示)。但是我按
Mod + B
兩次之前的行為並沒有改變。我相信我xmonad
在某種程度上沒有配置錯誤,xmobar
但這只是一個猜測。我的
.xinitrc
可能會有所幫助:#!/bin/sh if test -d /etc/X11/xinit/xinitrc.d then # /etc/X11/xinit/xinitrc.d is actually empty for f in /etc/X11/xinit/xinitrc.d/* do [ -x "$f" ] && source "$f" done unset f fi # uk keyboard setxkbmap gb xrdb .Xresources xscreensaver -no-splash & # java behaves badly in non-reparenting window managers (e.g. xmonad) export _JAVA_AWT_WM_NONREPARENTING=1 # set the background (again, because qiv uses a different buffer) /usr/bin/feh --bg-scale --no-fehbg -z /usr/share/archlinux/wallpaper/a*.jpg # pulse audio for alsa then /usr/bin/start-pulseaudio-x11 fi exec xmonad
兩個月後,我想通了。問題是
statusBar
沒有Hooks.manageDocks
正確註冊事件。一旦xmonad
執行一切正常,因為manageDocks
能夠更新Struts
每個視窗事件。但是在xmonad
開始的那一刻,使第一個視窗全屏的事件發生在manageDocks
. 這首先打開視窗忽略了 的存在xmobar
。
manageDocks
其事件處理程序必須設置為最後一個事件處理程序,因此statusBar
不能使用。而是需要通過、和手動xmonad
呼叫和配置。一個簡約的配置是:xmobar``dynamicLog``manageHook``layoutHook``handleEventHook
main = do xmproc <- spawnPipe "xmobar" xmonad $ defaultConfig { modMask = mod4Mask , manageHook = manageDocks <+> manageHook defaultConfig , layoutHook = avoidStruts $ layoutHook defaultConfig -- this must be in this order, docksEventHook must be last , handleEventHook = handleEventHook defaultConfig <+> docksEventHook , logHook = dynamicLogWithPP xmobarPP { ppOutput = hPutStrLn xmproc , ppTitle = xmobarColor "darkgreen" "" . shorten 20 , ppHiddenNoWindows = xmobarColor "grey" "" } , startupHook = setWMName "LG3D" } `additionalKeys` [ ((mod4Mask, xK_b), sendMessage ToggleStruts) ]
這使得所有事件都被處理
docsEventHook
並確保佈局更改docsEventHook
是最後應用的。現在lowerOnStart = False
(或)在所有情況下都按
True
預期工作。xmobarrc