[转帖]fluxbox 初学者指南

Ubuntu各种衍生版本
回复
头像
wdw443
帖子: 58
注册时间: 2006-11-19 18:27
来自: 深圳

[转帖]fluxbox 初学者指南

#1

帖子 wdw443 » 2008-08-17 12:56

原文链接:http://ubuntuforums.org/showthread.php? ... ht=fluxbox
声明:本翻译转载没有征求原作者同意,如果原作者有意见,本文可以立即删除!---译者wdw443
-------------------------------------------------------------------------------------------------------------------------------------------------------
fluxbox 初学者指南

本指南适用 Ubuntu Desktop 用户,而非 Server 用户。

本文是 fluxbox 初学者入门教程。

在你打算安装 fluxbox 之前请先明白 flubxbox 在某种意义上并非最友好的窗口管理器。所以如果你使用 xfce/gnome/kde 等窗口管理器有困难的话,那么 fluxbox 可能也就不适合你。话说回来,如果你厌烦了使用这些窗口管理器,那么你当然可以尝试 fluxbox 。

-----
1、安装
打开 terminal ,使用 apt 来安装。

代码: 全选

sudo apt-get install fluxbox
2、启动 fluxbox
注销,登录时在会话中选择 fluxbox 启动

3、使用
在桌面上鼠标右键单击以弹出菜单(menu)。
该菜单(menu)是程序安装后自动生成的,你的所有程序应该已经在 "applications" 栏下及各个子菜单中。
自个在 fluxbox 里面逛逛熟悉下环境!
fluxbox初装后是不能在桌面上显示图标的,当然有多种方法可以达成这个目的。

4、快捷键
配置文件是 /home/username/.fluxbox/keys 。
使用文本编辑器打开该文件。
里面已经有一些快捷键设置,你可以按个人喜好依葫芦画瓢学着作些修改。
在开始添加新的快捷键设置时,你需要先明白以下几个键的表示方式:
Mod1 == Alt
Mod4 == Windows key (译注:就是键盘上有windows旗标的那个键)
Control == Ctrl
Shift == Shift
从而快捷键“alt + f1”的表示应该是“Mod1 F1”。
除了上面那些键外,其余的表示基本不变。(译注:笔记本上的功能按键(Fn + xx)有自己的表示方式)
我发现把应用程序和按键绑定后使用起来很爽!
因为这么做后,我基本上可以不用鼠标右键菜单了,这节省了不少时间。
下面是我的 keys 文件:
OnDesktop Mouse1 :HideMenus
OnDesktop Mouse2 :WorkspaceMenu
OnDesktop Mouse3 :RootMenu
OnDesktop Mouse4 :NextWorkspace
OnDesktop Mouse5 :PrevWorkspace
Mouse8 :NextWorkspace # top side button mouse -> next workspace
Mouse9 :PrevWorkspace # bottom side button mouse -> prev workspace

Mod1 Tab :NextWindow
Mod1 Shift Tab :PrevWindow

# Launch programs

F12 :ExecCommand xterm # opens a cli client
F11 :ExecCommand firefox # opens the firefox webbrowser client
F10 :ExecCommand thunar # opens the thunar file manager
F9 :ExecCommand mousepad # opens the mousepad text editor
F8 :ExecCommand sonata # opens the sonata music player
Mod1 F2 :Exec fbrun # opens a “run” dialog window, similar to “alt+f2″ in gnome

# Media keys

# System Volume
F2 :Exec amixer sset Master,0 5%- # raise volume by 5%
F3 :Exec amixer sset Master,0 5%+ # lower volume by 5%
F4 :Exec amixer sset Master,0 toggle # mute volume

# MPC (music player command for music player deamon)
F6 :Exec mpc next # plays next song in playlist
F5 :Exec mpc prev # plays previous songs in playlist
F7 :Exec mpc toggle # pauses or play the song

# Visual

F1 :ToggleDecor # removes or adds window decoration

# Screen shot:

Control F12 :Exec scrot -e ‘mv $f ~/Desktop’ # takes a screen shot of the entire screen
(Exec 和 ExecCommand 是一样的)
如果你打算使用 nautilus,需要加上参数 “nautilus --no-desktop”。

