LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 87462|回复: 111

fvwm: 从入门到提高

[复制链接]
发表于 2005-8-30 22:40:21 | 显示全部楼层 |阅读模式
题目起的有点大,发起这个主题的目的是全面介绍 fvwm 。
从安装、设置谈起,一直到各种技巧。
我会慢慢添加内容,也欢迎喜欢 fvwm 的 sir 批评指正。

什么是 fvwm
欢迎先来看看 Yin Wang 的主页中关于 XWindow 和 fvwm 的介绍:
这两个都是中文网页

http://learn.tsinghua.edu.cn:8080/2001315450/x.html
http://learn.tsinghua.edu.cn:8080/2001315450/fvwm_frame.html

100楼有更新:通过修改源码解决了有些时候alt-tab出窗口列表时崩溃的问题。
102楼有更新:介绍了一个让fvwm更好的支持xft设置字体的补丁。
 楼主| 发表于 2005-8-30 22:43:31 | 显示全部楼层
fvwm 的安装

在 Debian 中 dpkg -p fvwm 可以发现 fvwm 依赖如下包:
Depends: gdk-imlib1, libc6 (>= 2.3.5-1), libfontconfig1 (>= 2.3.0), libfreetype6 (>= 2.1.5-1), libfribidi0 (>= 0.10.4-5), libglib1.2 (>= 1.2.0), libgtk1.2 (>= 1.2.10-4), libice6 | xlibs (>> 4.1.0), libncurses5 (>= 5.4-5), libpng12-0 (>= 1.2.8rel), libreadline4 (>= 4.3-1), librplay3 (>= 3.3.2-2), libsm6 | xlibs (>> 4.1.0), libstroke0 (>= 0.5.1), libx11-6 | xlibs (>> 4.1.0), libxext6 | xlibs (>> 4.1.0), libxft2 (>> 2.1.1), libxi6 | xlibs (>> 4.1.0), libxinerama1, libxpm4 | xlibs (>> 4.1.0), libxrender1 (>> 1:0.9.0-1), zlib1g (>= 1:1.2.1)

rh/fc 的用户可以参考依赖关系找相应的 rpm 。

http://www.fvwm.org/download/ 上有源码包、deb 包和 rpm 包,可以选择自己喜欢的方式来安装。
回复 支持 反对

使用道具 举报

发表于 2005-8-30 22:48:35 | 显示全部楼层
正在研究fvwm ,太好了.
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-8-30 22:49:42 | 显示全部楼层
fvwm 的资料

这里有英文的手册和 FAQ
http://www.fvwm.org/documentation/

英文的 Beginners Guide
http://www.zensites.net/fvwm/guide/index.html

FAQ 被翻译成了中文
http://www.linuxfans.org/nuke/mo ... ewtopic&t=67623

除了 Yin Wang 的主页,这里也是个不错的页面,收集了许多 Tips
http://learn.tsinghua.edu.cn/hom ... blish/GNU/fvwm.html
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-8-30 23:24:31 | 显示全部楼层
这里传上来一张现在使用的抓图

右上角的东西是 fbpanel ,它不是 fvwm 的组件,我用它来做“开始菜单”,并让它位于最前、自动隐藏:
  1. Style "fbpanel*" StaysOnTop

  2. #以下三个函数定义如何隐藏、显示
  3. AddtoFunc autohide
  4. + I ThisWindow ($0) Deschedule $[w.id]
  5. + I ThisWindow ($0) KeepRc ThisWindow (shaded) WindowShade off
  6. + I TestRc (!Match) All ($0, !shaded) autohide_hide $1 $2

  7. AddtoFunc autohide_hide
  8. + I Schedule $0 $[w.id] WindowShade $1
  9. + I Schedule $0 $[w.id] Deschedule $[w.id]

  10. AddToFunc enter_handler
  11. + I autohide fbpanel 100 N

  12. #在 StartFunction 中加入如下代码使得 fbpanel 自动隐藏
  13. AddToFunc StartFunction
  14. + I Module FvwmAuto FvwmAutohide -menter enter_handler
复制代码


fbpanel 除了做开始菜单,还可以做任务栏、sys-tray、launchbar、pager等,我只选用了开始菜单和时钟。通常安装好之后在 /etc/fbpanel/default 中是其默认的配置选项,你可以在自己的 ~/.fbpanel/default 中定义自己的 fbpanel。

