我正在设置 xmonad 窗口管理器,遇到以下问题 - 当我尝试配置 xmobar 并运行它时,它显示:
xmobar: .xmobarrc: configuration file contains errors!
Usage: xmobar [OPTION...] [FILE]
Options:
-h, -? --help This help
-V --version Show version information
-f font name --font=font name The font name
-B bg color --bgcolor=bg color The background color. Default black
-F fg color --fgcolor=fg color The foreground color. Default grey
-o --top Place xmobar at the top of the screen
-b --bottom Place xmobar at the bottom of the screen
-a alignsep --alignsep=alignsep Separators for left, center and right text
alignment. Default: '}{'
-s char --sepchar=char The character used to separate commands in
the output template. Default '%'
-t template --template=template The output template
-c commands --commands=commands The list of commands to be executed
Mail bug reports and suggestions to <[email protected]>
我的配置文件
Config { font = "-*-Fixed-Bold-R-Normal-*-13-*-*-*-*-*-*-*"
, bgColor = "black"
, fgColor = "grey"
, position = Top
, commands = [ Run Weather "EGPF" ["-t","<station>: <tempC>C","-L","18","-H","25","--normal","green","--high","red","--low","lightblue"] 36000
, Run Cpu ["-L","3","-H","50","--normal","green","--high","red"] 10
, Run Memory ["-t","Mem: <usedratio>%"] 10
, Run Swap [] 10
, Run Date "%a %b %_d %l:%M" "date" 10
, Run StdinReader
]
, sepChar = "%"
, alignSep = "}{"
, template = "%StdinReader% }{ %cpu% | %memory% * %swap% <fc=#ee9a00>%date%</fc> | %EGPF%"
}
配置复制自哈斯克尔维基。我的xmobar版本是0.9.2。
答案1
当我尝试使用您的配置运行 xmobar 时,出现错误
xmobar:用户错误(createFontSet)
它应该有所不同,因为我使用的是0.11.1版本
为了解决这个问题,我必须将字体设置改为
字体=“xft:解放单声道:像素大小= 10”
答案2
此配置有效:
Config { font = "-misc-fixed-*-*-*-*-13-*-*-*-*-*-*-*"
, bgColor = "black"
, fgColor = "grey"
, position = TopW L 100
, lowerOnStart = True
, commands = [ Run Cpu ["-L","15","-H","50","--normal","green","--high","red"] 10
, Run Date "%a %b %_d %Y %H:%M:%S" "date" 10
, Run StdinReader
]
, sepChar = "%"
, alignSep = "}{"
, template = "%StdinReader% }{ %cpu% | %date%"
}
答案3
只需在字体代码的开头添加“xft:”
font = "-*-Fixed-Bold-R-Normal-*-13-*-*-*-*-*-*-*"
font = "xft:-*-Fixed-Bold-R-Normal-*-13-*-*-*-*-*-*-*"