You are not logged in.

#1 2013-12-14 17:56:01

josealejandro93
Member
Registered: 2013-12-14
Posts: 5

[SOLVED] Xmobar syntax problem possibly wrong

I'm configuring xmobar to my needs as shown in my configuration file:

Config { font = "-*-Fixed-Bold-R-Normal-*-13-*-*-*-*-*-*-*"
       , bgColor = "black"
       , fgColor = "grey"
       , position = Static{xpos=0, ypos=0, width=1905, height=16}
       , lowerOnStart = True
       , commands = [ Run Cpu ["-L","3","-H","50","--normal","green","--high","red"] 10
                    , Run Memory ["-t","<usedratio>%"] 10
                    , Run Date "%a %b %_d %Y %H:%M:%S" 10
		    , Run Com "/home/josealejandro93/scripts/volume.sh" [] "volume" 10
		    , Run Com "/home/josealejandro93/scripts/bstatus.sh" [] "bstatus" 10
		    , Run Battery ["-t","<left>%","-L","50","-H","75","-h","green","-n","yell","-l","red"] "battery" 10
		    , Run Com "/home/josealejandro93/scripts/brightness.sh" [] "bright" 10
		    , Run Com "/home/josealejandro93/scripts/user.sh" [] "user" 500
		    , Run StdinReader
		    ]
       , sepChar = "%"
       , alignSep = "}{"
       , template = "%StdinReader%}<fc=#ee9a00>%date%</fc>{Vol: <fc=green>%volume%</fc> | [Bat: %battery% | Status: %bstatus%] | Brightness: <fc=green>%bright%</fc> | [%cpu% | Mem: <fc=green>%memory%</fc>] | <fc=#ff0000>%user%</fc>  "

I can't see anything wrong in that code but Xmobar is not starting (previously it was, after a reboot my battery indicator was not working so I tried to mess around with the configuration file and broke it). When I run

 xmobar config.file 

I get:

configuration file contains errors at:
"Config" (line 16, column 10):
unexpected "s"
expecting space or "Run"

But I don't see why it should be asking for a space or a

Run

since I'm closing the commands list one line above.

This file was made with emacs and I also ran dos2unix on it since I thought that maybe the new-line character was causing this problem but still got the same result.

Do you think that maybe I should try another editor like nano? I have never had this kind of problems with emacs before so it's quite strange.


Thanks in advance for your help!

Last edited by josealejandro93 (2013-12-14 19:25:42)

Offline

#2 2013-12-14 18:18:31

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: [SOLVED] Xmobar syntax problem possibly wrong

On the Battery line, remove "battery":

Run Battery ["-t","<left>%","-L","50","-H","75","-h","green","-n","yell","-l","red"] 10

On the Date line, add "date":

Run Date "%a %b %_d %Y %H:%M:%S" "date" 10

Without having your scripts, this is all that I can check.

Last edited by skottish (2013-12-14 18:18:58)

Offline

#3 2013-12-14 18:29:50

josealejandro93
Member
Registered: 2013-12-14
Posts: 5

Re: [SOLVED] Xmobar syntax problem possibly wrong

skottish wrote:

On the Battery line, remove "battery":

Run Battery ["-t","<left>%","-L","50","-H","75","-h","green","-n","yell","-l","red"] 10

On the Date line, add "date":

Run Date "%a %b %_d %Y %H:%M:%S" "date" 10

Without having your scripts, this is all that I can check.

Did those changes, still same issue.

I didn't think my scripts would be the problem since I saw them working previously but here they are:

brightness.sh

#! /bin/bash

max=`cat /sys/class/backlight/acpi_video0/max_brightness`
act=`cat /sys/class/backlight/acpi_video0/actual_brightness`
echo "${act}/${max}"

bstatus.sh

#! /bin/bash

str=`cat /sys/class/power_supply/BAT1/status` 
echo $str

username.sh

#!/bin/bash

user=`whoami`
str=`getent passwd $user`
IFS=:
ary=($str)
echo ${ary[4]}

volume.sh

#! /usr/bin/bash

str=`amixer sget Master`
str1=${str#Simple*\[}
v1=${str1%%]*]}