当然,除了 fbpanel ,你也可以选择其他的程序来实现这些,fvwm 自己带了 FvwmTaskBar ,也可以用 gnome 的 gnome-panel ,或者 kde 的 kicker (没记错的话,应该是这两个名字)

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-8-30 23:37:58 | 显示全部楼层
桌面上日历、系统信息、天气预报等

请注意:这里介绍的程序都不是 fvwm 的组件,但它们可以帮助 fvwm 变得更漂亮,你也可以在其他窗口管理器里使用这些程序。

我曾经用过的有 gdesklets, gdeskcal, gkrellm, torsmo

gdesklets 包含了各种组件,可以按用户定制显示桌面时钟、系统资源、天气预报、便条等,gdeskcal 则会在桌面上显示日历。

一个小 tip:为了让 gdesklets 透明, fvwm 应该使用 fvwm-root、habak 之类的软件设置背景,用 xloadimage 设置的背景下 gdesklets 不会透明,不知道是不是我用的参数不对。

现在用的是 torsmo ,Debian 中安装好之后在 /usr/share/doc/torsmo/examples 中有默认的配置文件。当然,编译安装的话,该路径和你编译安装时用的 prefix 有关。

--------------------------------
时过境迁啊,两年了,现在torsmo改名叫conky了
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-8-31 12:36:26 | 显示全部楼层
关于 fvwm 的字体

这里转载一篇水木上的文章
fvwm 已经支持 xft 字体
但现在只能用 core font 来支持中英文分别采用不同的字体

要写成类似

  1. MenuStyle * Font "-*-bitstream vera sans-medium-r-normal-*-14-0-0-0-p-0-iso8859-1,  -*-ar pl new sung-medium-r-normal-*-14-*-*-*-c-*-iso10646-1"
复制代码


的格式

发信人: kbe (宝珠), 信区: XWindow
标  题: Re: fvwm窗口标题栏中文是乱码
发信站: 水木社区 (Mon Jul 11 15:28:04 2005), 站内

你还是先多看一下有关字体方面 的文章。
拷贝完字体不等于能够正确安装字体。

你在这步上面是欠缺的,换句话说,你只是做了前期的拷贝工作,后期的配置没有完成。
再重复一下过程,其实这个过程是简单而枯燥的,无趣且乏味的,
没有任何你所宣称的复杂在里头,有的只是你对她的不熟悉而产生的恐惧感。

1.a 拷贝中文字体到 XF86Config-4 或 xorg.conf 文件里面特定的 FontPath 指定的目录。
    一般情况下,你只是需要拷贝到 /usr/share/fonts/ 下面或更下面的目录中,当然,
    这些路径都在前面所说的文件里面有了说明了,所有你才能往里面拷。
    这步呢,就是拷贝字体到正确的目录。
1.b 配置 Core 字体。进到你刚才所拷贝的字体目录,运行 ttmkfdir 生成一个字体描述
    方案,就是类似 -misc-SimSun-medium-r-normal--0-0-0-0-p-0-ascii-0 好多行凑成
    了这么一个文件fonts.dir ,再把她拷贝成 fonts.scale。这样 Core 字体系统就会根
    据这些描述调用具体的相关字体,当然如果实在生不出来,求人或者到网上找一下别人
    的这个文件也行,反正差不多,只要 是同一个字体,就是通用的。
    总之这步,就是正确的生成两个一模一样的文件 fonts.dir fonts.scale
1.c 配置 Xft 字体。这步就简单了。fc-cache -fv 就会自动把字体加入到了列表。
    这步没啥好讲的。

以上,就是字体安装的 程咬金三斧头,之后就什么招也没有了。

判断 1.b 正确完成的标志是 你在 xlsfonts 列表里找到你刚刚安装的字体。
判断 1.c 正确完成的标志是 你在 fc-list  列表里找到你刚刚安装的字体。

由于 X 目前存在两个字体系统,所以才需要上面的 1.b 1.c
当然总有一天,1.b 是会消失的,1.c 是往后发展的主流。

你的 fvwm 不能正确显示中文,跟头就栽在 1.b 上。



--------------------------------------------
继续时过境迁啊...

关于字体,之前坚持用 x core font 的原因是没有合适的 xft 字体,现在有了:文泉驿正黑  http://wqy.sf.net

