How do you over-ride (only temporarily) the default colours you have set in .Xresources ?
If I try to open urxvt with a yellow background ie
urxvt -bg yellow
when it opens I see a quick flash of yellow but then it goes to black as set in .Xresources
URxvt Config
Re: URxvt Config
I'd say that is b/c when urxvt loads, it loads from .Xresources, thus undoing your -bg change. Potentially, and this is really just me thinking out loud, you could leave bg as a variable, then create a function in bashrc to take your bg parameter and insert into you .xresource file as a parameter. The -bg variable may need to be hex.
Or if you want to take the easy way out, comment out the bg value in xresources, and set the bg parameter each time you start urxvt. With no parameter set, by default it will be white bg
Have fun, get creative, and if figure out a cool solution, share it.
Or if you want to take the easy way out, comment out the bg value in xresources, and set the bg parameter each time you start urxvt. With no parameter set, by default it will be white bg
Have fun, get creative, and if figure out a cool solution, share it.
Work hard; Complain less
Re: URxvt Config
A quick a dirty solution, is to update the color by piping it to xrdb.aaah wrote:How do you over-ride (only temporarily) the default colours you have set in .Xresources ?
If I try to open urxvt with a yellow background ie
urxvt -bg yellow
when it opens I see a quick flash of yellow but then it goes to black as set in .Xresources
NOTE: The color you set will stay the same for all new instances of urxvt launched, unless you update it again ( via this script by providing 'reload' as an argument, which loads from the current Xresource file, modify XRES to mention the location and/ name of the your current Xresource/Xdefaults file where your usual colors for urxvt is mentioned ) or you can update it manually. Feel free to modify this dirty solution to your needs : )
Code: Select all
#!/bin/sh
# A quick and dirty solution for temporarily changing color for rxvt-unicode
# If no arguments provided then print usage and exit
[ $# -lt 1 ] && {
printf '\033[31m%s\033[0m\n' 'No arguments provided'
printf 'usage: %s\n' "$(basename $0) <color | reload>"
printf 'examples:\n\nChange color:\n %s\n' "$(basename $0) 013370"
printf 'Reload color from Xresources. See $XRES in this script:\n %s\n' "$(basename $0) reload"
exit 1
}
# Location of the Xresource/Xdefault
XRES="$HOME/.Xresources"
# Terminal: if we are running urxvt in daemon mode then set the respective client as the TERM
test "$(pgrep urxvtd)" && TERM=urxvtc || TERM=urxvt
_reload()
{
# Merge changes from exisiting Xresource/Xdefaults file
xrdb -merge "$XRES"
}
case "$1" in
*[0-9]* | *[a-f]* | *[A-F]*)
printf 'URxvt*background: #%s\n' "$1" | xrdb -merge
exec $TERM &
;;
reload)
# Reload when 'reload' is provided as an argument
_reload
;;
esac
exit 0
Last edited by stark on Tue Jul 12, 2016 6:28 am, edited 1 time in total.
If you can do it go ahead and do it, if you can't do it then don't even criticize it. - gingerdesu
Re: URxvt Config
I use this script to help me change colors for the current terminal. First create addcolor, an empty script, and paste in the following...aaah wrote:How do you over-ride (only temporarily) the default colours you have set in .Xresources ?
Code: Select all
#!/usr/bin/perl -w
use Term::ExtendedColor::Xresources qw( set_xterm_color ) ;
while (<>) {
if (/^\D*color(\d+):?\s+#?(\w+)/) {
set_xterm_color({ $1 => $2}) ;
}
}
Code: Select all
apt-get install cpanminus
cpanm Term::ExtendedColor::Xresources
Code: Select all
./addcolor <<EOF
*color0: #181818
*color1: #a67558
*color2: #a67458
*color3: #bfb273
EOF