5、改善视觉效果
5.1 Styles (风格)
fluxbox自带有不少相当好的 styles (桌面鼠标右键单击 -> styles),网上也有更好的styles可以下载。
一个简单的 google 搜索你就可以找到不少,http://customize.org/fluxbox是其中不错的一个
把下载的 .tar.gz压缩styles文件解压到 /home/username/.fluxbox/styles目录下,
之后你就可以在右键菜单 -> styles 下选择使用它们。

5.2 Gtk themes
大多数应用程序默认使用的是丑陋的灰不喇叽的 nautilus 颜色(我把它叫做 win95主题),实在有碍观瞻。
有一个不错的小软件可以让你自由选择 gtk 主题:

代码: 全选

 sudo apt-get install gtk-chtheme
在 terminal 中运行它你就可以选择安装在目录 /home/username/.themes 下的 gtk 主题。(译注:gnome-look.org网站有很多不错的gtk主题可供下载)
在gtk-chtheme软件中你还可以预览到主题的效果。
图片

5.3 壁纸 (wallpaper)
使用下面的命令设置壁纸。

代码: 全选

fbsetbg -f /path/to/image.png
5.4 Conky
如果说conky无处不宜,那么可以肯定fluxbox是其中一个可以大展拳脚之地。
安装请参考:http://linuxowns.wordpress.com/2008/01/18/conky/

6、编辑 startup 文件
你可以在其中添加程序、命令让它在fluxbox启动时执行。
该文件在 /home/username/.fluxbox/startup
修改这个文件非常简单。
默认内容如下:
# fluxbox startup-script:
#
# Lines starting with a '#' are ignored.

# You can set your favourite wallpaper here if you don't want
# to do it from your style.
#
# fbsetbg -f ~/pictures/wallpaper.png
#
# This sets a black background

/usr/local/bin/fbsetroot -solid black

# This shows the fluxbox-splash-screen
# fbsetbg -C /usr/local/share/fluxbox/splash.jpg

# Other examples. Check man xset for details.
#
# Turn off beeps:
# xset -b
#
# Increase the keyboard repeat-rate:
# xset r rate 195 35
#
# Your own fonts-dir:
# xset +fp $HOME/.font
#
# Your favourite mouse cursor:
# xsetroot -cursor_name right_ptr
#
# Change your keymap:
# xmodmap ~/.Xmodmap

# Applications you want to run with fluxbox.
# MAKE SURE THAT APPS THAT KEEP RUNNING HAVE AN & AT THE END.
#
# unclutter -idle 2 &
# wmnd &
# wmsmixer -w &
# idesk &

# And last but not least we start fluxbox.
# Because it is the last app you have to run it with exec before it.

exec /usr/local/bin/fluxbox
# or if you want to keep a log:

dsf
# exec /usr/local/bin/fluxbox -log ~/.fluxbox/log
话说你想在pc启动后壁纸就已经设置好,而不是后续再敲命令来设置,那么请看下面这行,
# fbsetbg -f ~/pictures/wallpaper.png
你只要把前面的注释字符#删除,并调整壁纸所在路径即可。
另外ubuntu系统是大小写敏感的,请注意大小写是否书写正确。

再来看看如果你想添加 conky 该怎么办。
查找以下文本块,
# Applications you want to run with fluxbox.
# MAKE SURE THAT APPS THAT KEEP RUNNING HAVE AN & AT THE END.
#
# unclutter -idle 2 &
# wmnd &
# wmsmixer -w &
# idesk &
只要在这个文本块后添加 "conky &"就可以了,注意前面没有"#"号。

我的startup文件如下:
# fluxbox startup-script:
#
# Lines starting with a ‘#’ are ignored.

# You can set your favourite wallpaper here if you don’t want
# to do it from your style.
#
fbsetbg -f /home/rw/Pictures/wall.jpg
#
# This sets a black background

#/usr/bin/fbsetroot -solid black

# This shows the fluxbox-splash-screen
fbsetbg -C /usr/share/fluxbox/splash.jpg