MenuStyle * Font "StringEncoding=gbk-0:xft:WenQuanYi Zen Hei:size=11:shadow=1:encoding=iso10646-1"
MenuStyle "WindowList"  Font "StringEncoding=gbk-0:xft:WenQuanYi Zen Hei:size=11:shadow=1:encoding=iso10646-1"
Style * Font  "StringEncoding=gbk-0:xft:WenQuanYi Zen Hei:size=12:shadow=1:encoding=iso10646-1"
Style * IconFont  "StringEncoding=gbk-0:xft:WenQuanYi Zen Hei:size=12:shadow=1:encoding=iso10646-1"

我的系统locale设置成了gbk,其他locale的sir可以依据情况设置
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-9-1 13:50:42 | 显示全部楼层
关于窗口的 decoration
窗口的 decoration 是指标题栏的样式、按钮的样式、标题的对齐方式等等。由于 fvwm 设置这些东西通常是在配置文件中进行,所以更换起来不方便,其实有更好的办法。

http://fvwm-crystal.berlios.de/ 上下载一个
http://download.berlios.de/fvwm- ... stal-3.0.RC1.tar.gz
下来,然后解压缩:
  1. tar zxvf fvwm-crystal-3.0.RC1.tar.gz
复制代码

在 fvwm-crystal-3.0.RC1/fvwm/decorations 目录下都是别人做好的窗口 decoration ,把他们拷贝到自己的 .fvwm 目录下,像我这样写一堆 Read 在 .fvwm2rc 里面:
  1. #Read ./decorations/Clear/Violet.theme
  2. #Read ./decorations/Clear/Red.theme
  3. #Read ./decorations/Clear/Orange.theme
  4. #Read ./decorations/Clear/Navy.theme
  5. #Read ./decorations/Clear/Mono.theme
  6. #Read ./decorations/Clear/Green.theme
  7. #Read ./decorations/Clear/Blue.theme
  8. #Read ./decorations/Crystal/WhiteDesktop.theme
  9. #Read ./decorations/Crystal/RedDesktop.theme
  10. #Read ./decorations/Crystal/Red - Cyan.theme
  11. #Read ./decorations/Crystal/IrishDesktop.theme
  12. #Read ./decorations/Crystal/DarkGreen.theme
  13. #Read ./decorations/Crystal/DarkDesktop.theme
  14. #Read ./decorations/Crystal/CrystalZono.theme
  15. #Read ./decorations/Crystal/CIOS.theme
  16. #Read ./decorations/Crystal-Aqua/Default.theme
  17. #Read ./decorations/Dawn of a Terminal/Red.theme
  18. #Read ./decorations/Dawn of a Terminal/Purple.theme
  19. #Read ./decorations/Dawn of a Terminal/Green.theme
  20. #Read ./decorations/Dawn of a Terminal/Blue.theme
  21. Read ./decorations/Elberg/Elberg.theme
  22. #Read ./decorations/Fear/Original.theme
  23. #Read ./decorations/Fear/Original (crystalized).theme
  24. #Read ./decorations/Gentoo/Gentoo.theme
  25. #Read ./decorations/Gentoo/Gentoo Gray.theme
  26. #Read ./decorations/Gentoo/Gentoo Alternative.theme
  27. #Read ./decorations/Industrial/Industrial (Metacity version).theme
  28. #Read ./decorations/Industrial/Industrial (Crystal version).theme
  29. #Read ./decorations/Metabox/Metabox (Metacity version).theme
  30. #Read ./decorations/Metabox/Metabox (Crystal version).theme
  31. #Read ./decorations/Winter/Winter.theme
  32. #Read ./decorations/Winter/Winter (no icon).theme
复制代码

想用哪个的时候,就去掉前面的#注释,这样换起来就方便多了。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-9-1 23:10:58 | 显示全部楼层
关于音量控制

可以用快捷键来搞定,比如下面的代码使得同时按下 alt 和加号是提高音量,alt 和减号是降低音量。当然前提是系统中要有 amixer 命令,这个命令在 Debian 中属于 alsa-utils 包。

  1. Key     equal   A       M       Exec exec amixer set PCM 2%+
  2. Key     minus   A       M       Exec exec amixer set PCM 2%-
复制代码


另外也可以设置一个快捷键来乎出 aumix 之类的 GUI 下控制音量的程序来。
回复 支持 反对

使用道具 举报

发表于 2005-9-2 08:15:18 | 显示全部楼层
我在torsmo中试了好几种字体,都无法正确显示中文,全是方块
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表