最小主义: 我的 Musca 桌面环境

{ 撰文/吴吉庆 }

我现在有一个非常简单实用的桌面环境了:Musca + Conky + Trayer。

当然 Musca 运行时需要 dmenu,其实也不是非 dmenu不可,据说 Dzen 也不错。 我现在用的是 dmenu。

先放一张我的桌面截图吧。

Musca

我的 Musca 配置

Musca 是我最近发现的非常喜欢的平铺式窗口管理器。对于它的安装和使用我已经在这里做了介绍。今天主要介绍一下它的配置,也就是在 .musca_start 中写了哪些让 Musca 启动后执行的命令:

# 告诉musca不要管理conky和trayer的窗口
manage off trayer
manage off Conky

# 启动conky和trayer
exec conky
# 为了方便在网页中显示,我把trayer的命令拆为3行,
# 请复制后拼接为一行
exec trayer --edge top --align right --widthtype request
--height 20 --SetDockType true --transparent true
--alpha 255 --tint 0x00ff00

# 设定聚焦帧的边框颜色为橘黄,我喜欢的颜色
set border_focus Orange
# 如果有空帧,则新启动的程序会自动在空帧中打开,这点很方便
set window_open_frame empty
# 不需要单击,鼠标经过的时候窗口就聚焦
set focus_follow_mouse 1
# 设置dmenu的启动命令,我用的是自己编译的支持xft的dmenu
set dmenu /usr/local/bin/dmenu -i -b -fa Sans-12 -p $

# 因为我没有xterm,所以重新绑定Mod4+t启动系统的默认终端
bind off Mod4+t
bind on Mod4+t exec x-terminal-emulator
# 按Mod4+q退出musca,不知道为什么不管用
bind on Mod4+q quit
# 按Mod1(我这里是Alt) + 方向键移动选定的窗口
bind on Mod1+Left slide left
bind on Mod1+Right slide right
bind on Mod1+Up slide up
bind on Mod1+Down slide down

# 按Mod4 + 数字键快速地切换工作组
bind on Mod4+1 use 0
bind on Mod4+2 use 1
bind on Mod4+3 use 2
bind on Mod4+4 use 3
bind on Mod4+5 use 4

# 确定每个工作组的活跃范围,屏幕上留出20像素给conky和trayer
pad 0 0 20 0
hook on ^add pad 0 0 20 0
# 添加一个叫web的工作组,并加载我导出的窗口布局,上网用
add web
load .mweb
# 切换到原来第一个工作组
use 0
load .mdefault

配合 Musca 的 Conky 配置

大家可以看到我的 Conky 中显示了当前工作组的窗口列表,这个怎么实现的呢? Conky自己能通过 ${exec cmd} 显示 cmd 的输出。而我们能通过 musca -c 'show windows' 输出当前组的窗口列表,但是输出的格式是每个窗口一行,这不是我们想要的,我们可以通过 awk,对这个字符串处理一下。综合起来是: ${exec musca -c 'show windows'|awk '{printf " | %s",$0}'}

为了方便大家参考,我将我整个的 Conky 配置文件贴在下面。

# jiqing's conky configuration

# set to yes if you want Conky to be forked in the background
background no

# 使用xft字体
use_xft yes
# 默认的xft字体
xftfont Sans:size=10
# Text alpha when using Xft
xftalpha 1.0

# 每8秒更新一次
update_interval 8.0

# 更新的次数,设为0是永远更新
total_run_times 0

# 使用桌面,不用自己的窗口
own_window no

# If own_window is yes, you may use type normal, desktop or override
own_window_type desktop
# Use pseudo transparency with own_window?
own_window_transparent yes
# If own_window_transparent is set to no, you can set the background colour here
own_window_colour black

# If own_window is yes, these window manager hints may be used
#own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

# 使用双缓冲,避免闪烁
double_buffer yes

# Minimum size of text area
minimum_size 500 18
maximum_width 1340

# Draw shades?
draw_shades no
# Draw outlines?
draw_outline no

# 让conky有边框,我觉得这样酷一点
draw_borders yes

# Draw borders around graphs
draw_graph_borders no

# 边框用实线,不用点画线
stippled_borders no

# border margins
border_margin 3

# border width
border_width 1

# 定义一些颜色
color0 white
color1 yellow
default_color gray73
default_shade_color black
default_outline_color black

# Text alignment, other possible values are commented
alignment top_left

# Gap between borders of screen and text
# same thing as passing -x at command line
gap_x 0
gap_y 2

# Subtract file system buffers from used memory?
no_buffers yes

# set to yes if you want all text to be in uppercase
uppercase no