# Other examples. Check man xset for details.
#
# Turn off beeps:
# xset -b
#
# Increase the keyboard repeat-rate:
# xset r rate 195 35
#
# Your own fonts-dir:
# xset +fp “/home/rw/.fonts”
#
# Your favourite mouse cursor:
# xsetroot -cursor_name right_ptr
#
# Change your keymap:
# xmodmap “/home/rw/.Xmodmap”

# Applications you want to run with fluxbox.
# MAKE SURE THAT APPS THAT KEEP RUNNING HAVE AN ”&” AT THE END.
#
# unclutter -idle 2 &
# wmnd &
# wmsmixer -w &
# idesk &
conky &
mpd &
mediatomb &

# And last but not least we start fluxbox.
# Because it is the last app you have to run it with ”exec” before it.

exec /usr/bin/fluxbox
# or if you want to keep a log:
# exec /usr/bin/fluxbox -log “/home/rw/.fluxbox/log”
7、编辑菜单 (menu)
之前看到的菜单是自动生成的,你会发现 /home/username/.fluxbox/menu 实际上是指向 /etc/X11/fluxbox/fluxbox-menu的。
我们可以以它为基础进行编辑,先把上面的文件拷贝成 /home/username/.fluxbox/menu
接着就可以开始修改,你只要大致浏览下文件内容应该就有点眉目知道该如何修改了。
一般如下所示:
[begin] (Fluxbox)
[exec] (xterm) {xterm}
[separator]
[submenu] (Tools)
[exec] (Galculator) {galculator}
[exec] (Gnome Commander) {gnome-commander}
[exec] (File Roller) {file-roller}
[exec] (K3B) {k3b}
[exec] (Gramps) {gramps}
[end]

[submenu] (fluxbox menu)
[config] (Configure)
[submenu] (Styles) {Choose a Style…}
[stylesdir] (/usr/X11R6/share/fluxbox/styles)
[end]
[workspaces] (Workspace List)
[submenu] (Tools)
[exec] (Window name) {xprop WM_CLASS|cut -d \” -f 2|xmessage -file - -center}
[end]
[commanddialog] (Fluxbox Command)
[reconfig] (Reload config)
[restart] (Restart Fluxbox)
[exec] (About) {fluxbox -v 2>/dev/null | head -n1 | xmessage -file - -center}
[exit] (Exit Fluxbox)
[separator]
[exec] (Reboot) {shutdown -r now}
[exec] (Shutdown) {shutdown -p now}
[end]
[end]
菜单开头型式如下,
[begin] (Fluxbox)

[end]
其余都包含在里面,如果你熟悉html的话,它很象<html></html>标签。
如果你想在主菜单中列出程序的话,使用如下型式的代码:
[exec] (xterm) {xterm}
其中 (xterm) 是显示在菜单中的文字,{xterm} 是启动程序的命令。
如果要添加分隔符,使用
[separator]
大多数情况下你会用到子菜单,使用
[submenu] (name you come up with)

