You are not logged in.

#1 2012-04-26 21:27:24

Schwag
Member
Registered: 2012-03-24
Posts: 8

[Solved] Error: unexpected charater when trying to run xmonad

I'm trying to get xmonad up and running with xmobar and trayer as well. I've been trying to follow this article:

http://www.linuxandlife.com/2011/11/how … linux.html

I copy and pasted the xmonad.hs and .xmobarrc files in hopes of getting xmonad up and running before I start tinkering around with it. I'm getting the following error when I try to run "xmonad &":

X Error of failed request:  BadAccess (attempt to access private resource denied)
  Major opcode of failed request:  2 (X_ChangeWindowAttributes)
  Serial number of failed request:  7
  Current serial number in output stream:  8
xmobar: /home/matt/.xmonad/xmonad.hs: configuration file contains errors at:
"Config" (line 1, column 1):
unexpected "i"
expecting space or "Config"

Here are my files,

xmonad.hs:

import XMonad  
import XMonad.Hooks.DynamicLog  
import XMonad.Hooks.ManageDocks  
import XMonad.Util.Run  
import System.IO  
  
main = do  
xmproc <- spawnPipe "/usr/bin/xmobar /home/matt/.xmonad/xmonad.hs"
xmonad $ defaultConfig   
	{ manageHook = manageDocks <+> manageHook defaultConfig  
	, layoutHook = avoidStruts $ layoutHook defaultConfig  
	, logHook = dynamicLogWithPP xmobarPP  
		{ ppOutput = hPutStrLn xmproc  
		, ppTitle = xmobarColor "blue" "" . shorten 50   
        , ppLayout = const "" -- to disable the layout info on xmobar  
        }   
    }

.xmobarrc:

Config { font = "xft:Bitstream Vera Sans Mono:size=9:bold:antialias=true"  
	, bgColor = "#000000"  
	, fgColor = "grey"  
	, position = Static { xpos = 0 , ypos = 0, width = 1290, height = 16 }  
	, commands = [ Run Cpu ["-L","3","-H","50","--normal","green","--high","red"] 10  
			, Run Network "eth0" ["-L","0","-H","70","--normal","green","--high","red"] 10   
            , Run Memory ["-t","Mem: <usedratio>%"] 10 
			, Run Date "%a %b %_d %l:%M" "date" 10 
            , Run StdinReader  
			]  
	, sepChar = "%"  
	, alignSep = "}{"  
	, template = " %StdinReader%}{ <fc=grey>%cpu% </fc> <fc=red>%cpuTemp%</fc>°C<fc=grey> ~ %memory% ~ %eth0%</fc> ~ <fc=#ee9a00>%date%</fc> ~ Vol: <fc=green>%volume%</fc> "  
	}

.xinitrc:

#!/bin/sh

# initialize screensaver
xscreensaver -no-splash &

# set cursor
xsetroot -cursor_name left_ptr

# start xmonad
trayer --edge top --align right --SetDockType true --SetPartialStrut true --expand true --width 6 --transparent true --alpha 0 --tint 0x000000 --height 16 &
exec ck-launch-session xmonad

Last edited by Schwag (2012-04-27 15:56:53)

Offline

#2 2012-04-26 22:05:09

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: [Solved] Error: unexpected charater when trying to run xmonad

Why are you feeding xmonad's config to xmobar? And why did you (pretend to) not read the error message?

Offline

#3 2012-04-26 22:53:03

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,564
Website

Re: [Solved] Error: unexpected charater when trying to run xmonad

Fix the middle line as follows:

main = do  
xmproc <- spawnPipe "/usr/bin/xmobar /home/matt/.xmobarrc"
xmonad $ defaultConfig   

Edit: I suspect this is an issue that the OP will, in hindsight, give himself a good forehead slap for.  But we all make mistakes - I've made some good ones.  I don't think there is any need to be abrupt in such a situation as the failure of the OP was not in failing to read the relevant documentation or presenting the needed information to solve the problem.  The OP is simply human and didn't understand the examples provided for a config file written in a relatively new and novel programming language that can be a bit baffling at first.  In other words - cut the guy some slack.

Last edited by Trilby (2012-04-26 23:02:14)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

Board footer

Powered by FluxBB