You are not logged in.

#1 2015-05-04 04:09:32

derrickcope
Member
Registered: 2015-04-30
Posts: 15

DWM status bar

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

#2 2015-05-04 04:26:07

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: DWM status bar

Have you patched dwm for statusbar colours?


Moving to NC...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2015-05-04 05:42:18

derrickcope
Member
Registered: 2015-04-30
Posts: 15

Re: DWM status bar

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

#4 2015-05-04 06:11:12

frank604
Member
From: BC, Canada
Registered: 2011-04-20
Posts: 1,212

Re: DWM status bar

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

#5 2015-05-04 06:13:31

mauritiusdadd
Member
From: Benevento, Italy
Registered: 2013-10-27
Posts: 776

Re: DWM status bar

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.


About me - github

-- When you have eliminated the impossible, whatever remains, however improbable, must be the truth -- Spock | Sherlock Holmes

Offline

#6 2015-05-04 06:19:35

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: DWM status bar

derrickcope wrote:

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...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#7 2015-05-04 07:00:17

derrickcope
Member
Registered: 2015-04-30
Posts: 15

Re: DWM status bar

mauritiusdadd wrote:
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

#8 2015-05-04 07:20:58

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

Re: DWM status bar

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.

Offline

#9 2015-05-04 07:28:19

derrickcope
Member
Registered: 2015-04-30
Posts: 15

Re: DWM status bar

Raynman wrote:
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

#10 2015-05-04 10:15:19

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

Re: DWM status bar

derrickcope wrote:

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

Board footer

Powered by FluxBB