You are not logged in.

#1 2013-05-02 17:13:26

etere
Member
Registered: 2012-12-30
Posts: 7

dwm-pango escaping ansi status color

Hi, i'm trying to ouput to dwm-pango default status bar some colored info like date and time. I patched the dwm.c file with this correctly because I didn't get errors.
Trying this simple example below the bar outputs literally the string, without escaping.

xsetroot -name "\033[1;36mHELLO"

Does the patch work with pango patched dwm?
If yes, can somebody, kindly, explain me how to output colors to the statusbar?`

Bye!

Offline

#2 2013-05-03 16:12:51

etere
Member
Registered: 2012-12-30
Posts: 7

Re: dwm-pango escaping ansi status color

No one?

Offline

#3 2013-05-03 20:28:40

Unia
Member
From: The Netherlands
Registered: 2010-03-30
Posts: 2,474
Website

Re: dwm-pango escaping ansi status color

I have no experience with that patch. I think it's a rather ugly approach to having colors, I think you might better go with statuscolors patch, however it will require some modifications to get going with Pango.

Is there a specific reason for using DWM Pango? If not, it will again be easier to use XFT instead of it.


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

#4 2013-05-04 07:49:38

etere
Member
Registered: 2012-12-30
Posts: 7

Re: dwm-pango escaping ansi status color

Thank you for the answers. As I am a newbie I don't know the difference beetween pango and xft, i took the first one with TTF/OTF support.
Anyway, I manged to install dwm with xft patch and I was looking at statuscolor patch instructions, but I didn't understand if I can change the color of the text or only the background.

Offline

#5 2013-05-04 08:24:44

Unia
Member
From: The Netherlands
Registered: 2010-03-30
Posts: 2,474
Website

Re: dwm-pango escaping ansi status color

You can change both with statuscolors. This one works with an XFT patched DWM: https://github.com/Unia/DWM/blob/master … olors.diff

Look at the config.h in the same GitHub repository to see how I set the colors. Applying them uses escape codes like below, just put them in your status script:

\x01 FIRST COLOR \x02 SECOND COLOR \xN N'TH COLOR

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

#6 2013-05-04 09:47:01

etere
Member
Registered: 2012-12-30
Posts: 7

Re: dwm-pango escaping ansi status color

Thanks, mhhm someting goes wrong with the patch.
I copied your diff to src folder, where there is dwm.c, and I did this and the output:

patch -Np1 < ../02-dwm-6.0-statuscolors.diff 
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- dwm.c.orig	2013-03-30 22:57:38.146738373 +0100
|+++ dwm.c	2013-03-30 23:04:34.136731375 +0100
--------------------------
File to patch: dwm.c
patching file dwm.c
Hunk #1 succeeded at 49 (offset -1 lines).
Hunk #2 succeeded at 101 (offset -1 lines).
Hunk #3 succeeded at 178 (offset -12 lines).
Hunk #4 FAILED at 782.
Hunk #5 succeeded at 771 (offset -55 lines).
Hunk #6 succeeded at 808 (offset -55 lines).
Hunk #7 FAILED at 886.
Hunk #8 succeeded at 878 (offset -55 lines).
Hunk #9 succeeded at 1146 (offset -54 lines).
Hunk #10 succeeded at 1614 (offset -54 lines).
Hunk #11 FAILED at 1745.
Hunk #12 succeeded at 1771 (offset -65 lines).
3 out of 12 hunks FAILED -- saving rejects to file dwm.c.rej

Anyway thank you again for the reply!

Offline

#7 2013-05-04 17:20:16

Unia
Member
From: The Netherlands
Registered: 2010-03-30
Posts: 2,474
Website

Re: dwm-pango escaping ansi status color

You're not using pertag2, I guess. Open up my patch and change every instance of

tags[i].name
to 
tags[i]

Then it should work, I think. If not, please paste the failing parts.


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

#8 2013-12-05 20:04:15

la11111
Member
Registered: 2012-11-11
Posts: 11

Re: dwm-pango escaping ansi status color

hello,

with the ansistatuscolors patch, if setting colors from a shell script, you have to type "Ctrl-v ESC" to create the \033 character. when you type it in it looks like '^['

so it will look like 'xsetroot -name "^[[1;36mHELLO" ', which prints out in a light blue color.

I've only compiled it with vanilla dwm as I use artwiz fonts, but i suspect that patching it with the ansistatuscolors patch first would be successful, since all of the code is in a big chunk at the bottom of the dwm.c file.

Edit: I just tried it and it looks like it would require some tweaking. It patches fine but doesn't compile.

Last edited by la11111 (2013-12-05 20:21:02)

Offline

Board footer

Powered by FluxBB