Set rxvt bg/fg colors using variables [SOLVED]

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

Set rxvt bg/fg colors using variables [SOLVED]

#1 Post by Argolance »

Bonjour,
How to: all is in the title...
This works:

Code: Select all

rxvt +sb -b 20 -g 40x2 -fg \#000000 -bg \#ffffff -title "$(gettext 'TEST')"
This doesn't (it is the one I started from because I tried many things, using " and/or/both ', here and there "\'''" ' "\\$ *: @#°^}ch... :D).

Code: Select all

# FG=#000000
# BG=#ffffff
# rxvt +sb -b 20 -g 40x2 -fg \$FG -bg \$BG -title "$(gettext 'TEST')"
rxvt: unable to parse color '$FG', using pink instead.
rxvt: unable to parse color '$BG', using pink instead.
rxvt: unable to parse color '$BG', using pink instead.
# 
Probably simple but...
Thank you!

Cordialement.
Last edited by Argolance on Mon 23 Jun 2014, 15:54, edited 1 time in total.

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#2 Post by MochiMoppel »

Code: Select all

FG='#000000' 
BG='#ffffff' 
rxvt +sb -b 20 -g 40x2 -fg $FG -bg $BG -title "$(gettext 'TEST')"

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#3 Post by Argolance »

Hello,
Thank you for answering.
Things are more complicated in my case because I get colors from cat commands:

Code: Select all

# FOREGROUND=`cat /root/.jwm/jwm_colors | grep 'FOREGROUND'| cut -d'=' -f2`
# ACTIVE_BG=`cat /root/.jwm/jwm_colors | grep 'ACTIVE_BG'| cut -d'=' -f2`
# echo $FOREGROUND
'#000000'
# echo $ACTIVE_BG
'#B0ADA7'

Code: Select all

# rxvt +sb -b 20 -g 40x2 -fg $FOREGROUND -bg $ACTVE_BG -title "$(gettext 'TEST')"
rxvt: "TEST": malformed option.
rxvt-unicode (urxvt) v9.05 - released: 2008-06-15
options: xft,styles,combining,blink,encodings=eu+vn,transparent,tint,XIM,frills,selectionscrolling,wheel,slipwheel,smart-resize,cursorBlink,pointerBlank,scrollbars=plain+rxvt
Usage: rxvt [-help] [--help]
 [-display string] [-tn string] [-geometry geometry] [-C] [-iconic]
 [-cd string] [-/+rv] [-/+ls] [-/+j] [-/+ss] [-/+ptab] [-/+sb] [-/+sr] [-/+st]
 [-sbt number] [-/+si] [-/+sk] [-/+sw] [-/+ip] [-/+tr] [-tint color]
 [-sh number] [-/+ut] [-/+vb] [-/+tcw] [-/+insecure] [-/+uc] [-/+bc] [-/+pb]
 [-bg color] [-fg color] [-hc color] [-cr color] [-pr color] [-pr2 color]
 [-bd color] [-fn fontname] [-fb fontname] [-fi fontname] [-fbi fontname]
 [-/+is] [-im name] [-pt style] [-imlocale string] [-imfont fontname]
 [-name string] [-title string] [-n string] [-sl number] [-embed windowid]
 [-depth number] [-/+override-redirect] [-pty-fd fileno] [-/+hold] [-w number]
 [-b number] [-/+bl] [-lsp number] [-/+sbg] [-mod modifier] [-/+ssc] [-/+ssr]
 [-e command arg ...]

Code: Select all

# rxvt +sb -b 20 -g 40x2 -fg \$FOREGROUND -bg \$ACTVE_BG -title "$(gettext 'TEST')" 
rxvt: unable to parse color '$FOREGROUND', using pink instead.
rxvt: unable to parse color '$ACTVE_BG', using pink instead.
rxvt: unable to parse color '$ACTVE_BG', using pink instead.
... and so on! :oops:

Cordialement.

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#4 Post by SFR »

Don't worry, it happens to the best of us. ;)

Greetings!
Attachments
Screenshot.jpg
(61.45 KiB) Downloaded 203 times
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#5 Post by Argolance »

Thanks a lot SFR! :D
... But this doesn't solve the problem!

Code: Select all

# FOREGROUND=`cat /root/.jwm/jwm_colors | grep 'FOREGROUND'| cut -d'=' -f2`
# ACTIVE_BG=`cat /root/.jwm/jwm_colors | grep 'ACTIVE_BG'| cut -d'=' -f2` 
# rxvt +sb -bd $FOREGROUND -b 2 -g 40x4+100+100 -fg $FOREGROUND -bg $ACTIVE_BG -title "Xlock: $(gettext 'TEST')"
rxvt: unable to parse color ''#000000'', using pink instead.
rxvt: unable to parse color ''#B0ADA7'', using pink instead.
rxvt: unable to parse color ''#000000'', using pink instead.
Cordialement.

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#6 Post by SFR »

Argolance wrote:Thanks a lot SFR! :D
... But this doesn't solve the problem!

Code: Select all

# FOREGROUND=`cat /root/.jwm/jwm_colors | grep 'FOREGROUND'| cut -d'=' -f2`
# ACTIVE_BG=`cat /root/.jwm/jwm_colors | grep 'ACTIVE_BG'| cut -d'=' -f2` 
# rxvt +sb -bd $FOREGROUND -b 2 -g 40x4+100+100 -fg $FOREGROUND -bg $ACTIVE_BG -title "Xlock: $(gettext 'TEST')"
rxvt: unable to parse color ''#000000'', using pink instead.
rxvt: unable to parse color ''#B0ADA7'', using pink instead.
rxvt: unable to parse color ''#000000'', using pink instead.
Cordialement.
Well, the variables contain, e.g. 'black' (note the single quotes) instead of just black.
Try this instead:

Code: Select all

# FOREGROUND=`grep 'FOREGROUND' /root/.jwm/jwm_colors | cut -d "'" -f2`
# ACTIVE_BG=`grep 'ACTIVE_BG' /root/.jwm/jwm_colors | cut -d "'" -f2`
Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#7 Post by Argolance »

Thank you!
This works fine.

Cordialement
Attachments
140623_174851_456x151_easyshot.png
(6.02 KiB) Downloaded 285 times

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#8 Post by amigo »

echo (or eval) will get rid of quotes, so this should work:

Code: Select all

rxvt +sb -b 20 -g 40x2 -fg $(echo $FOREGROUND) -bg $(echo $ACTIVE_BG) -title "$(gettext 'TEST')" 

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#9 Post by Argolance »

Thanks!

Cordialement.

Post Reply