愚蠢的简单xmonad.hs问题......
import XMonad
myTerminal = "gnome-terminal"
startupHook = do { spawn "/usr/bin/feh --bg-fill /home/abennett/wallpaper.jpg" }
main = xmonad defaults
defaults = defaultConfig {
terminal = myTerminal
}
引发此错误:
Error detected while loading xmonad configuration file: /home/abennett/.xmonad/xmonad.hs xmonad.hs:4:20: Ambiguous type variable `m0' in the constraint: (MonadIO m0) arising from a use of `spawn' Possible cause: the monomorphism restriction applied to the following: Main.startupHook :: m0 () (bound at xmonad.hs:4:1) Probable fix: give these definition(s) an explicit type signature or use -XNoMonomorphismRestriction In a stmt of a 'do' block: spawn "/usr/bin/feh --bg-fill /home/abennett/wallpaper.jpg" In the expression: do { spawn "/usr/bin/feh --bg-fill /home/abennett/wallpaper.jpg" } In an equation for `Main.startupHook': Main.startupHook = do { spawn "/usr/bin/feh --bg-fill /home/abennett/wallpaper.jpg" } Please check the file for errors
我尝试了startupHook = startup
然后startup = do { spawn "stuff" }
之类的内容,但这也不起作用。
答案 0 :(得分:2)
您必须在startupHook
中加入defaults
。您可以直接在defaults
中指定,也可以创建变量并将startupHook
定义为例如myStartupHook
。 defaults
中的import XMonad
main = xmonad defaults
defaults = defaultConfig {
terminal = myTerminal,
startupHook = myStartupHook
}
myTerminal = "gnome-terminal"
myStartupHook = do
spawn "/usr/bin/feh --bg-fill /home/abennett/wallpaper.jpg"
-- and more stuff like
spawn myTerminal
spawn "xclock"
(就像您对终端所做的那样):
spawnOn
当您开始使用更多工作区时,您可能希望使用从XMonad.Actions.SpawnOn
导入的{{1}}。
请查看xmonad config template,它会让您更好地了解如何构建配置文件。