Page 2 of 2
Re: URxvt Config
Posted: Fri Jul 01, 2016 1:52 pm
by aaah
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
Re: URxvt Config
Posted: Fri Jul 01, 2016 11:49 pm
by dkeg
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.
Re: URxvt Config
Posted: Fri Jul 08, 2016 5:24 pm
by stark
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
A quick a dirty solution, is to update the color by piping it to xrdb.
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
Re: URxvt Config
Posted: Mon Jul 11, 2016 9:10 pm
by wuxmedia
nice scripting stark
Re: URxvt Config
Posted: Sat Jul 16, 2016 10:58 am
by daggoth
aaah wrote:How do you over-ride (only temporarily) the default colours you have set in .Xresources ?
I use this script to help me change colors for the current terminal. First create
addcolor, an empty script, and paste in the following...
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}) ;
}
}
But the script depends on a perl module which must be installed from CPAN. So enter the following commands as root...
Code: Select all
apt-get install cpanminus
cpanm Term::ExtendedColor::Xresources
Lastly, to change terminal colors, I do something like this. Doesn't work within tmux though.
Code: Select all
./addcolor <<EOF
*color0: #181818
*color1: #a67558
*color2: #a67458
*color3: #bfb273
EOF
Re: URxvt Config
Posted: Sat Jul 16, 2016 11:33 am
by dkeg
Wow, check that out.