You are not logged in.
Pages: 1
hi. i'm returning to linux after a while, and i have to reconfigure everything. so i've got bspwm here and i'm working on lemonbar, trying to make my script work. the only error when i try to run it is "/home/satan/etc/lemonbar/panel_bar:35: parse error near `}'" so i think i'm getting close but i kinda' hit a roadblock. if anyone can see what i did wrong, please let me know.
#!/usr/bin/zsh
source $HOME/etc/lemonbar/config
while read -r line {
case $line {
S*)
panel_status="%{F$panel_c7}${line#?}%{F-}"
;;
T*)
panel_title="%{F$panel_c7}${line#?}%{F-}"
;;
W*)
panel_info=''
panel_data=${=line}
for i in ${panel_data}; {
case ${panel_data[$i]} {
[OFU]*)
panel_info="$panel_info%{F$panel_c2} •%{F-}"
;;
o*)
panel_info="$panel_info%{F$panel_fg} •%{F-}"
;;
f*)
panel_info="$panel_info%{F$panel_c8} •%{F-}"
;;
u*)
panel_info="$panel_info%{F$panel_c3} •%{F-}"
;;
}
}
;;
}
}
print "%{l}$panel_title%{c}$panel_info%{r}$panel_status"
Offline
Admittedly, I don't use zsh, but I never thought it used curly braces like that. I've check some documentation and tutorials, and I don't see any examples like that.
EDIT: sorry for the noise - I did just find some documentation for that under "alternative loop syntax".
EDIT 2: I may actually be on to something. see section 3.20 the test must be clearly delimited, yours is not on the outer while loop.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
hi. thanks for your reply. i changed that bit to "while [[ $( read -r line ) -le 0 ]] {" and that fixed up my error. now i have to figure out what my next problem is.
edit: okay, i think i'm almost there. the problem now *i think* is that i'm testing `read -r line' in a subshell, so it's not really reading the lines as they come in. anyone have any clue how to fix this?
another edit/update: i thought maybe that if i assigned the results of $( read -r line ) to a variable and used that instead of $line i'd have better results, but i'm having no luck.
yet another edit: i tried changing the while line to "while [[ $(( read -r line ) 2>&1 ) -le 0 ]] {" and that didn't work either. i really thought that would do it. i changed the background of the bar to a ridiculous color so that i could see it pop up and it does. there's just no text.
Last edited by likeahundredninjas (2015-12-14 04:08:19)
Offline
Pages: 1