You are not logged in.
Pages: 1
Why doesn't this show color status in the dwm bar?
red="echo -e \033[34;41mColor Text\033[0m"
xsetroot -name $red
Is my code wrong? or is DWM or Xsetroot removing the color?
Last edited by derrickcope (2015-05-04 04:09:49)
Offline
Have you patched dwm for statusbar colours?
Moving to NC...
Offline
Actually, I patched it for fancy color bar clickable. I have a colored bar. What I am asking is shouldn't it be able to do it already without patching? Bash can output color so why do I have to patch?
Offline
There are a few ways to go about setting color once patched. The way I followed others is:
1) set colors in config.h (recompile dwm)
2) In statusbar script, set color codes to make things easier (usually if you are going to use many colors)
3) Then I add color to whatever I'm piping into the statusbar.
Added a ss of my .files to illustrate above, hope it helps
http://frankshin.com/files/ss/statusbar.png
Offline
What I am asking is shouldn't it be able to do it already without patching? Bash can output color so why do I have to patch?
No. Bash can show colours because it can parse and interpret the escape sequences. Dwm code lacks of that feature and for this reason you have to apply a patch.
Offline
Actually, I patched it for fancy color bar clickable. I have a colored bar. What I am asking is shouldn't it be able to do it already without patching? Bash can output color so why do I have to patch?
You really need to read a lot more about dwm...
Offline
derrickcope wrote:What I am asking is shouldn't it be able to do it already without patching? Bash can output color so why do I have to patch?
No. Bash can show colours because it can parse and interpret the escape sequences. Dwm code lacks of that feature and for this reason you have to apply a patch.
Thanks, that's what I was asking. If xsetroot -name can accept bash sequences then wouldn't it be simple just to use this to show color. @jasonwryan is right, I do need to read up more on dwm. Since I am in China it is problematic to search for things on the web even with a vpn and the suckless website is sparse on infomation.
Seems that this would be the easiest way to add color to the status bar but maybe "xsetroot -name" doesn't output in color even though it does have "-fg -bg" switches.
Offline
Seems that this would be the easiest way to add color to the status bar but maybe "xsetroot -name" doesn't output in color even though it does have "-fg -bg" switches.
`xsetroot -name` just stores the string you give it -- it doesn't exactly care about the content -- and then some other program (like dwm) can read it and interpret it however it wants. As for -fg/-bg:
Foreground and background colors are meaningful only in combination with -cursor, -bitmap, or -mod.
Offline
derrickcope wrote:Seems that this would be the easiest way to add color to the status bar but maybe "xsetroot -name" doesn't output in color even though it does have "-fg -bg" switches.
`xsetroot -name` just stores the string you give it -- it doesn't exactly care about the content -- and then some other program (like dwm) can read it and interpret it however it wants. As for -fg/-bg:
man xsetroot wrote:Foreground and background colors are meaningful only in combination with -cursor, -bitmap, or -mod.
I did see that in the man page. So your are saying xsetroot just holds the string and not any color then?
Offline
I did see that in the man page. So your are saying xsetroot just holds the string and not any color then?
Yes. The foreground and background flags have nothing to do with the "name" text. Xsetroot -name stores a string to the root window's name property - that's it. It doesn't parse the name string, it doesn't interpret escape sequences, it doesn't know what bash color codes are. It just sets the string.
It's just like if you echoed your red text to a file. Check what is in the file: there is no red text. Just text with the escape sequences around it. Bash doesn't interpret escape sequences to make them into some magic colored text that will be viewable in any output - it simply interprets escape sequences when it prints text to the screen.
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
Pages: 1