# number of cpu samples to average
# set to 1 to disable averaging
cpu_avg_samples 2

# number of net samples to average
# set to 1 to disable averaging
net_avg_samples 2

# Force UTF8? note that UTF8 support required XFT
override_utf8_locale yes

# Add spaces to keep things from moving about?  This only affects certain objects.
#use_spacer none
use_spacer left

# Maximum size of buffer for user text, i.e. below TEXT line.
#max_user_text 16384

# Allow for the creation of at least this number of port monitors (if 0 or not set, default is 16)
#min_port_monitors 16

# Allow each port monitor to track at least this many connections (if 0 or not set, default is 256)
#min_port_monitor_connections 256

# variable is given either in format $variable or in ${variable}. Latter
# allows characters right after the variable and must be used in network
# stuff because of an argument

# stuff after 'TEXT' will be formatted on screen
# 为了方便在网页中显示,我把conky输出的内容分为多行,
# 如果你想像我一样在一行中显示,请把TEXT后的内容拼为一行

TEXT
${font Bistream Vera Sans Mono:size=10:bold}${color green}
${time %Y年%m月%d日 %H:%M}$font $color
|$color0 开机时间:$color1 $uptime_short $color
|$color0 CPU:$color1 $cpu% $color
|$color0 内存:$color1 $mem/$memmax
${font Sans:size=9}${color pink}
${exec musca -c 'show windows'|awk '{printf " | %s",$0}'}

最后,说一点心得,其实手动平铺式窗口管理器并不是很难用,大多数情况你都不需要使用浮动窗口模式,只要你合理安排窗口布局,GIMP 你都能用得很舒服。

{ Source. Thanks jiqing. }

Read More:

30 Comments

  1. 1 rhfcaesar Commented @ 2009-11-09 16:33Reply to this comment

    写得不错,不过平铺窗口不适合我用。

  2. 2 yang Commented @ 2009-11-09 16:50Reply to this comment

    已经对自定义linux桌面配置完全失去了兴趣(自从使用osx后)

  3. 3 simonxue21 Commented @ 2009-11-09 16:50Reply to this comment

    的确很难看,呵呵。

  4. 4 进驻 Commented @ 2009-11-09 17:16Reply to this comment

    命令的效率真的有吹捧的那么高么 :) 呵呵

  5. 5 seenxu Commented @ 2009-11-09 17:47Reply to this comment

    想问一下运行中的内存占用如何?

  6. 6 cofairy Commented @ 2009-11-09 18:03Reply to this comment

    musca 还是挺好用的,尤其是我近来笔记本上的左右键坏了后。

  7. 7 Iven Commented @ 2009-11-09 18:26Reply to this comment

    对我来说还是美观更重要……

  8. 8 alen Commented @ 2009-11-09 18:43Reply to this comment

    我看楼主除了浏览器,其它也都不怎么需要了,看来chromeOS还是挺有市场的啊

  9. 9 iarch Commented @ 2009-11-09 19:08Reply to this comment

    看起来很不错,conky配置我喜欢

  10. 10 jiqingwu Commented @ 2009-11-09 19:44Reply to this comment

    @seenXu: 刚登录musca时,不运行其它程序,70M左右。我还在用ubuntu 8.04。

    @alen: 这个只是我上网的那个虚拟桌面,呵呵。我写文章时是在另外的桌面的。

  11. 11 kidfruit Commented @ 2009-11-09 20:34Reply to this comment

    @yang: 用OSX5年了没觉得哪里有质的优势,都是噱头罢了……而且说什么便宜,实际上价格都在机器中,真要零售OSX估计比windows还要贵一圈。1万多的mac book啊……还是linux实在……

  12. 12 yeaha Commented @ 2009-11-09 21:23Reply to this comment

    看了你的上一篇文章之后,我已经把我的wmii换成了musca,手动平铺的确很舒服,感谢推荐

  13. 13 jiqingwu Commented @ 2009-11-09 21:29Reply to this comment

    @yeaha: 不用客气。musca还在不断地更新中,希望后面有更好的特性加入。

  14. 14 發條狐狸 Commented @ 2009-11-09 22:07Reply to this comment

    用宽屏还好,右边还有地方利用..我们这种普通的1024*768的就不爽了.

  15. 15 alexmajy Commented @ 2009-11-09 22:49Reply to this comment

    现在用的是awesome,感觉用平铺开shell确实很爽,但是要是碰到多窗口gui程序比如eclipse或者gimp什么的感觉就不是很好使,还是想切回浮动窗口。也许平铺是为cli专业户设计的。不过说的这个手动分割tile好像是我想要的那个东东,回头有空试试看。不知道有没有哪个wm允许在某个桌面用tile,某个桌面用stack?

  16. 16 jiqingwu Commented @ 2009-11-10 2:08Reply to this comment

    @alexmajy: 对于多窗口程序,手动平铺的wm比动态平铺的wm要好一些, 因为你可以根据程序的多个窗口,手动分割出适当的布局,然后把各个窗口摆放好,这样用起来也挺好的。

    “不知道有没有哪个wm允许在某个桌面用tile,某个桌面用stack?” musca和ion都可以啊。awesome不是也可以吗?几乎所有的平铺窗口管理器都可以吧,除了ratpoison。

  17. 17 jiqingwu Commented @ 2009-11-10 2:25Reply to this comment

    @發條狐狸: 我习惯平铺了,所以在自己的笔记本上也用,1024x768的屏幕, 因为手动分割,所以可以灵活布局。 比如我看论文时就把屏幕分为上下两部分,上边的窗口大些,打开论文, 下边的窗口打开文本编辑器,做些记录。

  18. 18 seenxu Commented @ 2009-11-10 2:35Reply to this comment

    @jiqingwu:

    我是想问问musca单独占用内存的情况。

  19. 19 jiqingwu Commented @ 2009-11-10 3:03Reply to this comment

    @seenxu: 我现在开了三个虚拟桌面,用ps查看了musca的内存占用, 显示为0.1%,我的内存是1G的,就是说musca用了1M左右?非常少了。

  20. 20 sw2wolf Commented @ 2009-11-10 9:12Reply to this comment

    已经习惯xmonad了, 呵呵!

  21. 21 kaji331 Commented @ 2009-11-10 11:22Reply to this comment

    其实还是win7里面舒服,随便一拖就变成平铺了,平时还是堆叠的,毕竟平铺一般人用的不多,简单平铺就够了~就这简单平铺一般人还不会用呢~唉,vista出来这么久了,居然很多人不知道Flip 3D是用win+Tab的

  22. 22 jiqingwu Commented @ 2009-11-10 11:30Reply to this comment

    @kaJi331: 我试过windows的平铺,不能与平铺式窗口管理器的平铺相提并论。你用windows平铺后,还是要手动调整每个窗口的大小,而且你调整一个窗口的大小,跟它相邻的窗口的大小也不会自动调整。 这样的平铺基本没用。

  23. 23 jiqingwu Commented @ 2009-11-10 11:35Reply to this comment

    @sw2wolf: 我觉得不管用什么,习惯了就好。 每个人的喜好不同,有人喜欢漂亮,有人喜欢实用, 就在喜欢实用的人中,人们的喜好也很不同。 总之,找到自己喜欢的,即使它有一些缺点,也能包容就最好了。 就像找女朋友一样,呵呵。

  24. 24 xhh Commented @ 2009-11-10 22:53Reply to this comment

    相信楼主也是KISS原则的执行者,我也非常喜欢这种简洁高效的桌面环境。 P.S. 我的配置是 archlinux, gtk, 装了gtk-chtheme,在gnome-look和art.gnome.org上有很多简洁漂亮的主题可用, 装了以后Eclipse之类的界面好看多了 ;)

  25. 25 xhh Commented @ 2009-11-10 22:55Reply to this comment

    对了,平铺式窗口管理器和Thinkpad的小红点一起用太happy了 :)

  26. 26 cx Commented @ 2009-11-11 0:16Reply to this comment

    用FVWM,桌面自定义还是很方便的,通过各种组合就能开启各种程序。很个性化。最近打算在工作机上用Musca

  27. 27 jiqingwu Commented @ 2009-11-11 14:48Reply to this comment

    @xhh:

    恩,我的确喜欢unix哲学。尤其喜欢kiss和“只做一件事,并做好它。”

    对,ThinkPad的小红点和平铺式窗口管理器的确配合得好。

  28. 28 jiqingwu Commented @ 2009-11-11 14:50Reply to this comment

    @cx:

    Fvwm很不错,我最开始用Linux用的就是Fvwm。 不过现在只用musca了。

  29. 29 NONE Commented @ 2009-11-13 6:48Reply to this comment

    不就是少了几个 _口X 嘛,有必要把tiling window manager说得这么难看吗?我觉得,好不好看都是做出来的,工厂模式出来的东西肯定好看啊,统一,但是要自己一个一个调整是很难。 我也是看了LZ的这个文章才开始用tiling window manager的,我用的是xmonad,目前还在调整中,基本上组建方面还是喜欢KDE拿一点,GNOME拿一点,确实是很方便。

  30. 30 Robin Commented @ 2010-01-30 21:18Reply to this comment

    load .mweb,请问mweb文件的格式是怎样的呢?