[分享]实现URxvt真透明背景

系统字体配置、中文显示和输入法问题
回复
XYU
帖子: 32
注册时间: 2007-09-20 22:55

[分享]实现URxvt真透明背景

#1

帖子 XYU » 2007-10-16 22:58

URxvt的伪透明比较容易实现,具体方法可搜索论坛,但实现真透明背景要复杂一些,可使用下面的命令启动urxvt:

urxvt +sb -depth 32 -fg white -bg rgba:0000/0000/0000/cccc
(参考自http://ubuntuforums.org/showthread.php?t=141307

其中,+sb是关闭滚动条(这个参数也可以不要),depth似乎是设置颜色深度,一般都设为32,fg是前景色,也就是字体的颜色,bg是背景色,这里必须使用rgba来定义颜色,即Red Green Blue Alpha,通过调节Alpha值(比如这里的cccc)可以控制透明度,前景色和背景色都可以设置为你自己喜欢的颜色,只是要注意rgba的定义方式

这样就能够实现真透明效果的背景,但每次都要输入这一大串命令很麻烦,因此可以将其写入.Xresources中,在该文件中加入如下内容:

代码: 全选

!关闭scrollbar
URxvt.scrollbar: False
!设置前景色
URxvt.foreground: white
!设置背景色
URxvt.background: rgba:0000/0000/0000/cccc
!设置颜色深度
URxvt.depth: 32
保存后执行xrdb .Xresources,使配置生效(关于urxvt的其他配置方法,请阅读roylez的文章:viewtopic.php?t=66302),然后重启urxvt看看效果吧 :P
附件
urxvt的真透明效果
urxvt的真透明效果
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#2

帖子 eexpress » 2007-10-16 23:51

开了混合渲染吧。如果开了,不需要这样。如果没开,没道理这样。
● 鸣学
XYU
帖子: 32
注册时间: 2007-09-20 22:55

#3

帖子 XYU » 2007-10-17 8:55

如果是Gnome Terminal,必须要开CF才能真透明,但urxvt似乎开了也还是不行,我只有做了上述设置后才可以,否则只能伪透明,莫非还有其他设置方法吗?
头像
roylez
帖子: 1928
注册时间: 2005-10-04 10:59
来自: 上海

#4

帖子 roylez » 2007-10-17 12:54

man rxvt-unicode
ALPHA CHANNEL SUPPORT

If Xft support has been compiled in and as long as Xft/Xrender/X don’t
get their act together, rxvt-unicode will support
"rgba:rrrr/gggg/bbbb/aaaa" (recommended, but MUST have 4 digits/compo‐
nent) colour specifications, in addition to the ones provided by X,
where the additional A component specifies opacity (alpha) values. The
minimum value of 0 is completely transparent). You can also prefix any
color with "[a]", where "a" is on to four hex digits specifiying the
opacity value.

You probably need to specify "-depth 32", too, and have the luck that
your X-server uses ARGB pixel layout, as X is far from just supporting
ARGB visuals out of the box, and rxvt-unicode just fudges around.

For example, the following selects an almost completely transparent red
background, and an almost opaque pink foreground:

urxvt -depth 32 -bg rgba:0000/0000/0000/2222 -fg "[e]pink"

Please note that transparency of any kind if completely unsupported by
the author. Don’t bug him with installation questions!
弄个dropbox空间来备份文件或者做私人代码服务器
配置:[url]git://github.com/roylez/dotfiles.git[/url]
主页:http://roylez.heroku.com
各种稀奇玩意儿:http://dooloo.info
XYU
帖子: 32
注册时间: 2007-09-20 22:55

#5

帖子 XYU » 2007-10-17 13:11

呵呵,我知道man中有相关信息,可是不知道怎么回事,我的机子上man rxvt-unicode却看不到任何内容,所以只好求助于google了
gkeagle
帖子: 28
注册时间: 2008-09-29 16:42

Re: [分享]实现URxvt真透明背景

#6

帖子 gkeagle » 2009-05-01 10:44

为什么我按你的配置设置背景是黑色的呢?
lancelotj
帖子: 19
注册时间: 2006-10-03 9:25

Re: [分享]实现URxvt真透明背景

#7

帖子 lancelotj » 2009-08-22 11:26

urxvt要实现真透明
1. 要运行 xcompmgr
2. .Xdefaults里要有这两样设置:

代码: 全选

urxvt.depth: 32
urxvt.background: [80]black
头像
lxnnix
帖子: 89
注册时间: 2007-08-19 22:24
来自: 南京

Re: [分享]实现URxvt真透明背景

#8

帖子 lxnnix » 2010-02-09 23:46

lancelotj 写了:urxvt要实现真透明
1. 要运行 xcompmgr
2. .Xdefaults里要有这两样设置:

代码: 全选

urxvt.depth: 32
urxvt.background: [80]black
试了一下,这个实在是太经典了!
LXLE了。
头像
泥奇怪
帖子: 139
注册时间: 2010-07-10 21:10
来自: 成都 郫县
联系:

Re: [分享]实现URxvt真透明背景

#9

帖子 泥奇怪 » 2012-06-13 18:07

为什么我安装上urxvt它自己就是透明的?
热爱生命,敬畏自然。
回复