You are not logged in.

#1 2013-04-06 09:44:03

parazyd
Member
From: Amsterdam
Registered: 2012-10-14
Posts: 259
Website

DWM Statuscolors direct from .xinitrc

Is it possible to use statuscolors without an external script, but directly from .xinitrc?
If so, how?

Offline

#2 2013-04-06 10:08:23

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: DWM Statuscolors direct from .xinitrc

Statuscolor is a patch, not a script. I think you mean the script that sets the status? I don't think that's possible, why would you want to do this?


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#3 2013-04-06 10:15:48

parazyd
Member
From: Amsterdam
Registered: 2012-10-14
Posts: 259
Website

Re: DWM Statuscolors direct from .xinitrc

Yeah, I mean the script to set colors. Just experimenting, trying to keep files to a minimum.
So, not possible? But why?

Offline

#4 2013-04-06 10:44:40

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: DWM Statuscolors direct from .xinitrc

parazyd wrote:

Yeah, I mean the script to set colors. Just experimenting, trying to keep files to a minimum.
So, not possible? But why?

There is no such thing as a script to set colors. You use a script to write information to your root window which DWM reads and copies into the statusbar. You just use 'codes' so that DWM knows when to use which color (if you patched DWM with the statuscolor patch). I don't think it's possible to use xinitrc for that purpose as I think it's only read/run once: when X starts. Your statusbar script needs to keep running, unless you only want to have the information from when X starts..

Maybe it can work, I honestly can't say it 100% sure. Think of things like a loop and whatnot.


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#5 2013-04-06 10:50:37

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

Re: DWM Statuscolors direct from .xinitrc

You can definitely set status info from xinitrc.

while :; do xsetroot -name "$(date)"; sleep 1; done &
exec dwm

If you want colors, you'd just modify the "date" command to suit what you want.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#6 2013-04-06 12:28:17

parazyd
Member
From: Amsterdam
Registered: 2012-10-14
Posts: 259
Website

Re: DWM Statuscolors direct from .xinitrc

@Trilby: When I add

... -name "$(\x01 date)"; ...

It doesn't echo anything.

Last edited by parazyd (2013-04-06 12:31:16)

Offline

#7 2013-04-06 12:53:14

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

Re: DWM Statuscolors direct from .xinitrc

Of course it doesn't "\x01" is not a shell command.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#8 2013-04-06 12:56:20

parazyd
Member
From: Amsterdam
Registered: 2012-10-14
Posts: 259
Website

Re: DWM Statuscolors direct from .xinitrc

So I still need an outside script...

Offline

#9 2013-04-06 13:37:23

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

Re: DWM Statuscolors direct from .xinitrc

No, anything you can put in a script, you can put in xinitrc.  xinitrc is interpreted by bash (or your default shell).

But `xsetroot -name $(\x01 date)` wouldn't work any better in an outside script than it would in xinitrc.  `\x01 date` is not a shell command.

It sounds like you need help writing your status script - if so there are several threads with many examples.  But the question you asked here is whether the status script stuff can be put in xinitrc.  To that the answer is a simple 'yes'.  But if it wouldn't work in your status script, it also wouldn't work in xinitrc.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#10 2013-04-06 13:54:53

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: DWM Statuscolors direct from .xinitrc

^ That's what I meant with "I am not 100% sure" tongue

OTOH, I do think that once you start incorporating battery information, WiFi, music etc, an external script is just easier. Especially if you're going to use functions for these.


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#11 2013-04-06 14:28:36

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

Re: DWM Statuscolors direct from .xinitrc

I never put any of that in xinitrc - it just seemed cluttered and ugly.  So yes IMHO I'd say a separate script (or program) is better for organization - but it makes no difference in terms of functionality.  Xinitrc is a shell script.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#12 2013-04-06 14:54:40

parazyd
Member
From: Amsterdam
Registered: 2012-10-14
Posts: 259
Website

Re: DWM Statuscolors direct from .xinitrc

Thanks guys smile

Offline

Board footer

Powered by FluxBB