[end]
在里面你可以使用 [exec]来列出应用程序,也可以嵌套子菜单。
下面是fluxbox菜单实例。
这不是新建的,你可以往里面添加你要的东西。
我的菜单文件如下:
[begin] (Fluxbox)
[exec] (Xterm) {xterm}
[separator]
[submenu] (Tools)
[exec] (File Roller) {file-roller}
[exec] (Mirage Image Viewer) {mirage}
[exec] (Synaptic) {gksu synaptic}
[end]
[submenu] (Internet)
[exec] (Firefox) {firefox}
[exec] (Emesene) {emesene}
[exec] (Transmission) {transmission}
[exec] (Xchat) {xchat}
[exec] (Frostwire) {frostwire}
[exec] (Nicotine Plus) {nicotine}
[end]
[submenu] (Editors)
[exec] (Mousepad) {mousepad}
[exec] (Abiword) {abiword}
[exec] (Gnumeric) {gnumeric}
[end]
[submenu] (Multimedia)
[exec] (VLC Media Player) {vlc}
[exec] (Sonata) {sonata}
[exec] (Brasero) {brasero}
[exec] (Audio Tag Tool) {tagtool}
[exec] (Avidemux) {avidemux}
[end]
[submenu] (Graphics)
[exec] (Gimp) {gimp}
[exec] (Xpdf) {xpdf}
[end]
[separator]
[submenu] (Fluxbox Menu)
[config] (Configure)
[submenu] (Styles) {Choose a Style…}
[stylesdir] (/usr/X11R6/share/fluxbox/styles)
[end]
[workspaces] (Workspace List)
[submenu] (Tools)
[exec] (Window name) {xprop WM_CLASS|cut -d \” -f 2|xmessage -file - -center}
[end]
[commanddialog] (Fluxbox Command)
[reconfig] (Reload config)
[restart] (Restart Fluxbox)
[exec] (About) {fluxbox -v 2>/dev/null | head -n1 | xmessage -file - -center}
[exit] (Exit Fluxbox)
[separator]
[exec] (Reboot) {shutdown -r now}
[exec] (Shutdown) {shutdown -p now}
[end]
[end]
它看起来既简朴又精致。(如第1张截屏中所示菜单)

8、设置自己的图标
编辑 /home/username/.gtkrc-2.0并添加行
gtk-icon-theme-name = “ALLBLACK”
ALLBLACK是目录/home/username/.icons/中的图标文件夹。(译注:gtk icon theme也可以从网站gnome-look.org下载)
你可以用你的icon主题名字替换ALLBLACK。
另外你也可以用同样的方式来设置gtk主题,而不用通过使用gtk-chtheme软件,
使用,
gtk-theme-name = “NovaBlue”
其中 NovaBlue 是/home/username/.themes/中的gtk主题文件夹名称。

9、选择键盘layout
你需要编辑 xorg.conf 文件,使用如下命令:

代码: 全选

sudo mousepad /etc/X11/xorg.conf
(假设你使用的是mousepad,如果不是就替换成你常用的编辑器)

在该文件的第一文本段,你可以看到:
Section “InputDevice”
Identifier “Generic Keyboard”
Driver “kbd”
Option “XkbRules” “xorg”
Option “XkbModel” “pc105″
Option “XkbLayout” “be”
你需要修改最后一行来设定你的键盘 layout.
我的是 “be” (azerty),你要根据实际情况修改。(译注:譬如我的是"us",其实一般情况下这个都已经设置好了)

你也可以设置多个。
如:
Option “XkbLayout” “be,us”
然后你可以使用命令在它们之间切换,

代码: 全选

setxkbmap be

代码: 全选

setxkbmap us
第一个命令设置你的键盘layout为azerty(be),第二个设置成qwerty(us)。
现在,你可以把这些命令添加到你的菜单中去,

代码: 全选

sudo mousepad /home/username/.fluxbox/menu
使用如下行来添加:
[exec] (azerty) {setxkbmap be}
[exec] (qwerty) {setxkbmap us}
但是最好添加一个子菜单来实现键盘layout更改。
[submenu] (Layouts)
[exec] (azerty) {setxkbmap be}
[exec] (qwerty) {setxkbmap en}
[end]
在桌面右键单击,你会发现 Layouts 菜单项已经在那了,其中包括子项 "azerty"和"qwerty"。

---
希望本文对你有所帮助。
-----
附件
gtk-chtheme.png
screen123465.png
截图1
截图1
newx
帖子: 146
注册时间: 2006-02-28 19:05

Re: [转帖]fluxbox 初学者指南

#2

帖子 newx » 2008-11-23 15:32

:em02 好复杂 :em03
头像
yilan198711
帖子: 1635
注册时间: 2008-06-22 13:38
来自: 武汉

Re: [转帖]fluxbox 初学者指南

#3

帖子 yilan198711 » 2009-02-21 22:46

不知道字体如何设置??
mint+gnome
dongfanglu
帖子: 523
注册时间: 2007-12-13 23:34

Re: [转帖]fluxbox 初学者指南

#4

帖子 dongfanglu » 2009-02-26 21:00

跟bblean似的
回复