echo $v1

Also, as a side question. Is it possible to run python scripts like

Run Com "/bin/bash /home/user/scripts/script.py" [] "doStuff"

Last edited by josealejandro93 (2013-12-14 18:32:45)

Offline

#4 2013-12-14 18:46:09

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: [SOLVED] Xmobar syntax problem possibly wrong

I was able to run your xmobarrc with the changes that I posted locally without your scripts. The scripts themselves shouldn't matter as xmobar just complains about them in the status bar itself. There is some inconsistency with spacing when I pasted your code into vim, but it still runs if I don't fix it. Please post your updated config file.

Offline

#5 2013-12-14 19:10:29

josealejandro93
Member
Registered: 2013-12-14
Posts: 5

Re: [SOLVED] Xmobar syntax problem possibly wrong

skottish wrote:

I was able to run your xmobarrc with the changes that I posted locally without your scripts. The scripts themselves shouldn't matter as xmobar just complains about them in the status bar itself. There is some inconsistency with spacing when I pasted your code into vim, but it still runs if I don't fix it. Please post your updated config file.


Here it is:

Config { font = "-*-Fixed-Bold-R-Normal-*-13-*-*-*-*-*-*-*"
       , bgColor = "black"
       , fgColor = "grey"
       , position = Static{xpos=0, ypos=0, width=1905, height=16}
       , lowerOnStart = True
       , commands = [ Run Cpu ["-L","3","-H","50","--normal","green","--high","red"] 10
                    , Run Memory ["-t","<usedratio>%"] 10
                    , Run Date "%a %b %_d %Y %H:%M:%S" "date" 10"
		    , Run Com "/home/josealejandro93/scripts/volume.sh" [] "volume" 10
		    , Run Com "/home/josealejandro93/scripts/bstatus.sh" [] "bstatus" 10
		    , Run Battery ["-t","<left>%","-L","50","-H","75","-h","green","-n","yell","-l","red"] 10
		    , Run Com "/home/josealejandro93/scripts/brightness.sh" [] "bright" 10
		    , Run Com "/home/josealejandro93/scripts/user.sh" [] "user" 500
		    , Run StdinReader
		    ]
       , sepChar = "%"
       , alignSep = "}{"
       , template = "%StdinReader%}<fc=#ee9a00>%date%</fc>{Vol: <fc=green>%volume%</fc> | [Bat: %battery% | Status: %bstatus%] | Brightness: <fc=green>%bright%</fc> | [%cpu% | Mem: <fc=green>%memory%</fc>] | <fc=#ff0000>%user%</fc>  "
       }

I tried deleting those lines where I call my script but I get the same error about expecting space or Run

Offline

#6 2013-12-14 19:14:37

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: [SOLVED] Xmobar syntax problem possibly wrong

You have an extra " at the end of the Date line after the 10.

Offline

#7 2013-12-14 19:19:31

josealejandro93
Member
Registered: 2013-12-14
Posts: 5

Re: [SOLVED] Xmobar syntax problem possibly wrong

skottish wrote:

You have an extra " at the end of the Date line after the 10.


Damn I feel so embarassed!!

Fixed it by removing that extra ".

Thanks a lot for your help!

As a side question, is it possible to run python scripts from xmobar?
Maybe calling something like "Run Com "/bin/bash /path/to/script/script.py" [] 0" ??

Once again, thanks a lot!

Offline

#8 2013-12-14 19:22:07

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: [SOLVED] Xmobar syntax problem possibly wrong

You're welcome and I have no idea about your python question. But I'm sure that it would be easy enough to test.

Offline

#9 2013-12-14 19:24:24

josealejandro93
Member
Registered: 2013-12-14
Posts: 5

Re: [SOLVED] Xmobar syntax problem possibly wrong

Thanks a lot, will be marking this as solved!

Offline

Board footer

Powered by FluxBB