https://wiki.archlinux.org/api.php?action=feedcontributions&user=Yagnb&feedformat=atomArchWiki - User contributions [en]2024-03-29T08:37:55ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Awesome_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=280083Awesome (简体中文)2013-10-28T05:07:15Z<p>Yagnb: /* ImageMagick */</p>
<hr />
<div>[[Category:Dynamic WMs (简体中文)]]<br />
[[cs:Awesome]]<br />
[[en:Awesome]]<br />
[[es:Awesome]]<br />
[[fr:Awesome3]]<br />
[[it:Awesome]]<br />
[[ja:Awesome]]<br />
[[ru:Awesome]]<br />
{{Lowercase title}}<br />
{{translateme (简体中文)}}<br />
{{TranslationStatus (简体中文)|Awesome|2012-11-25|236478}}<br />
{{Article summary start|摘要}}<br />
{{Article summary text|关于安装、使用、配置和自定义 awesome 窗口管理器的指南。}}<br />
{{Article summary end}}<br />
<br />
来自[[Wikipedia:awesome (window manager)|awesome]]网站:<br />
<br />
''[http://awesome.naquadah.org/ Awesome] 是 XWindows 下可高度定制的新一代窗口管理器。运行快捷、扩展性强,遵循GPLv2发布。''<br />
<br />
''Awesome主要面向高级用户、开发者和那些希望完美控制自己电脑的图形界面的人。''<br />
<br />
==安装==<br />
<br />
[[pacman (简体中文)|安装]]位于[[Official Repositories (简体中文)|官方软件仓库]]的软件包 {{Pkg|awesome}}。<br />
<br />
如果你对不稳定的预览版本有兴趣,可以从 [[AUR]] 安装 {{aur|awesome-git}}。但是请注意,这是一个不稳定的开发版,配置文件会有语法差异。<br />
<br />
==使用Awesome==<br />
<br />
===不使用登陆管理器===<br />
<br />
不使用登录管理器来运行 awesome,只要添加 '''{{Ic|exec awesome}}'''到你的启动脚本(比如 ~/.xinitrc)。 详情参阅[[xinitrc]]<br />
<br />
你也可以甚至不用登陆直接使用预置用户启动Awesome,请参考[[Start X at Login]]<br />
<br />
=== 使用登陆管理器 ===<br />
要想用登陆管理器启动awesome,看[[Display Manager (简体中文)|这里]].<br />
<br />
==配置==<br />
Awesome默认的配置已经很不错了,不过你迟早会想要做一些修改的。配置文件是一个lua脚本:{{ic|~/.config/awesome/rc.lua}}.<br />
<br />
===创建配置文件===<br />
创建配置文件所在的文件夹<br />
$ mkdir -p ~/.config/awesome/<br />
<br />
Awesome会自动使用~/.config/awesome/rc.lua里的所有配置。这个文件并不会自动创建,所以我们先要从模板复制一个过来:<br />
$ cp /etc/xdg/awesome/rc.lua ~/.config/awesome<br />
<br />
配置文件的语法会随着Awesome的版本升级而变化,所以当你升级了之后遇到问题时,重复上面的步骤,或者你得手动修改配置文件。<br />
<br />
要获得关于配置Awesome的更多信息,请看[http://awesome.naquadah.org/wiki/Awesome_3_configuration Awesome wiki的配置部分]<br />
<br />
===更多的配置资源===<br />
{{注意|Awesome配置文件语法有时会变化,所以你可能得动手修改下载的配置文件。}}<br />
<br />
一些不错的rc.lua的例子可以在下面这些站点找到:<br />
<br />
* http://git.sysphere.org/awesome-configs/tree/ - Adrian C 的 Awesome 3.4 配置文件。 (anrxc)<br />
* http://pastebin.com/f6e4b064e - Darthlukan 的 Awesome 3.4 配置文件. <br />
* http://www.calmar.ws/dotfiles/dotfiledir/dot_awesomerc.lua<br />
* http://github.com/wolgri/wolgri.config/tree/master/.config/awesome/rc.lua<br />
* http://oxmoz.no-ip.org/awesome/rc.lua<br />
* http://www.ugolnik.info/downloads/awesome/rc.lua (screen) - 带有小型标题栏和状态栏的Awesome3配置文件。<br />
* http://github.com/bash/dotfiles/blob/master/.config/awesome/rc.lua<br />
* http://github.com/nblock/config/blob/master/.config/awesome/rc.lua<br />
* User Configuration Files http://awesome.naquadah.org/wiki/User_Configuration_Files<br />
<br />
===用 Xephyr 测试 rc.lua===<br />
<br />
用这种方式可以在不破坏现有桌面的情况下对rc.lua进行测试。首先把 rc.lua 复制到一个新文件rc.lua.new,接着进行修改。然后在Xephyr中运行新的rc.lua (Xephyr允许你在XWindow中植入一个新的XWindow - [http://www.dante4d.cz/pub/screenie/2009-08-01-025216_1920x1200_scrot.png screenshot])。 你可以这样测试你的新rc.lua<br />
<br />
$ Xephyr -ac -br -noreset -screen 1152x720 :1 &<br />
$ DISPLAY=:1.0 awesome -c ~/.config/awesome/rc.lua.new<br />
<br />
这种方式的巨大优势在于如果你弄坏了rc.lua.new,你不至于把现有的Awesome桌面弄得一团糟(并且很可能还会把XWindow弄崩溃了,没保存的工作全部丢失………)。一旦你觉得新的配置文件不错,就用rc.lua.new代替rc.lua,然后重启Awesome。<br />
<br />
目前(2011.07),还有一个工具{{aur|awmtt}}可以提供上述功能。<br />
<br />
==主题==<br />
<br />
[http://awesome.naquadah.org/wiki/Beautiful Beautiful]可以让你动态地改变背景图片和颜色主题,而不需要改变rc.lua文件。<br />
<br />
默认的主题文件是 /usr/share/awesome/themes/default。把它复制到 ~/.config/awesome/themes/default 然后修改一下 rc.lua中的theme_path。 <br />
beautiful.init(awful.util.getdir("config") .. "/themes/default/theme.lua")<br />
<br />
更多细节参考[http://awesome.naquadah.org/wiki/Beautiful 这里]<br />
<br />
一些样例:[http://awesome.naquadah.org/wiki/Beautiful_themes themes]<br />
<br />
===设置墙纸===<br />
<br />
Beautiful 可以设置墙纸,所以你就不用在.xinitrc 或者 .xsession 中自己设置了。Beautiful 允许你给每个主题配一个墙纸。如果你看一看默认的主题文件,可以找到一个 wallpaper_cmd 值。当beautiful.init("path_to_theme_file")运行的时候,给定的命令就会运行。如果不想要 Beautiful 修改你的墙纸,你可以在这里自己定义一个命令,或者把这个值注释掉。<br />
<br />
例如,如果你想用 awsetbg 设置墙纸,你可以这样写:<br />
<br />
theme.wallpaper_cmd = { "awsetbg -f .config/awesome/themes/awesome-wallpaper.png" }<br />
<br />
{{注意|要让Awsetbg工作,你需要有一个能设置背景图片的软件,比如"[[Feh]]"。}}<br />
<br />
====随机墙纸====<br />
想要随机切换墙纸,只需要注释掉 wallpaper_cmd 一行,然后使用下面的代码添加脚本到到你的 .xinitrc 文件中:<br />
{{bc|<br />
while true;<br />
do<br />
awsetbg -r <path/to/the/directory/of/your/wallpapers><br />
sleep 15m<br />
done &<br />
}}<br />
<br />
==小技巧==<br />
如果你有自己的小技巧想与大家分享,请随意添加。<br />
<br />
===使用awesome作为GNOME的窗口管理器===<br />
GNOME有“开包即用”的优势,你可以在使用GNOME的同时改用awesome作为窗口管理器。如果你在用GNOME 3的话,你可以安装{{AUR|awesome-gnome}}包,然后在用GDM登陆的时候选择"Awesome GNOME"。更多详细内容请参考[http://awesome.naquadah.org/wiki/Quickly_Setting_up_Awesome_with_Gnome awesome wiki]。<br />
<br />
===像compiz那样的平铺桌面效果===<br />
<br />
Revelation可以显示所有你开启的客户端;左键点击客户端会跳到该客户端所在的第一个标签并聚焦于该客户端。按下回车键会跳到当前聚焦的客户端,按下ESc键退出。更多内容请参考[http://awesome.naquadah.org/wiki/Revelation]。<br />
<br />
===在awesome 3中显示/隐藏wibox===<br />
<br />
要使用Modkey-b来在当前屏幕上隐藏/显示默认的状态栏 (Awesome 2.3中的默认行为),把下面代码加入rc.lua里的globalkeys变量:<br />
<br />
awful.key({ modkey }, "b", function ()<br />
mywibox[mouse.screen].visible = not mywibox[mouse.screen].visible<br />
end),<br />
<br />
===截图===<br />
<br />
在awesome中想要通过PrtScn按键来截图就必须借助其他截图工具. Arch软件仓库中,Scrot是个很简单就可以实现这些功能的截图工具.<br />
<br />
只需要输入:<br />
# pacman -S scrot<br />
<br />
如果optional dependencies中可选的包觉得有用,也可以安装.<br />
<br />
下一步,就是需要获得PrtScr按键的按键名, 如果不确定是什么,一般就是 "Print"了.<br />
<br />
终端里面输入命令:<br />
# xev<br />
<br />
然后按键盘上的PrtScr按键, 将会输出类似下面的结果:<br />
KeyPress event ....<br />
root 0x25c, subw 0x0, ...<br />
state 0x0, keycode 107 (keysym 0xff61, '''Print'''), same_screen YES,<br />
....<br />
<br />
我们判断没错,键名就是 "Print".<br />
<br />
接下来继续配置awesome!<br />
<br />
在配置文件中的全局数组(任意地方)中输入并保存:<br />
<br />
Lua 代码:<br />
<br />
awful.key({ }, "Print", function () awful.util.spawn("scrot -e 'mv $f ~/screenshots/ 2>/dev/null'") end),<br />
<br />
这里的 ~/screenshots/ 可以改成你截图想要保存的地方.<br />
<br />
===动态标签===<br />
<br />
[http://awesome.naquadah.org/wiki/Eminent Eminent]是一个小型的lua库,扩展了awful并提供了简单快速的wmii一样的动态标签功能。跟shifty不同, eminent无意提供全面详尽的标签系统,而是试图让动态标签越简单越好。实际上除了导入eminent库,你不用在rc.lua里改任何东西,eminent会把所有的事情帮你搞定。<br />
<br />
[http://awesome.naquadah.org/wiki/Shifty Shifty]是实现了动态标签的一个Awesome 3的扩展。它也实现了一个配置系统来让你设置几个变量和键位绑定就完全掌控你的桌面!<br />
<br />
===Space Invaders===<br />
[http://awesome.naquadah.org/wiki/Space_Invaders Space Invaders]是一个用来展现Awesome Lua API无限能力的演示。<br />
<br />
请注意它从3.4-rc1版以后就没有被包括进Awesome包里了。<br />
<br />
===Naughty弹窗提醒===<br />
请查看[http://awesome.naquadah.org/wiki/Naughty Awesome维基上的naughty页面].<br />
<br />
===弹出菜单项===<br />
这是一份 awesome3 的默认简单菜单项, 看起来要自定义也十分容易. 然而,如果你在用awesome的 2.x 版本, 那么请看''[http://awesome.naquadah.org/wiki/Awful.menu awful.menu]''.<br />
<br />
如果你想要配置 freedesktop.org 的菜单项,就到 ''[https://github.com/terceiro/awesome-freedesktop awesome-freedesktop]'' .<br />
<br />
一个 awesome3 的菜单配置示例:<br />
{{bc|1=<br />
myawesomemenu = {<br />
{ "lock", "xscreensaver-command -activate" },<br />
{ "manual", terminal .. " -e man awesome" },<br />
{ "edit config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua" },<br />
{ "restart", awesome.restart },<br />
{ "quit", awesome.quit }<br />
}<br />
<br />
mycommons = {<br />
{ "pidgin", "pidgin" },<br />
{ "OpenOffice", "soffice-dev" },<br />
{ "Graphic", "gimp" }<br />
}<br />
<br />
mymainmenu = awful.menu.new({ items = { <br />
{ "terminal", terminal },<br />
{ "icecat", "icecat" },<br />
{ "Editor", "gvim" },<br />
{ "File Manager", "pcmanfm" },<br />
{ "VirtualBox", "VirtualBox" },<br />
{ "Common App", mycommons, beautiful.awesome_icon },<br />
{ "awesome", myawesomemenu, beautiful.awesome_icon }<br />
}<br />
})<br />
}}<br />
<br />
===Awesome的更多插件===<br />
''Awesome中的插件是一些你可以加入插件栏 (状态栏和标题栏) 的东西,它们提供了关于你的系统的各种信息,并让你很方便地直接在窗口管理器上就看到这些信息。这些插件很简易而且有很强的灵活性。'' -- 来自 [http://awesome.naquadah.org/wiki/Widgets_in_awesome Awesome Wiki: Widgets]。<br />
<br />
有一个被广泛使用的插件库叫'''Wicked''' (只与'''3.4版以前'''的Awesome兼容),它提供了更多插件,比如MPD插件,CPU使用情况,内存使用情况等。要更详细的了解参见 [http://awesome.naquadah.org/wiki/Wicked Wicked]。<br />
<br />
Awesome 3.4中用来代替Wicked的有'''[http://awesome.naquadah.org/wiki/Vicious Vicious]''','''[http://awesome.naquadah.org/wiki/Obvious Obvious]''' 和 '''[http://awesome.naquadah.org/wiki/Bashets Bashets]'''。如果你选择使用vicious,你也应该看看 [http://git.sysphere.org/vicious/tree/README vicious的文档]。<br />
<br />
===Transparency===<br />
Awesome has support for true transparency through xcompmgr. Note that you'll probably want the git version of xcompmgr, which is [https://aur.archlinux.org/packages.php?ID=16554 available in AUR]. <br />
<br />
Add this to your ~/.xinitrc:<br />
xcompmgr &<br />
See ''man xcompmgr'' or [[xcompmgr]] for more options.<br />
<br />
In awesome 3.4, window transparency can be set dynamically using signals. For example, your rc.lua could contain the following:<br />
<br />
client.add_signal("focus", function(c)<br />
c.border_color = beautiful.border_focus<br />
c.opacity = 1<br />
end)<br />
client.add_signal("unfocus", function(c)<br />
c.border_color = beautiful.border_normal<br />
c.opacity = 0.7<br />
end)<br />
'''If you got error messages about add_signal, using connect_signal insteaded.''' <br />
<br />
Note that if you are using conky, you must set it to create its own window instead of using the desktop. To do so, edit ~/.conkyrc to contain:<br />
<br />
own_window yes<br />
own_window_transparent yes<br />
own_window_type desktop<br />
<br />
Otherwise strange behavior may be observed, such as all windows becoming fully transparent. Note also that since conky will be creating a transparent window on your desktop, any actions defined in awesome's rc.lua for the desktop will not work where conky is.<br />
<br />
As of Awesome 3.1, there is built-in pseudo-transparency for wiboxes. To enable it, append 2 hexadecimal digits to the colors in your theme file (~/.config/awesome/themes/default, which is usually a copy of /usr/share/awesome/themes/default), like shown here:<br />
<br />
bg_normal = #000000AA<br />
<br />
where "AA" is the transparency value.<br />
<br />
To change transparency for the actual selected window by pressing Modkey + PageUp/PageDown you can also use tansset-df available through the community package repository and the following modification to your rc.lua:<br />
<br />
globalkeys = awful.util.table.join(<br />
-- your keybindings<br />
[...]<br />
awful.key({ modkey }, "Next", function (c)<br />
awful.util.spawn("transset-df --actual --inc 0.1")<br />
end),<br />
awful.key({ modkey }, "Prior", function (c)<br />
awful.util.spawn("transset-df --actual --dec 0.1")<br />
end),<br />
-- Your other key bindings<br />
[...]<br />
)<br />
<br />
==== ImageMagick ====<br />
如果你用ImageMagick的''display''命令来设置你的墙纸,可能会遇到xcompmgr效果不好的问题。请注意awsetbg可能会用''display''如果它没有其他选项。安装habak,feh,hsetroot或者其他的包应该会解决这个问题。<br />
(''grep -A 1 wpsetters /usr/bin/awsetbg'' 来看你有哪些选项)<br />
<br />
===自动运行程序===<br />
''参见 [https://awesome.naquadah.org/wiki/Autostart Awesome维基上的自动运行].''<br />
<br />
Awesome不会运行那些被Freedesktop如GNOME或KDE设置为自动运行的程序。不过Awesome提供了一些运行程序的函数 (除了Lua标准库里的函数 {{Ic|os.execute}})。要运行跟GNOME或KDE里一样自动运行的程序,你可以从 [[AUR]] 安装 {{AUR|dex-git}},然后在你的rc.lua里加入:<br />
<br />
os.execute"dex -a -e Awesome"<br />
<br />
如果你只想列出一些程序来在让Awesome启动时运行,你可以创建一个你需要启动命令的列表然后循环启动:<br />
<br />
do<br />
local cmds = <br />
{ <br />
"swiftfox",<br />
"mutt",<br />
"consonance",<br />
"linux-fetion",<br />
"weechat-curses",<br />
--and so on...<br />
}<br />
<br />
for _,i in pairs(cmds) do<br />
awful.util.spawn(i)<br />
end<br />
end<br />
<br />
(你也可以调用 {{Ic|os.execute}} 加上命令名,在结尾加上 '{{Ic|&}}',但最好还是调用 spawn 函数来运行)<br />
<br />
如要程序仅在当前没有运行情况下运行,你可以只在 {{Ic|pgrep}} 找不到跟它一样名字的进程的时候运行它。<br />
function run_once(prg)<br />
awful.util.spawn_with_shell("pgrep -u $USER -x " .. prg .. " || (" .. prg .. ")")<br />
end<br />
<br />
所以,举个例子,要在当前 {{Ic|parcellite}} 没有运行的情况下运行 {{Ic|parcellite}}:<br />
<br />
run_once("parcellite")<br />
<br />
===使用 awesome-client 给文本插件传递信息===<br />
<br />
只需要创建一个新的插件,就可以很容易的传递信息。<br />
{{bc|<nowiki><br />
mywidget = widget({ type = "textbox", name = "mywidget" })<br />
mywidget.text = "initial text"<br />
</nowiki>}}<br />
<br />
使用 awesome-client 从外部更新“initial text":<br />
<br />
{{bc|<nowiki> <br />
echo -e 'mywidget.text = "new text"' | awesome-client<br />
</nowiki>}}<br />
不要忘记把插件增加到 wibox.<br />
<br />
===使用其他任务栏===<br />
<br />
如果你喜欢 awesome 既轻量又强大的功能,但又不喜欢默认那个任务栏的外观, 你可以安装其他的.比如 xfce4-panel:<br />
{{bc|<br />
sudo pacman -S xfce4-panel<br />
}}<br />
<br />
当然,你可能有更好的选择.然后要把它添加到配置文件 rc.lua 的自动启动部分(该如何写请看wiki吧).你可以注释掉配置文件中给每个桌面创建 wiboxes 的那部分(开头是"mywibox[s] = awful.wibox({ position = "top", screen = s })"),因为已经不需要了. 检查配置文件没有错误之后就可以执行命令生效:<br />
{{bc|<br />
awesome -k rc.lua<br />
}}<br />
另外你还需要改变"modkey+R"的快捷键绑定, 比如用Xfrun4, bashrun等,来替代awesome自带的启动器. 请看这个[[Openbox_Themes_and_Apps#Application_launchers|Openbox]]文章中的启动器部分作为参考. 别忘了添加<br />
{{bc|<nowiki><br />
properties = { floating = true } },<br />
{ rule = { instance = "$yourapplicationlauncher" },<br />
</nowiki>}}<br />
到你 rc.lua 配置文件中<br />
<br />
===Fix Java (GUI appears gray only)===<br />
Guide taken from [https://bbs.archlinux.org/viewtopic.php?pid=450870].<br />
#Install {{Pkg|wmname}} from community<br />
#Run the following command or add it to your {{ic|.xinitrc}}: {{bc|wmname LG3D}}<br />
<br />
{{Note|<br />
If you use a non-reparenting window manager and Java 6, you should uncomment the corresponding line in {{Ic|/etc/profile.d/openjdk6.sh}}<br />
<br />
If you use a non-reparenting window manager and Java 7, you should uncomment the corresponding line in <br />
{{Ic|/etc/profile.d/jre.sh}} <br />
}}<br />
<br />
===Prevent Nautilus from displaying the desktop (Gnome3)===<br />
Run dconf-editor. Navigate to org->gnome->desktop->background and uncheck "draw-background" as well as "show-desktop-icons" for good measure. That's it!<br />
<br />
Another option is moving /usr/bin/nautilus to a new location and replacing it with a script that runs 'nautilus --no-desktop' passing any arguments it receives along.<br />
<br />
#!/bin/sh<br />
/usr/bin/nautilus-real --no-desktop $@<br />
<br />
===Transitioning away from Gnome3===<br />
Run 'gnome-session-properties' and remove programs that you won't be needing anymore (e.g Bluetooth Manager, Login Sounds, etc).<br />
<br />
If you'd like to get rid of GDM, make sure that your rc.conf DAEMONS list includes "dbus" (and "cupsd" if you have a printer). It's advisable to get a different login manager (like [https://wiki.archlinux.org/index.php/SLiM SLiM]), but you can do things manually if you wish. That entails setting up your [https://wiki.archlinux.org/index.php/Udev .xinitrc properly] and installing something like devmon ([https://aur.archlinux.org/packages.php?ID=45842 AUR]).<br />
<br />
If you wan't to keep a few convenient systray applets and your GTK theme, append this to your rc.lua;<br />
function start_daemon(dae)<br />
daeCheck = os.execute("ps -eF | grep -v grep | grep -w " .. dae)<br />
if (daeCheck ~= 0) then<br />
os.execute(dae .. " &")<br />
end<br />
end<br />
<br />
procs = {"gnome-settings-daemon", "nm-applet", "kupfer", "gnome-sound-applet", "gnome-power-manager"}<br />
for k = 1, #procs do<br />
start_daemon(procs[k])<br />
end<br />
<br />
===Prevent the mouse scroll wheel from changing tags===<br />
In your rc.lua, change the Mouse Bindings section to the following;<br />
-- {{{ Mouse bindings<br />
root.buttons(awful.util.table.join(<br />
awful.button({ }, 3, function () mymainmenu:toggle() end)))<br />
-- }}}<br />
<br />
==Troubleshooting==<br />
<br />
===LibreOffice===<br />
If you encounter UI problems with libreoffice install libreoffice-gnome.<br />
<br />
===Mod4 key===<br />
<br />
The Mod4 is by default the '''Win key'''. If it's not mapped by default, for some reason, you can check the keycode of your Mod4 key with<br />
<br />
$ xev<br />
<br />
It should be 115 for the left one. Then add this to your ~/.xinitrc<br />
<br />
xmodmap -e "keycode 115 = Super_L" -e "add mod4 = Super_L"<br />
exec awesome<br />
<br />
The problem in this case is that some xorg installations recognize keycode 115, but incorrectly as the 'Select' key. The above command explictly remaps keycode 115 to the correct 'Super_L' key.<br />
<br />
====Mod4 key vs. IBM ThinkPad users====<br />
<br />
IBM ThinkPads do not come equipped with a Window key (although Lenovo have changed this tradition on their ThinkPads). As of writing, the Alt key is not used in command combinations by the default rc.lua (refer to the Awesome wiki for a table of commands), which allows it be used as a replacement for the Super/Mod4/Win key. To do this, edit your rc.lua and replace:<br />
<br />
modkey = "Mod4"<br />
<br />
by:<br />
<br />
modkey = "Mod1"<br />
<br />
Note: Awesome does a have a few commands that make use of Mod4 plus a single letter. Changing Mod4 to Mod1/Alt could cause overlaps for some key combinations. The small amount of instances where this happens can be changed in the rc.lua file.<br />
<br />
If you do not like to change the awesome standards, you might like to remap a key. For instance the caps lock key is rather useless (for me) adding the following contents to ~/.Xmodmap <br />
<br />
clear lock <br />
add mod4 = Caps_Lock<br />
<br />
and [[Extra Keyboard Keys in Xorg#Step 2: Testing|(re)load]] the file.<br />
This will change the caps lock key into the mod4 key and works nicely with the standard awesome settings. In addition, if needed, it provides the mod4 key to other X-programs as well.<br />
<br />
Not confirmed, but if recent updates of xorg related packages break mentioned remapping the second line can be replaced by (tested on a DasKeyboard with no left Super key):<br />
<br />
keysym Caps_Lock = Super_L Caps_Lock<br />
<br />
===Eclipse: cannot resize/move main window===<br />
If you get stuck and cannot move or resize the main window (using mod4 + left/right mouse button) edit the workbench.xml and set fullscreen/maximized to false (if set) and reduce the width and height to numbers smaller than your single screen desktop area.<br />
{{Note|workbench.xml can be found in: <eclipse_workspace>/.metadata/.plugins/org.eclipse.ui.workbench/ and the line to edit is <window height&#61;"xx" maximized&#61;"true" width&#61;"xx" x&#61;"xx" y&#61;"xx">.}}<br />
<br />
===YouTube: fullscreen appears in background===<br />
[https://bbs.archlinux.org/viewtopic.php?pid=1085494#p1085494] If YouTube videos appear underneath your web browser when in fullscreen mode, add this to your rc.lua<br />
<br />
{ rule = { instance = "plugin-container" },<br />
properties = { floating = true } },<br />
<br />
With Chromium add<br />
<br />
{ rule = { instance = "exe" },<br />
properties = { floating = true } },<br />
<br />
===Starting console clients on specific tags===<br />
It does not work when the console application is invoked from a GTK terminal (e.g. LXTerminal). [[URxvt]] is known to work. <br />
<br />
===Redirecting console output to a file===<br />
Some GUI application are very verbose when launched from a terminal. As a consequence, when started from Awesome, they output everything to the TTY from where Awesome was started, which tend to get messy. To remove the garbage output, you have to redirect it. However, the {{ic|awful.util.spawn}} function does not handle pipes and redirections very well as stated in [http://awesome.naquadah.org/wiki/FAQ#How_to_execute_a_shell_command.3F the official FAQ].<br />
<br />
As example, let's redirect [[Luakit]] output to a temporary file:<br />
<br />
awful.key({ modkey, }, "w", function () awful.util.spawn_with_shell("luakit 2>>/tmp/luakit.log") end),<br />
<br />
==External Links==<br />
* http://awesome.naquadah.org/wiki/FAQ - FAQ<br />
* http://www.lua.org/pil/ - Programming in Lua (first edition)<br />
* http://awesome.naquadah.org/ - The official awesome website<br />
* http://awesome.naquadah.org/wiki/Main_Page - the awesome wiki<br />
* http://www.penguinsightings.org/desktop/awesome/ - A review<br />
* http://compsoc.tardis.ed.ac.uk/wiki/AwesomeWM_guide - Awesome guide<br />
* https://bbs.archlinux.org/viewtopic.php?id=88926 - share your awesome!</div>Yagnbhttps://wiki.archlinux.org/index.php?title=Awesome_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=280082Awesome (简体中文)2013-10-28T05:01:22Z<p>Yagnb: /* 自动运行程序 */</p>
<hr />
<div>[[Category:Dynamic WMs (简体中文)]]<br />
[[cs:Awesome]]<br />
[[en:Awesome]]<br />
[[es:Awesome]]<br />
[[fr:Awesome3]]<br />
[[it:Awesome]]<br />
[[ja:Awesome]]<br />
[[ru:Awesome]]<br />
{{Lowercase title}}<br />
{{translateme (简体中文)}}<br />
{{TranslationStatus (简体中文)|Awesome|2012-11-25|236478}}<br />
{{Article summary start|摘要}}<br />
{{Article summary text|关于安装、使用、配置和自定义 awesome 窗口管理器的指南。}}<br />
{{Article summary end}}<br />
<br />
来自[[Wikipedia:awesome (window manager)|awesome]]网站:<br />
<br />
''[http://awesome.naquadah.org/ Awesome] 是 XWindows 下可高度定制的新一代窗口管理器。运行快捷、扩展性强,遵循GPLv2发布。''<br />
<br />
''Awesome主要面向高级用户、开发者和那些希望完美控制自己电脑的图形界面的人。''<br />
<br />
==安装==<br />
<br />
[[pacman (简体中文)|安装]]位于[[Official Repositories (简体中文)|官方软件仓库]]的软件包 {{Pkg|awesome}}。<br />
<br />
如果你对不稳定的预览版本有兴趣,可以从 [[AUR]] 安装 {{aur|awesome-git}}。但是请注意,这是一个不稳定的开发版,配置文件会有语法差异。<br />
<br />
==使用Awesome==<br />
<br />
===不使用登陆管理器===<br />
<br />
不使用登录管理器来运行 awesome,只要添加 '''{{Ic|exec awesome}}'''到你的启动脚本(比如 ~/.xinitrc)。 详情参阅[[xinitrc]]<br />
<br />
你也可以甚至不用登陆直接使用预置用户启动Awesome,请参考[[Start X at Login]]<br />
<br />
=== 使用登陆管理器 ===<br />
要想用登陆管理器启动awesome,看[[Display Manager (简体中文)|这里]].<br />
<br />
==配置==<br />
Awesome默认的配置已经很不错了,不过你迟早会想要做一些修改的。配置文件是一个lua脚本:{{ic|~/.config/awesome/rc.lua}}.<br />
<br />
===创建配置文件===<br />
创建配置文件所在的文件夹<br />
$ mkdir -p ~/.config/awesome/<br />
<br />
Awesome会自动使用~/.config/awesome/rc.lua里的所有配置。这个文件并不会自动创建,所以我们先要从模板复制一个过来:<br />
$ cp /etc/xdg/awesome/rc.lua ~/.config/awesome<br />
<br />
配置文件的语法会随着Awesome的版本升级而变化,所以当你升级了之后遇到问题时,重复上面的步骤,或者你得手动修改配置文件。<br />
<br />
要获得关于配置Awesome的更多信息,请看[http://awesome.naquadah.org/wiki/Awesome_3_configuration Awesome wiki的配置部分]<br />
<br />
===更多的配置资源===<br />
{{注意|Awesome配置文件语法有时会变化,所以你可能得动手修改下载的配置文件。}}<br />
<br />
一些不错的rc.lua的例子可以在下面这些站点找到:<br />
<br />
* http://git.sysphere.org/awesome-configs/tree/ - Adrian C 的 Awesome 3.4 配置文件。 (anrxc)<br />
* http://pastebin.com/f6e4b064e - Darthlukan 的 Awesome 3.4 配置文件. <br />
* http://www.calmar.ws/dotfiles/dotfiledir/dot_awesomerc.lua<br />
* http://github.com/wolgri/wolgri.config/tree/master/.config/awesome/rc.lua<br />
* http://oxmoz.no-ip.org/awesome/rc.lua<br />
* http://www.ugolnik.info/downloads/awesome/rc.lua (screen) - 带有小型标题栏和状态栏的Awesome3配置文件。<br />
* http://github.com/bash/dotfiles/blob/master/.config/awesome/rc.lua<br />
* http://github.com/nblock/config/blob/master/.config/awesome/rc.lua<br />
* User Configuration Files http://awesome.naquadah.org/wiki/User_Configuration_Files<br />
<br />
===用 Xephyr 测试 rc.lua===<br />
<br />
用这种方式可以在不破坏现有桌面的情况下对rc.lua进行测试。首先把 rc.lua 复制到一个新文件rc.lua.new,接着进行修改。然后在Xephyr中运行新的rc.lua (Xephyr允许你在XWindow中植入一个新的XWindow - [http://www.dante4d.cz/pub/screenie/2009-08-01-025216_1920x1200_scrot.png screenshot])。 你可以这样测试你的新rc.lua<br />
<br />
$ Xephyr -ac -br -noreset -screen 1152x720 :1 &<br />
$ DISPLAY=:1.0 awesome -c ~/.config/awesome/rc.lua.new<br />
<br />
这种方式的巨大优势在于如果你弄坏了rc.lua.new,你不至于把现有的Awesome桌面弄得一团糟(并且很可能还会把XWindow弄崩溃了,没保存的工作全部丢失………)。一旦你觉得新的配置文件不错,就用rc.lua.new代替rc.lua,然后重启Awesome。<br />
<br />
目前(2011.07),还有一个工具{{aur|awmtt}}可以提供上述功能。<br />
<br />
==主题==<br />
<br />
[http://awesome.naquadah.org/wiki/Beautiful Beautiful]可以让你动态地改变背景图片和颜色主题,而不需要改变rc.lua文件。<br />
<br />
默认的主题文件是 /usr/share/awesome/themes/default。把它复制到 ~/.config/awesome/themes/default 然后修改一下 rc.lua中的theme_path。 <br />
beautiful.init(awful.util.getdir("config") .. "/themes/default/theme.lua")<br />
<br />
更多细节参考[http://awesome.naquadah.org/wiki/Beautiful 这里]<br />
<br />
一些样例:[http://awesome.naquadah.org/wiki/Beautiful_themes themes]<br />
<br />
===设置墙纸===<br />
<br />
Beautiful 可以设置墙纸,所以你就不用在.xinitrc 或者 .xsession 中自己设置了。Beautiful 允许你给每个主题配一个墙纸。如果你看一看默认的主题文件,可以找到一个 wallpaper_cmd 值。当beautiful.init("path_to_theme_file")运行的时候,给定的命令就会运行。如果不想要 Beautiful 修改你的墙纸,你可以在这里自己定义一个命令,或者把这个值注释掉。<br />
<br />
例如,如果你想用 awsetbg 设置墙纸,你可以这样写:<br />
<br />
theme.wallpaper_cmd = { "awsetbg -f .config/awesome/themes/awesome-wallpaper.png" }<br />
<br />
{{注意|要让Awsetbg工作,你需要有一个能设置背景图片的软件,比如"[[Feh]]"。}}<br />
<br />
====随机墙纸====<br />
想要随机切换墙纸,只需要注释掉 wallpaper_cmd 一行,然后使用下面的代码添加脚本到到你的 .xinitrc 文件中:<br />
{{bc|<br />
while true;<br />
do<br />
awsetbg -r <path/to/the/directory/of/your/wallpapers><br />
sleep 15m<br />
done &<br />
}}<br />
<br />
==小技巧==<br />
如果你有自己的小技巧想与大家分享,请随意添加。<br />
<br />
===使用awesome作为GNOME的窗口管理器===<br />
GNOME有“开包即用”的优势,你可以在使用GNOME的同时改用awesome作为窗口管理器。如果你在用GNOME 3的话,你可以安装{{AUR|awesome-gnome}}包,然后在用GDM登陆的时候选择"Awesome GNOME"。更多详细内容请参考[http://awesome.naquadah.org/wiki/Quickly_Setting_up_Awesome_with_Gnome awesome wiki]。<br />
<br />
===像compiz那样的平铺桌面效果===<br />
<br />
Revelation可以显示所有你开启的客户端;左键点击客户端会跳到该客户端所在的第一个标签并聚焦于该客户端。按下回车键会跳到当前聚焦的客户端,按下ESc键退出。更多内容请参考[http://awesome.naquadah.org/wiki/Revelation]。<br />
<br />
===在awesome 3中显示/隐藏wibox===<br />
<br />
要使用Modkey-b来在当前屏幕上隐藏/显示默认的状态栏 (Awesome 2.3中的默认行为),把下面代码加入rc.lua里的globalkeys变量:<br />
<br />
awful.key({ modkey }, "b", function ()<br />
mywibox[mouse.screen].visible = not mywibox[mouse.screen].visible<br />
end),<br />
<br />
===截图===<br />
<br />
在awesome中想要通过PrtScn按键来截图就必须借助其他截图工具. Arch软件仓库中,Scrot是个很简单就可以实现这些功能的截图工具.<br />
<br />
只需要输入:<br />
# pacman -S scrot<br />
<br />
如果optional dependencies中可选的包觉得有用,也可以安装.<br />
<br />
下一步,就是需要获得PrtScr按键的按键名, 如果不确定是什么,一般就是 "Print"了.<br />
<br />
终端里面输入命令:<br />
# xev<br />
<br />
然后按键盘上的PrtScr按键, 将会输出类似下面的结果:<br />
KeyPress event ....<br />
root 0x25c, subw 0x0, ...<br />
state 0x0, keycode 107 (keysym 0xff61, '''Print'''), same_screen YES,<br />
....<br />
<br />
我们判断没错,键名就是 "Print".<br />
<br />
接下来继续配置awesome!<br />
<br />
在配置文件中的全局数组(任意地方)中输入并保存:<br />
<br />
Lua 代码:<br />
<br />
awful.key({ }, "Print", function () awful.util.spawn("scrot -e 'mv $f ~/screenshots/ 2>/dev/null'") end),<br />
<br />
这里的 ~/screenshots/ 可以改成你截图想要保存的地方.<br />
<br />
===动态标签===<br />
<br />
[http://awesome.naquadah.org/wiki/Eminent Eminent]是一个小型的lua库,扩展了awful并提供了简单快速的wmii一样的动态标签功能。跟shifty不同, eminent无意提供全面详尽的标签系统,而是试图让动态标签越简单越好。实际上除了导入eminent库,你不用在rc.lua里改任何东西,eminent会把所有的事情帮你搞定。<br />
<br />
[http://awesome.naquadah.org/wiki/Shifty Shifty]是实现了动态标签的一个Awesome 3的扩展。它也实现了一个配置系统来让你设置几个变量和键位绑定就完全掌控你的桌面!<br />
<br />
===Space Invaders===<br />
[http://awesome.naquadah.org/wiki/Space_Invaders Space Invaders]是一个用来展现Awesome Lua API无限能力的演示。<br />
<br />
请注意它从3.4-rc1版以后就没有被包括进Awesome包里了。<br />
<br />
===Naughty弹窗提醒===<br />
请查看[http://awesome.naquadah.org/wiki/Naughty Awesome维基上的naughty页面].<br />
<br />
===弹出菜单项===<br />
这是一份 awesome3 的默认简单菜单项, 看起来要自定义也十分容易. 然而,如果你在用awesome的 2.x 版本, 那么请看''[http://awesome.naquadah.org/wiki/Awful.menu awful.menu]''.<br />
<br />
如果你想要配置 freedesktop.org 的菜单项,就到 ''[https://github.com/terceiro/awesome-freedesktop awesome-freedesktop]'' .<br />
<br />
一个 awesome3 的菜单配置示例:<br />
{{bc|1=<br />
myawesomemenu = {<br />
{ "lock", "xscreensaver-command -activate" },<br />
{ "manual", terminal .. " -e man awesome" },<br />
{ "edit config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua" },<br />
{ "restart", awesome.restart },<br />
{ "quit", awesome.quit }<br />
}<br />
<br />
mycommons = {<br />
{ "pidgin", "pidgin" },<br />
{ "OpenOffice", "soffice-dev" },<br />
{ "Graphic", "gimp" }<br />
}<br />
<br />
mymainmenu = awful.menu.new({ items = { <br />
{ "terminal", terminal },<br />
{ "icecat", "icecat" },<br />
{ "Editor", "gvim" },<br />
{ "File Manager", "pcmanfm" },<br />
{ "VirtualBox", "VirtualBox" },<br />
{ "Common App", mycommons, beautiful.awesome_icon },<br />
{ "awesome", myawesomemenu, beautiful.awesome_icon }<br />
}<br />
})<br />
}}<br />
<br />
===Awesome的更多插件===<br />
''Awesome中的插件是一些你可以加入插件栏 (状态栏和标题栏) 的东西,它们提供了关于你的系统的各种信息,并让你很方便地直接在窗口管理器上就看到这些信息。这些插件很简易而且有很强的灵活性。'' -- 来自 [http://awesome.naquadah.org/wiki/Widgets_in_awesome Awesome Wiki: Widgets]。<br />
<br />
有一个被广泛使用的插件库叫'''Wicked''' (只与'''3.4版以前'''的Awesome兼容),它提供了更多插件,比如MPD插件,CPU使用情况,内存使用情况等。要更详细的了解参见 [http://awesome.naquadah.org/wiki/Wicked Wicked]。<br />
<br />
Awesome 3.4中用来代替Wicked的有'''[http://awesome.naquadah.org/wiki/Vicious Vicious]''','''[http://awesome.naquadah.org/wiki/Obvious Obvious]''' 和 '''[http://awesome.naquadah.org/wiki/Bashets Bashets]'''。如果你选择使用vicious,你也应该看看 [http://git.sysphere.org/vicious/tree/README vicious的文档]。<br />
<br />
===Transparency===<br />
Awesome has support for true transparency through xcompmgr. Note that you'll probably want the git version of xcompmgr, which is [https://aur.archlinux.org/packages.php?ID=16554 available in AUR]. <br />
<br />
Add this to your ~/.xinitrc:<br />
xcompmgr &<br />
See ''man xcompmgr'' or [[xcompmgr]] for more options.<br />
<br />
In awesome 3.4, window transparency can be set dynamically using signals. For example, your rc.lua could contain the following:<br />
<br />
client.add_signal("focus", function(c)<br />
c.border_color = beautiful.border_focus<br />
c.opacity = 1<br />
end)<br />
client.add_signal("unfocus", function(c)<br />
c.border_color = beautiful.border_normal<br />
c.opacity = 0.7<br />
end)<br />
'''If you got error messages about add_signal, using connect_signal insteaded.''' <br />
<br />
Note that if you are using conky, you must set it to create its own window instead of using the desktop. To do so, edit ~/.conkyrc to contain:<br />
<br />
own_window yes<br />
own_window_transparent yes<br />
own_window_type desktop<br />
<br />
Otherwise strange behavior may be observed, such as all windows becoming fully transparent. Note also that since conky will be creating a transparent window on your desktop, any actions defined in awesome's rc.lua for the desktop will not work where conky is.<br />
<br />
As of Awesome 3.1, there is built-in pseudo-transparency for wiboxes. To enable it, append 2 hexadecimal digits to the colors in your theme file (~/.config/awesome/themes/default, which is usually a copy of /usr/share/awesome/themes/default), like shown here:<br />
<br />
bg_normal = #000000AA<br />
<br />
where "AA" is the transparency value.<br />
<br />
To change transparency for the actual selected window by pressing Modkey + PageUp/PageDown you can also use tansset-df available through the community package repository and the following modification to your rc.lua:<br />
<br />
globalkeys = awful.util.table.join(<br />
-- your keybindings<br />
[...]<br />
awful.key({ modkey }, "Next", function (c)<br />
awful.util.spawn("transset-df --actual --inc 0.1")<br />
end),<br />
awful.key({ modkey }, "Prior", function (c)<br />
awful.util.spawn("transset-df --actual --dec 0.1")<br />
end),<br />
-- Your other key bindings<br />
[...]<br />
)<br />
<br />
==== ImageMagick ====<br />
You may have problems if you set your wallpaper with imagemagick's ''display'' command, it doesn't work well with xcompmgr. Please note that awsetbg may be using ''display'' if it doesn't have any other options. Installing habak, feh, hsetroot or whatever should fix the problem (''grep -A 1 wpsetters /usr/bin/awsetbg'' to see your options).<br />
<br />
===自动运行程序===<br />
''参见 [https://awesome.naquadah.org/wiki/Autostart Awesome维基上的自动运行].''<br />
<br />
Awesome不会运行那些被Freedesktop如GNOME或KDE设置为自动运行的程序。不过Awesome提供了一些运行程序的函数 (除了Lua标准库里的函数 {{Ic|os.execute}})。要运行跟GNOME或KDE里一样自动运行的程序,你可以从 [[AUR]] 安装 {{AUR|dex-git}},然后在你的rc.lua里加入:<br />
<br />
os.execute"dex -a -e Awesome"<br />
<br />
如果你只想列出一些程序来在让Awesome启动时运行,你可以创建一个你需要启动命令的列表然后循环启动:<br />
<br />
do<br />
local cmds = <br />
{ <br />
"swiftfox",<br />
"mutt",<br />
"consonance",<br />
"linux-fetion",<br />
"weechat-curses",<br />
--and so on...<br />
}<br />
<br />
for _,i in pairs(cmds) do<br />
awful.util.spawn(i)<br />
end<br />
end<br />
<br />
(你也可以调用 {{Ic|os.execute}} 加上命令名,在结尾加上 '{{Ic|&}}',但最好还是调用 spawn 函数来运行)<br />
<br />
如要程序仅在当前没有运行情况下运行,你可以只在 {{Ic|pgrep}} 找不到跟它一样名字的进程的时候运行它。<br />
function run_once(prg)<br />
awful.util.spawn_with_shell("pgrep -u $USER -x " .. prg .. " || (" .. prg .. ")")<br />
end<br />
<br />
所以,举个例子,要在当前 {{Ic|parcellite}} 没有运行的情况下运行 {{Ic|parcellite}}:<br />
<br />
run_once("parcellite")<br />
<br />
===使用 awesome-client 给文本插件传递信息===<br />
<br />
只需要创建一个新的插件,就可以很容易的传递信息。<br />
{{bc|<nowiki><br />
mywidget = widget({ type = "textbox", name = "mywidget" })<br />
mywidget.text = "initial text"<br />
</nowiki>}}<br />
<br />
使用 awesome-client 从外部更新“initial text":<br />
<br />
{{bc|<nowiki> <br />
echo -e 'mywidget.text = "new text"' | awesome-client<br />
</nowiki>}}<br />
不要忘记把插件增加到 wibox.<br />
<br />
===使用其他任务栏===<br />
<br />
如果你喜欢 awesome 既轻量又强大的功能,但又不喜欢默认那个任务栏的外观, 你可以安装其他的.比如 xfce4-panel:<br />
{{bc|<br />
sudo pacman -S xfce4-panel<br />
}}<br />
<br />
当然,你可能有更好的选择.然后要把它添加到配置文件 rc.lua 的自动启动部分(该如何写请看wiki吧).你可以注释掉配置文件中给每个桌面创建 wiboxes 的那部分(开头是"mywibox[s] = awful.wibox({ position = "top", screen = s })"),因为已经不需要了. 检查配置文件没有错误之后就可以执行命令生效:<br />
{{bc|<br />
awesome -k rc.lua<br />
}}<br />
另外你还需要改变"modkey+R"的快捷键绑定, 比如用Xfrun4, bashrun等,来替代awesome自带的启动器. 请看这个[[Openbox_Themes_and_Apps#Application_launchers|Openbox]]文章中的启动器部分作为参考. 别忘了添加<br />
{{bc|<nowiki><br />
properties = { floating = true } },<br />
{ rule = { instance = "$yourapplicationlauncher" },<br />
</nowiki>}}<br />
到你 rc.lua 配置文件中<br />
<br />
===Fix Java (GUI appears gray only)===<br />
Guide taken from [https://bbs.archlinux.org/viewtopic.php?pid=450870].<br />
#Install {{Pkg|wmname}} from community<br />
#Run the following command or add it to your {{ic|.xinitrc}}: {{bc|wmname LG3D}}<br />
<br />
{{Note|<br />
If you use a non-reparenting window manager and Java 6, you should uncomment the corresponding line in {{Ic|/etc/profile.d/openjdk6.sh}}<br />
<br />
If you use a non-reparenting window manager and Java 7, you should uncomment the corresponding line in <br />
{{Ic|/etc/profile.d/jre.sh}} <br />
}}<br />
<br />
===Prevent Nautilus from displaying the desktop (Gnome3)===<br />
Run dconf-editor. Navigate to org->gnome->desktop->background and uncheck "draw-background" as well as "show-desktop-icons" for good measure. That's it!<br />
<br />
Another option is moving /usr/bin/nautilus to a new location and replacing it with a script that runs 'nautilus --no-desktop' passing any arguments it receives along.<br />
<br />
#!/bin/sh<br />
/usr/bin/nautilus-real --no-desktop $@<br />
<br />
===Transitioning away from Gnome3===<br />
Run 'gnome-session-properties' and remove programs that you won't be needing anymore (e.g Bluetooth Manager, Login Sounds, etc).<br />
<br />
If you'd like to get rid of GDM, make sure that your rc.conf DAEMONS list includes "dbus" (and "cupsd" if you have a printer). It's advisable to get a different login manager (like [https://wiki.archlinux.org/index.php/SLiM SLiM]), but you can do things manually if you wish. That entails setting up your [https://wiki.archlinux.org/index.php/Udev .xinitrc properly] and installing something like devmon ([https://aur.archlinux.org/packages.php?ID=45842 AUR]).<br />
<br />
If you wan't to keep a few convenient systray applets and your GTK theme, append this to your rc.lua;<br />
function start_daemon(dae)<br />
daeCheck = os.execute("ps -eF | grep -v grep | grep -w " .. dae)<br />
if (daeCheck ~= 0) then<br />
os.execute(dae .. " &")<br />
end<br />
end<br />
<br />
procs = {"gnome-settings-daemon", "nm-applet", "kupfer", "gnome-sound-applet", "gnome-power-manager"}<br />
for k = 1, #procs do<br />
start_daemon(procs[k])<br />
end<br />
<br />
===Prevent the mouse scroll wheel from changing tags===<br />
In your rc.lua, change the Mouse Bindings section to the following;<br />
-- {{{ Mouse bindings<br />
root.buttons(awful.util.table.join(<br />
awful.button({ }, 3, function () mymainmenu:toggle() end)))<br />
-- }}}<br />
<br />
==Troubleshooting==<br />
<br />
===LibreOffice===<br />
If you encounter UI problems with libreoffice install libreoffice-gnome.<br />
<br />
===Mod4 key===<br />
<br />
The Mod4 is by default the '''Win key'''. If it's not mapped by default, for some reason, you can check the keycode of your Mod4 key with<br />
<br />
$ xev<br />
<br />
It should be 115 for the left one. Then add this to your ~/.xinitrc<br />
<br />
xmodmap -e "keycode 115 = Super_L" -e "add mod4 = Super_L"<br />
exec awesome<br />
<br />
The problem in this case is that some xorg installations recognize keycode 115, but incorrectly as the 'Select' key. The above command explictly remaps keycode 115 to the correct 'Super_L' key.<br />
<br />
====Mod4 key vs. IBM ThinkPad users====<br />
<br />
IBM ThinkPads do not come equipped with a Window key (although Lenovo have changed this tradition on their ThinkPads). As of writing, the Alt key is not used in command combinations by the default rc.lua (refer to the Awesome wiki for a table of commands), which allows it be used as a replacement for the Super/Mod4/Win key. To do this, edit your rc.lua and replace:<br />
<br />
modkey = "Mod4"<br />
<br />
by:<br />
<br />
modkey = "Mod1"<br />
<br />
Note: Awesome does a have a few commands that make use of Mod4 plus a single letter. Changing Mod4 to Mod1/Alt could cause overlaps for some key combinations. The small amount of instances where this happens can be changed in the rc.lua file.<br />
<br />
If you do not like to change the awesome standards, you might like to remap a key. For instance the caps lock key is rather useless (for me) adding the following contents to ~/.Xmodmap <br />
<br />
clear lock <br />
add mod4 = Caps_Lock<br />
<br />
and [[Extra Keyboard Keys in Xorg#Step 2: Testing|(re)load]] the file.<br />
This will change the caps lock key into the mod4 key and works nicely with the standard awesome settings. In addition, if needed, it provides the mod4 key to other X-programs as well.<br />
<br />
Not confirmed, but if recent updates of xorg related packages break mentioned remapping the second line can be replaced by (tested on a DasKeyboard with no left Super key):<br />
<br />
keysym Caps_Lock = Super_L Caps_Lock<br />
<br />
===Eclipse: cannot resize/move main window===<br />
If you get stuck and cannot move or resize the main window (using mod4 + left/right mouse button) edit the workbench.xml and set fullscreen/maximized to false (if set) and reduce the width and height to numbers smaller than your single screen desktop area.<br />
{{Note|workbench.xml can be found in: <eclipse_workspace>/.metadata/.plugins/org.eclipse.ui.workbench/ and the line to edit is <window height&#61;"xx" maximized&#61;"true" width&#61;"xx" x&#61;"xx" y&#61;"xx">.}}<br />
<br />
===YouTube: fullscreen appears in background===<br />
[https://bbs.archlinux.org/viewtopic.php?pid=1085494#p1085494] If YouTube videos appear underneath your web browser when in fullscreen mode, add this to your rc.lua<br />
<br />
{ rule = { instance = "plugin-container" },<br />
properties = { floating = true } },<br />
<br />
With Chromium add<br />
<br />
{ rule = { instance = "exe" },<br />
properties = { floating = true } },<br />
<br />
===Starting console clients on specific tags===<br />
It does not work when the console application is invoked from a GTK terminal (e.g. LXTerminal). [[URxvt]] is known to work. <br />
<br />
===Redirecting console output to a file===<br />
Some GUI application are very verbose when launched from a terminal. As a consequence, when started from Awesome, they output everything to the TTY from where Awesome was started, which tend to get messy. To remove the garbage output, you have to redirect it. However, the {{ic|awful.util.spawn}} function does not handle pipes and redirections very well as stated in [http://awesome.naquadah.org/wiki/FAQ#How_to_execute_a_shell_command.3F the official FAQ].<br />
<br />
As example, let's redirect [[Luakit]] output to a temporary file:<br />
<br />
awful.key({ modkey, }, "w", function () awful.util.spawn_with_shell("luakit 2>>/tmp/luakit.log") end),<br />
<br />
==External Links==<br />
* http://awesome.naquadah.org/wiki/FAQ - FAQ<br />
* http://www.lua.org/pil/ - Programming in Lua (first edition)<br />
* http://awesome.naquadah.org/ - The official awesome website<br />
* http://awesome.naquadah.org/wiki/Main_Page - the awesome wiki<br />
* http://www.penguinsightings.org/desktop/awesome/ - A review<br />
* http://compsoc.tardis.ed.ac.uk/wiki/AwesomeWM_guide - Awesome guide<br />
* https://bbs.archlinux.org/viewtopic.php?id=88926 - share your awesome!</div>Yagnbhttps://wiki.archlinux.org/index.php?title=Awesome_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=280070Awesome (简体中文)2013-10-28T03:03:48Z<p>Yagnb: /* Awesome的更多插件 */</p>
<hr />
<div>[[Category:Dynamic WMs (简体中文)]]<br />
[[cs:Awesome]]<br />
[[en:Awesome]]<br />
[[es:Awesome]]<br />
[[fr:Awesome3]]<br />
[[it:Awesome]]<br />
[[ja:Awesome]]<br />
[[ru:Awesome]]<br />
{{Lowercase title}}<br />
{{translateme (简体中文)}}<br />
{{TranslationStatus (简体中文)|Awesome|2012-11-25|236478}}<br />
{{Article summary start|摘要}}<br />
{{Article summary text|关于安装、使用、配置和自定义 awesome 窗口管理器的指南。}}<br />
{{Article summary end}}<br />
<br />
来自[[Wikipedia:awesome (window manager)|awesome]]网站:<br />
<br />
''[http://awesome.naquadah.org/ Awesome] 是 XWindows 下可高度定制的新一代窗口管理器。运行快捷、扩展性强,遵循GPLv2发布。''<br />
<br />
''Awesome主要面向高级用户、开发者和那些希望完美控制自己电脑的图形界面的人。''<br />
<br />
==安装==<br />
<br />
[[pacman (简体中文)|安装]]位于[[Official Repositories (简体中文)|官方软件仓库]]的软件包 {{Pkg|awesome}}。<br />
<br />
如果你对不稳定的预览版本有兴趣,可以从 [[AUR]] 安装 {{aur|awesome-git}}。但是请注意,这是一个不稳定的开发版,配置文件会有语法差异。<br />
<br />
==使用Awesome==<br />
<br />
===不使用登陆管理器===<br />
<br />
不使用登录管理器来运行 awesome,只要添加 '''{{Ic|exec awesome}}'''到你的启动脚本(比如 ~/.xinitrc)。 详情参阅[[xinitrc]]<br />
<br />
你也可以甚至不用登陆直接使用预置用户启动Awesome,请参考[[Start X at Login]]<br />
<br />
=== 使用登陆管理器 ===<br />
要想用登陆管理器启动awesome,看[[Display Manager (简体中文)|这里]].<br />
<br />
==配置==<br />
Awesome默认的配置已经很不错了,不过你迟早会想要做一些修改的。配置文件是一个lua脚本:{{ic|~/.config/awesome/rc.lua}}.<br />
<br />
===创建配置文件===<br />
创建配置文件所在的文件夹<br />
$ mkdir -p ~/.config/awesome/<br />
<br />
Awesome会自动使用~/.config/awesome/rc.lua里的所有配置。这个文件并不会自动创建,所以我们先要从模板复制一个过来:<br />
$ cp /etc/xdg/awesome/rc.lua ~/.config/awesome<br />
<br />
配置文件的语法会随着Awesome的版本升级而变化,所以当你升级了之后遇到问题时,重复上面的步骤,或者你得手动修改配置文件。<br />
<br />
要获得关于配置Awesome的更多信息,请看[http://awesome.naquadah.org/wiki/Awesome_3_configuration Awesome wiki的配置部分]<br />
<br />
===更多的配置资源===<br />
{{注意|Awesome配置文件语法有时会变化,所以你可能得动手修改下载的配置文件。}}<br />
<br />
一些不错的rc.lua的例子可以在下面这些站点找到:<br />
<br />
* http://git.sysphere.org/awesome-configs/tree/ - Adrian C 的 Awesome 3.4 配置文件。 (anrxc)<br />
* http://pastebin.com/f6e4b064e - Darthlukan 的 Awesome 3.4 配置文件. <br />
* http://www.calmar.ws/dotfiles/dotfiledir/dot_awesomerc.lua<br />
* http://github.com/wolgri/wolgri.config/tree/master/.config/awesome/rc.lua<br />
* http://oxmoz.no-ip.org/awesome/rc.lua<br />
* http://www.ugolnik.info/downloads/awesome/rc.lua (screen) - 带有小型标题栏和状态栏的Awesome3配置文件。<br />
* http://github.com/bash/dotfiles/blob/master/.config/awesome/rc.lua<br />
* http://github.com/nblock/config/blob/master/.config/awesome/rc.lua<br />
* User Configuration Files http://awesome.naquadah.org/wiki/User_Configuration_Files<br />
<br />
===用 Xephyr 测试 rc.lua===<br />
<br />
用这种方式可以在不破坏现有桌面的情况下对rc.lua进行测试。首先把 rc.lua 复制到一个新文件rc.lua.new,接着进行修改。然后在Xephyr中运行新的rc.lua (Xephyr允许你在XWindow中植入一个新的XWindow - [http://www.dante4d.cz/pub/screenie/2009-08-01-025216_1920x1200_scrot.png screenshot])。 你可以这样测试你的新rc.lua<br />
<br />
$ Xephyr -ac -br -noreset -screen 1152x720 :1 &<br />
$ DISPLAY=:1.0 awesome -c ~/.config/awesome/rc.lua.new<br />
<br />
这种方式的巨大优势在于如果你弄坏了rc.lua.new,你不至于把现有的Awesome桌面弄得一团糟(并且很可能还会把XWindow弄崩溃了,没保存的工作全部丢失………)。一旦你觉得新的配置文件不错,就用rc.lua.new代替rc.lua,然后重启Awesome。<br />
<br />
目前(2011.07),还有一个工具{{aur|awmtt}}可以提供上述功能。<br />
<br />
==主题==<br />
<br />
[http://awesome.naquadah.org/wiki/Beautiful Beautiful]可以让你动态地改变背景图片和颜色主题,而不需要改变rc.lua文件。<br />
<br />
默认的主题文件是 /usr/share/awesome/themes/default。把它复制到 ~/.config/awesome/themes/default 然后修改一下 rc.lua中的theme_path。 <br />
beautiful.init(awful.util.getdir("config") .. "/themes/default/theme.lua")<br />
<br />
更多细节参考[http://awesome.naquadah.org/wiki/Beautiful 这里]<br />
<br />
一些样例:[http://awesome.naquadah.org/wiki/Beautiful_themes themes]<br />
<br />
===设置墙纸===<br />
<br />
Beautiful 可以设置墙纸,所以你就不用在.xinitrc 或者 .xsession 中自己设置了。Beautiful 允许你给每个主题配一个墙纸。如果你看一看默认的主题文件,可以找到一个 wallpaper_cmd 值。当beautiful.init("path_to_theme_file")运行的时候,给定的命令就会运行。如果不想要 Beautiful 修改你的墙纸,你可以在这里自己定义一个命令,或者把这个值注释掉。<br />
<br />
例如,如果你想用 awsetbg 设置墙纸,你可以这样写:<br />
<br />
theme.wallpaper_cmd = { "awsetbg -f .config/awesome/themes/awesome-wallpaper.png" }<br />
<br />
{{注意|要让Awsetbg工作,你需要有一个能设置背景图片的软件,比如"[[Feh]]"。}}<br />
<br />
====随机墙纸====<br />
想要随机切换墙纸,只需要注释掉 wallpaper_cmd 一行,然后使用下面的代码添加脚本到到你的 .xinitrc 文件中:<br />
{{bc|<br />
while true;<br />
do<br />
awsetbg -r <path/to/the/directory/of/your/wallpapers><br />
sleep 15m<br />
done &<br />
}}<br />
<br />
==小技巧==<br />
如果你有自己的小技巧想与大家分享,请随意添加。<br />
<br />
===使用awesome作为GNOME的窗口管理器===<br />
GNOME有“开包即用”的优势,你可以在使用GNOME的同时改用awesome作为窗口管理器。如果你在用GNOME 3的话,你可以安装{{AUR|awesome-gnome}}包,然后在用GDM登陆的时候选择"Awesome GNOME"。更多详细内容请参考[http://awesome.naquadah.org/wiki/Quickly_Setting_up_Awesome_with_Gnome awesome wiki]。<br />
<br />
===像compiz那样的平铺桌面效果===<br />
<br />
Revelation可以显示所有你开启的客户端;左键点击客户端会跳到该客户端所在的第一个标签并聚焦于该客户端。按下回车键会跳到当前聚焦的客户端,按下ESc键退出。更多内容请参考[http://awesome.naquadah.org/wiki/Revelation]。<br />
<br />
===在awesome 3中显示/隐藏wibox===<br />
<br />
要使用Modkey-b来在当前屏幕上隐藏/显示默认的状态栏 (Awesome 2.3中的默认行为),把下面代码加入rc.lua里的globalkeys变量:<br />
<br />
awful.key({ modkey }, "b", function ()<br />
mywibox[mouse.screen].visible = not mywibox[mouse.screen].visible<br />
end),<br />
<br />
===截图===<br />
<br />
在awesome中想要通过PrtScn按键来截图就必须借助其他截图工具. Arch软件仓库中,Scrot是个很简单就可以实现这些功能的截图工具.<br />
<br />
只需要输入:<br />
# pacman -S scrot<br />
<br />
如果optional dependencies中可选的包觉得有用,也可以安装.<br />
<br />
下一步,就是需要获得PrtScr按键的按键名, 如果不确定是什么,一般就是 "Print"了.<br />
<br />
终端里面输入命令:<br />
# xev<br />
<br />
然后按键盘上的PrtScr按键, 将会输出类似下面的结果:<br />
KeyPress event ....<br />
root 0x25c, subw 0x0, ...<br />
state 0x0, keycode 107 (keysym 0xff61, '''Print'''), same_screen YES,<br />
....<br />
<br />
我们判断没错,键名就是 "Print".<br />
<br />
接下来继续配置awesome!<br />
<br />
在配置文件中的全局数组(任意地方)中输入并保存:<br />
<br />
Lua 代码:<br />
<br />
awful.key({ }, "Print", function () awful.util.spawn("scrot -e 'mv $f ~/screenshots/ 2>/dev/null'") end),<br />
<br />
这里的 ~/screenshots/ 可以改成你截图想要保存的地方.<br />
<br />
===动态标签===<br />
<br />
[http://awesome.naquadah.org/wiki/Eminent Eminent]是一个小型的lua库,扩展了awful并提供了简单快速的wmii一样的动态标签功能。跟shifty不同, eminent无意提供全面详尽的标签系统,而是试图让动态标签越简单越好。实际上除了导入eminent库,你不用在rc.lua里改任何东西,eminent会把所有的事情帮你搞定。<br />
<br />
[http://awesome.naquadah.org/wiki/Shifty Shifty]是实现了动态标签的一个Awesome 3的扩展。它也实现了一个配置系统来让你设置几个变量和键位绑定就完全掌控你的桌面!<br />
<br />
===Space Invaders===<br />
[http://awesome.naquadah.org/wiki/Space_Invaders Space Invaders]是一个用来展现Awesome Lua API无限能力的演示。<br />
<br />
请注意它从3.4-rc1版以后就没有被包括进Awesome包里了。<br />
<br />
===Naughty弹窗提醒===<br />
请查看[http://awesome.naquadah.org/wiki/Naughty Awesome维基上的naughty页面].<br />
<br />
===弹出菜单项===<br />
这是一份 awesome3 的默认简单菜单项, 看起来要自定义也十分容易. 然而,如果你在用awesome的 2.x 版本, 那么请看''[http://awesome.naquadah.org/wiki/Awful.menu awful.menu]''.<br />
<br />
如果你想要配置 freedesktop.org 的菜单项,就到 ''[https://github.com/terceiro/awesome-freedesktop awesome-freedesktop]'' .<br />
<br />
一个 awesome3 的菜单配置示例:<br />
{{bc|1=<br />
myawesomemenu = {<br />
{ "lock", "xscreensaver-command -activate" },<br />
{ "manual", terminal .. " -e man awesome" },<br />
{ "edit config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua" },<br />
{ "restart", awesome.restart },<br />
{ "quit", awesome.quit }<br />
}<br />
<br />
mycommons = {<br />
{ "pidgin", "pidgin" },<br />
{ "OpenOffice", "soffice-dev" },<br />
{ "Graphic", "gimp" }<br />
}<br />
<br />
mymainmenu = awful.menu.new({ items = { <br />
{ "terminal", terminal },<br />
{ "icecat", "icecat" },<br />
{ "Editor", "gvim" },<br />
{ "File Manager", "pcmanfm" },<br />
{ "VirtualBox", "VirtualBox" },<br />
{ "Common App", mycommons, beautiful.awesome_icon },<br />
{ "awesome", myawesomemenu, beautiful.awesome_icon }<br />
}<br />
})<br />
}}<br />
<br />
===Awesome的更多插件===<br />
''Awesome中的插件是一些你可以加入插件栏 (状态栏和标题栏) 的东西,它们提供了关于你的系统的各种信息,并让你很方便地直接在窗口管理器上就看到这些信息。这些插件很简易而且有很强的灵活性。'' -- 来自 [http://awesome.naquadah.org/wiki/Widgets_in_awesome Awesome Wiki: Widgets]。<br />
<br />
有一个被广泛使用的插件库叫'''Wicked''' (只与'''3.4版以前'''的Awesome兼容),它提供了更多插件,比如MPD插件,CPU使用情况,内存使用情况等。要更详细的了解参见 [http://awesome.naquadah.org/wiki/Wicked Wicked]。<br />
<br />
Awesome 3.4中用来代替Wicked的有'''[http://awesome.naquadah.org/wiki/Vicious Vicious]''','''[http://awesome.naquadah.org/wiki/Obvious Obvious]''' 和 '''[http://awesome.naquadah.org/wiki/Bashets Bashets]'''。如果你选择使用vicious,你也应该看看 [http://git.sysphere.org/vicious/tree/README vicious的文档]。<br />
<br />
===Transparency===<br />
Awesome has support for true transparency through xcompmgr. Note that you'll probably want the git version of xcompmgr, which is [https://aur.archlinux.org/packages.php?ID=16554 available in AUR]. <br />
<br />
Add this to your ~/.xinitrc:<br />
xcompmgr &<br />
See ''man xcompmgr'' or [[xcompmgr]] for more options.<br />
<br />
In awesome 3.4, window transparency can be set dynamically using signals. For example, your rc.lua could contain the following:<br />
<br />
client.add_signal("focus", function(c)<br />
c.border_color = beautiful.border_focus<br />
c.opacity = 1<br />
end)<br />
client.add_signal("unfocus", function(c)<br />
c.border_color = beautiful.border_normal<br />
c.opacity = 0.7<br />
end)<br />
'''If you got error messages about add_signal, using connect_signal insteaded.''' <br />
<br />
Note that if you are using conky, you must set it to create its own window instead of using the desktop. To do so, edit ~/.conkyrc to contain:<br />
<br />
own_window yes<br />
own_window_transparent yes<br />
own_window_type desktop<br />
<br />
Otherwise strange behavior may be observed, such as all windows becoming fully transparent. Note also that since conky will be creating a transparent window on your desktop, any actions defined in awesome's rc.lua for the desktop will not work where conky is.<br />
<br />
As of Awesome 3.1, there is built-in pseudo-transparency for wiboxes. To enable it, append 2 hexadecimal digits to the colors in your theme file (~/.config/awesome/themes/default, which is usually a copy of /usr/share/awesome/themes/default), like shown here:<br />
<br />
bg_normal = #000000AA<br />
<br />
where "AA" is the transparency value.<br />
<br />
To change transparency for the actual selected window by pressing Modkey + PageUp/PageDown you can also use tansset-df available through the community package repository and the following modification to your rc.lua:<br />
<br />
globalkeys = awful.util.table.join(<br />
-- your keybindings<br />
[...]<br />
awful.key({ modkey }, "Next", function (c)<br />
awful.util.spawn("transset-df --actual --inc 0.1")<br />
end),<br />
awful.key({ modkey }, "Prior", function (c)<br />
awful.util.spawn("transset-df --actual --dec 0.1")<br />
end),<br />
-- Your other key bindings<br />
[...]<br />
)<br />
<br />
==== ImageMagick ====<br />
You may have problems if you set your wallpaper with imagemagick's ''display'' command, it doesn't work well with xcompmgr. Please note that awsetbg may be using ''display'' if it doesn't have any other options. Installing habak, feh, hsetroot or whatever should fix the problem (''grep -A 1 wpsetters /usr/bin/awsetbg'' to see your options).<br />
<br />
===Autorun programs===<br />
''See also [https://awesome.naquadah.org/wiki/Autostart the Autostart page on the Awesome wiki].''<br />
<br />
awesome doesn't run programs set to autostart by the Freedesktop specification like GNOME or KDE. However, awesome does provide a few functions for starting programs (in addition to the Lua standard library function {{Ic|os.execute}}). To run the same programs on startup as GNOME or KDE, you can install [https://aur.archlinux.org/packages.php?ID=41099 dex] from the [[AUR]] and then run that in your rc.lua:<br />
<br />
os.execute"dex -a -e Awesome"<br />
<br />
If you just want to set up a list of apps for awesome to launch at startup, you can create a table of all the commands you want to spawn and loop through it:<br />
<br />
do<br />
local cmds = <br />
{ <br />
"swiftfox",<br />
"mutt",<br />
"consonance",<br />
"linux-fetion",<br />
"weechat-curses",<br />
--and so on...<br />
}<br />
<br />
for _,i in pairs(cmds) do<br />
awful.util.spawn(i)<br />
end<br />
end<br />
<br />
(You could also run calls to {{Ic|os.execute}} with commands ending in '{{Ic|&}}', but it's probably a better idea to stick to the proper spawn function.)<br />
<br />
To run a program only if it is not currently running, you can spawn it with a shell command that runs the program only if {{Ic|pgrep}} doesn't find a running process with the same name:<br />
function run_once(prg)<br />
awful.util.spawn_with_shell("pgrep -u $USER -x " .. prg .. " || (" .. prg .. ")")<br />
end<br />
<br />
So, for example, to run {{Ic|parcellite}} only if there is not a {{Ic|parcellite}} process already running:<br />
<br />
run_once("parcellite")<br />
<br />
===使用 awesome-client 给文本插件传递信息===<br />
<br />
只需要创建一个新的插件,就可以很容易的传递信息。<br />
{{bc|<nowiki><br />
mywidget = widget({ type = "textbox", name = "mywidget" })<br />
mywidget.text = "initial text"<br />
</nowiki>}}<br />
<br />
使用 awesome-client 从外部更新“initial text":<br />
<br />
{{bc|<nowiki> <br />
echo -e 'mywidget.text = "new text"' | awesome-client<br />
</nowiki>}}<br />
不要忘记把插件增加到 wibox.<br />
<br />
===使用其他任务栏===<br />
<br />
如果你喜欢 awesome 既轻量又强大的功能,但又不喜欢默认那个任务栏的外观, 你可以安装其他的.比如 xfce4-panel:<br />
{{bc|<br />
sudo pacman -S xfce4-panel<br />
}}<br />
<br />
当然,你可能有更好的选择.然后要把它添加到配置文件 rc.lua 的自动启动部分(该如何写请看wiki吧).你可以注释掉配置文件中给每个桌面创建 wiboxes 的那部分(开头是"mywibox[s] = awful.wibox({ position = "top", screen = s })"),因为已经不需要了. 检查配置文件没有错误之后就可以执行命令生效:<br />
{{bc|<br />
awesome -k rc.lua<br />
}}<br />
另外你还需要改变"modkey+R"的快捷键绑定, 比如用Xfrun4, bashrun等,来替代awesome自带的启动器. 请看这个[[Openbox_Themes_and_Apps#Application_launchers|Openbox]]文章中的启动器部分作为参考. 别忘了添加<br />
{{bc|<nowiki><br />
properties = { floating = true } },<br />
{ rule = { instance = "$yourapplicationlauncher" },<br />
</nowiki>}}<br />
到你 rc.lua 配置文件中<br />
<br />
===Fix Java (GUI appears gray only)===<br />
Guide taken from [https://bbs.archlinux.org/viewtopic.php?pid=450870].<br />
#Install {{Pkg|wmname}} from community<br />
#Run the following command or add it to your {{ic|.xinitrc}}: {{bc|wmname LG3D}}<br />
<br />
{{Note|<br />
If you use a non-reparenting window manager and Java 6, you should uncomment the corresponding line in {{Ic|/etc/profile.d/openjdk6.sh}}<br />
<br />
If you use a non-reparenting window manager and Java 7, you should uncomment the corresponding line in <br />
{{Ic|/etc/profile.d/jre.sh}} <br />
}}<br />
<br />
===Prevent Nautilus from displaying the desktop (Gnome3)===<br />
Run dconf-editor. Navigate to org->gnome->desktop->background and uncheck "draw-background" as well as "show-desktop-icons" for good measure. That's it!<br />
<br />
Another option is moving /usr/bin/nautilus to a new location and replacing it with a script that runs 'nautilus --no-desktop' passing any arguments it receives along.<br />
<br />
#!/bin/sh<br />
/usr/bin/nautilus-real --no-desktop $@<br />
<br />
===Transitioning away from Gnome3===<br />
Run 'gnome-session-properties' and remove programs that you won't be needing anymore (e.g Bluetooth Manager, Login Sounds, etc).<br />
<br />
If you'd like to get rid of GDM, make sure that your rc.conf DAEMONS list includes "dbus" (and "cupsd" if you have a printer). It's advisable to get a different login manager (like [https://wiki.archlinux.org/index.php/SLiM SLiM]), but you can do things manually if you wish. That entails setting up your [https://wiki.archlinux.org/index.php/Udev .xinitrc properly] and installing something like devmon ([https://aur.archlinux.org/packages.php?ID=45842 AUR]).<br />
<br />
If you wan't to keep a few convenient systray applets and your GTK theme, append this to your rc.lua;<br />
function start_daemon(dae)<br />
daeCheck = os.execute("ps -eF | grep -v grep | grep -w " .. dae)<br />
if (daeCheck ~= 0) then<br />
os.execute(dae .. " &")<br />
end<br />
end<br />
<br />
procs = {"gnome-settings-daemon", "nm-applet", "kupfer", "gnome-sound-applet", "gnome-power-manager"}<br />
for k = 1, #procs do<br />
start_daemon(procs[k])<br />
end<br />
<br />
===Prevent the mouse scroll wheel from changing tags===<br />
In your rc.lua, change the Mouse Bindings section to the following;<br />
-- {{{ Mouse bindings<br />
root.buttons(awful.util.table.join(<br />
awful.button({ }, 3, function () mymainmenu:toggle() end)))<br />
-- }}}<br />
<br />
==Troubleshooting==<br />
<br />
===LibreOffice===<br />
If you encounter UI problems with libreoffice install libreoffice-gnome.<br />
<br />
===Mod4 key===<br />
<br />
The Mod4 is by default the '''Win key'''. If it's not mapped by default, for some reason, you can check the keycode of your Mod4 key with<br />
<br />
$ xev<br />
<br />
It should be 115 for the left one. Then add this to your ~/.xinitrc<br />
<br />
xmodmap -e "keycode 115 = Super_L" -e "add mod4 = Super_L"<br />
exec awesome<br />
<br />
The problem in this case is that some xorg installations recognize keycode 115, but incorrectly as the 'Select' key. The above command explictly remaps keycode 115 to the correct 'Super_L' key.<br />
<br />
====Mod4 key vs. IBM ThinkPad users====<br />
<br />
IBM ThinkPads do not come equipped with a Window key (although Lenovo have changed this tradition on their ThinkPads). As of writing, the Alt key is not used in command combinations by the default rc.lua (refer to the Awesome wiki for a table of commands), which allows it be used as a replacement for the Super/Mod4/Win key. To do this, edit your rc.lua and replace:<br />
<br />
modkey = "Mod4"<br />
<br />
by:<br />
<br />
modkey = "Mod1"<br />
<br />
Note: Awesome does a have a few commands that make use of Mod4 plus a single letter. Changing Mod4 to Mod1/Alt could cause overlaps for some key combinations. The small amount of instances where this happens can be changed in the rc.lua file.<br />
<br />
If you do not like to change the awesome standards, you might like to remap a key. For instance the caps lock key is rather useless (for me) adding the following contents to ~/.Xmodmap <br />
<br />
clear lock <br />
add mod4 = Caps_Lock<br />
<br />
and [[Extra Keyboard Keys in Xorg#Step 2: Testing|(re)load]] the file.<br />
This will change the caps lock key into the mod4 key and works nicely with the standard awesome settings. In addition, if needed, it provides the mod4 key to other X-programs as well.<br />
<br />
Not confirmed, but if recent updates of xorg related packages break mentioned remapping the second line can be replaced by (tested on a DasKeyboard with no left Super key):<br />
<br />
keysym Caps_Lock = Super_L Caps_Lock<br />
<br />
===Eclipse: cannot resize/move main window===<br />
If you get stuck and cannot move or resize the main window (using mod4 + left/right mouse button) edit the workbench.xml and set fullscreen/maximized to false (if set) and reduce the width and height to numbers smaller than your single screen desktop area.<br />
{{Note|workbench.xml can be found in: <eclipse_workspace>/.metadata/.plugins/org.eclipse.ui.workbench/ and the line to edit is <window height&#61;"xx" maximized&#61;"true" width&#61;"xx" x&#61;"xx" y&#61;"xx">.}}<br />
<br />
===YouTube: fullscreen appears in background===<br />
[https://bbs.archlinux.org/viewtopic.php?pid=1085494#p1085494] If YouTube videos appear underneath your web browser when in fullscreen mode, add this to your rc.lua<br />
<br />
{ rule = { instance = "plugin-container" },<br />
properties = { floating = true } },<br />
<br />
With Chromium add<br />
<br />
{ rule = { instance = "exe" },<br />
properties = { floating = true } },<br />
<br />
===Starting console clients on specific tags===<br />
It does not work when the console application is invoked from a GTK terminal (e.g. LXTerminal). [[URxvt]] is known to work. <br />
<br />
===Redirecting console output to a file===<br />
Some GUI application are very verbose when launched from a terminal. As a consequence, when started from Awesome, they output everything to the TTY from where Awesome was started, which tend to get messy. To remove the garbage output, you have to redirect it. However, the {{ic|awful.util.spawn}} function does not handle pipes and redirections very well as stated in [http://awesome.naquadah.org/wiki/FAQ#How_to_execute_a_shell_command.3F the official FAQ].<br />
<br />
As example, let's redirect [[Luakit]] output to a temporary file:<br />
<br />
awful.key({ modkey, }, "w", function () awful.util.spawn_with_shell("luakit 2>>/tmp/luakit.log") end),<br />
<br />
==External Links==<br />
* http://awesome.naquadah.org/wiki/FAQ - FAQ<br />
* http://www.lua.org/pil/ - Programming in Lua (first edition)<br />
* http://awesome.naquadah.org/ - The official awesome website<br />
* http://awesome.naquadah.org/wiki/Main_Page - the awesome wiki<br />
* http://www.penguinsightings.org/desktop/awesome/ - A review<br />
* http://compsoc.tardis.ed.ac.uk/wiki/AwesomeWM_guide - Awesome guide<br />
* https://bbs.archlinux.org/viewtopic.php?id=88926 - share your awesome!</div>Yagnbhttps://wiki.archlinux.org/index.php?title=Awesome_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=280064Awesome (简体中文)2013-10-28T02:44:12Z<p>Yagnb: /* Naughty for popup notification */</p>
<hr />
<div>[[Category:Dynamic WMs (简体中文)]]<br />
[[cs:Awesome]]<br />
[[en:Awesome]]<br />
[[es:Awesome]]<br />
[[fr:Awesome3]]<br />
[[it:Awesome]]<br />
[[ja:Awesome]]<br />
[[ru:Awesome]]<br />
{{Lowercase title}}<br />
{{translateme (简体中文)}}<br />
{{TranslationStatus (简体中文)|Awesome|2012-11-25|236478}}<br />
{{Article summary start|摘要}}<br />
{{Article summary text|关于安装、使用、配置和自定义 awesome 窗口管理器的指南。}}<br />
{{Article summary end}}<br />
<br />
来自[[Wikipedia:awesome (window manager)|awesome]]网站:<br />
<br />
''[http://awesome.naquadah.org/ Awesome] 是 XWindows 下可高度定制的新一代窗口管理器。运行快捷、扩展性强,遵循GPLv2发布。''<br />
<br />
''Awesome主要面向高级用户、开发者和那些希望完美控制自己电脑的图形界面的人。''<br />
<br />
==安装==<br />
<br />
[[pacman (简体中文)|安装]]位于[[Official Repositories (简体中文)|官方软件仓库]]的软件包 {{Pkg|awesome}}。<br />
<br />
如果你对不稳定的预览版本有兴趣,可以从 [[AUR]] 安装 {{aur|awesome-git}}。但是请注意,这是一个不稳定的开发版,配置文件会有语法差异。<br />
<br />
==使用Awesome==<br />
<br />
===不使用登陆管理器===<br />
<br />
不使用登录管理器来运行 awesome,只要添加 '''{{Ic|exec awesome}}'''到你的启动脚本(比如 ~/.xinitrc)。 详情参阅[[xinitrc]]<br />
<br />
你也可以甚至不用登陆直接使用预置用户启动Awesome,请参考[[Start X at Login]]<br />
<br />
=== 使用登陆管理器 ===<br />
要想用登陆管理器启动awesome,看[[Display Manager (简体中文)|这里]].<br />
<br />
==配置==<br />
Awesome默认的配置已经很不错了,不过你迟早会想要做一些修改的。配置文件是一个lua脚本:{{ic|~/.config/awesome/rc.lua}}.<br />
<br />
===创建配置文件===<br />
创建配置文件所在的文件夹<br />
$ mkdir -p ~/.config/awesome/<br />
<br />
Awesome会自动使用~/.config/awesome/rc.lua里的所有配置。这个文件并不会自动创建,所以我们先要从模板复制一个过来:<br />
$ cp /etc/xdg/awesome/rc.lua ~/.config/awesome<br />
<br />
配置文件的语法会随着Awesome的版本升级而变化,所以当你升级了之后遇到问题时,重复上面的步骤,或者你得手动修改配置文件。<br />
<br />
要获得关于配置Awesome的更多信息,请看[http://awesome.naquadah.org/wiki/Awesome_3_configuration Awesome wiki的配置部分]<br />
<br />
===更多的配置资源===<br />
{{注意|Awesome配置文件语法有时会变化,所以你可能得动手修改下载的配置文件。}}<br />
<br />
一些不错的rc.lua的例子可以在下面这些站点找到:<br />
<br />
* http://git.sysphere.org/awesome-configs/tree/ - Adrian C 的 Awesome 3.4 配置文件。 (anrxc)<br />
* http://pastebin.com/f6e4b064e - Darthlukan 的 Awesome 3.4 配置文件. <br />
* http://www.calmar.ws/dotfiles/dotfiledir/dot_awesomerc.lua<br />
* http://github.com/wolgri/wolgri.config/tree/master/.config/awesome/rc.lua<br />
* http://oxmoz.no-ip.org/awesome/rc.lua<br />
* http://www.ugolnik.info/downloads/awesome/rc.lua (screen) - 带有小型标题栏和状态栏的Awesome3配置文件。<br />
* http://github.com/bash/dotfiles/blob/master/.config/awesome/rc.lua<br />
* http://github.com/nblock/config/blob/master/.config/awesome/rc.lua<br />
* User Configuration Files http://awesome.naquadah.org/wiki/User_Configuration_Files<br />
<br />
===用 Xephyr 测试 rc.lua===<br />
<br />
用这种方式可以在不破坏现有桌面的情况下对rc.lua进行测试。首先把 rc.lua 复制到一个新文件rc.lua.new,接着进行修改。然后在Xephyr中运行新的rc.lua (Xephyr允许你在XWindow中植入一个新的XWindow - [http://www.dante4d.cz/pub/screenie/2009-08-01-025216_1920x1200_scrot.png screenshot])。 你可以这样测试你的新rc.lua<br />
<br />
$ Xephyr -ac -br -noreset -screen 1152x720 :1 &<br />
$ DISPLAY=:1.0 awesome -c ~/.config/awesome/rc.lua.new<br />
<br />
这种方式的巨大优势在于如果你弄坏了rc.lua.new,你不至于把现有的Awesome桌面弄得一团糟(并且很可能还会把XWindow弄崩溃了,没保存的工作全部丢失………)。一旦你觉得新的配置文件不错,就用rc.lua.new代替rc.lua,然后重启Awesome。<br />
<br />
目前(2011.07),还有一个工具{{aur|awmtt}}可以提供上述功能。<br />
<br />
==主题==<br />
<br />
[http://awesome.naquadah.org/wiki/Beautiful Beautiful]可以让你动态地改变背景图片和颜色主题,而不需要改变rc.lua文件。<br />
<br />
默认的主题文件是 /usr/share/awesome/themes/default。把它复制到 ~/.config/awesome/themes/default 然后修改一下 rc.lua中的theme_path。 <br />
beautiful.init(awful.util.getdir("config") .. "/themes/default/theme.lua")<br />
<br />
更多细节参考[http://awesome.naquadah.org/wiki/Beautiful 这里]<br />
<br />
一些样例:[http://awesome.naquadah.org/wiki/Beautiful_themes themes]<br />
<br />
===设置墙纸===<br />
<br />
Beautiful 可以设置墙纸,所以你就不用在.xinitrc 或者 .xsession 中自己设置了。Beautiful 允许你给每个主题配一个墙纸。如果你看一看默认的主题文件,可以找到一个 wallpaper_cmd 值。当beautiful.init("path_to_theme_file")运行的时候,给定的命令就会运行。如果不想要 Beautiful 修改你的墙纸,你可以在这里自己定义一个命令,或者把这个值注释掉。<br />
<br />
例如,如果你想用 awsetbg 设置墙纸,你可以这样写:<br />
<br />
theme.wallpaper_cmd = { "awsetbg -f .config/awesome/themes/awesome-wallpaper.png" }<br />
<br />
{{注意|要让Awsetbg工作,你需要有一个能设置背景图片的软件,比如"[[Feh]]"。}}<br />
<br />
====随机墙纸====<br />
想要随机切换墙纸,只需要注释掉 wallpaper_cmd 一行,然后使用下面的代码添加脚本到到你的 .xinitrc 文件中:<br />
{{bc|<br />
while true;<br />
do<br />
awsetbg -r <path/to/the/directory/of/your/wallpapers><br />
sleep 15m<br />
done &<br />
}}<br />
<br />
==小技巧==<br />
如果你有自己的小技巧想与大家分享,请随意添加。<br />
<br />
===使用awesome作为GNOME的窗口管理器===<br />
GNOME有“开包即用”的优势,你可以在使用GNOME的同时改用awesome作为窗口管理器。如果你在用GNOME 3的话,你可以安装{{AUR|awesome-gnome}}包,然后在用GDM登陆的时候选择"Awesome GNOME"。更多详细内容请参考[http://awesome.naquadah.org/wiki/Quickly_Setting_up_Awesome_with_Gnome awesome wiki]。<br />
<br />
===像compiz那样的平铺桌面效果===<br />
<br />
Revelation可以显示所有你开启的客户端;左键点击客户端会跳到该客户端所在的第一个标签并聚焦于该客户端。按下回车键会跳到当前聚焦的客户端,按下ESc键退出。更多内容请参考[http://awesome.naquadah.org/wiki/Revelation]。<br />
<br />
===在awesome 3中显示/隐藏wibox===<br />
<br />
要使用Modkey-b来在当前屏幕上隐藏/显示默认的状态栏 (Awesome 2.3中的默认行为),把下面代码加入rc.lua里的globalkeys变量:<br />
<br />
awful.key({ modkey }, "b", function ()<br />
mywibox[mouse.screen].visible = not mywibox[mouse.screen].visible<br />
end),<br />
<br />
===截图===<br />
<br />
在awesome中想要通过PrtScn按键来截图就必须借助其他截图工具. Arch软件仓库中,Scrot是个很简单就可以实现这些功能的截图工具.<br />
<br />
只需要输入:<br />
# pacman -S scrot<br />
<br />
如果optional dependencies中可选的包觉得有用,也可以安装.<br />
<br />
下一步,就是需要获得PrtScr按键的按键名, 如果不确定是什么,一般就是 "Print"了.<br />
<br />
终端里面输入命令:<br />
# xev<br />
<br />
然后按键盘上的PrtScr按键, 将会输出类似下面的结果:<br />
KeyPress event ....<br />
root 0x25c, subw 0x0, ...<br />
state 0x0, keycode 107 (keysym 0xff61, '''Print'''), same_screen YES,<br />
....<br />
<br />
我们判断没错,键名就是 "Print".<br />
<br />
接下来继续配置awesome!<br />
<br />
在配置文件中的全局数组(任意地方)中输入并保存:<br />
<br />
Lua 代码:<br />
<br />
awful.key({ }, "Print", function () awful.util.spawn("scrot -e 'mv $f ~/screenshots/ 2>/dev/null'") end),<br />
<br />
这里的 ~/screenshots/ 可以改成你截图想要保存的地方.<br />
<br />
===动态标签===<br />
<br />
[http://awesome.naquadah.org/wiki/Eminent Eminent]是一个小型的lua库,扩展了awful并提供了简单快速的wmii一样的动态标签功能。跟shifty不同, eminent无意提供全面详尽的标签系统,而是试图让动态标签越简单越好。实际上除了导入eminent库,你不用在rc.lua里改任何东西,eminent会把所有的事情帮你搞定。<br />
<br />
[http://awesome.naquadah.org/wiki/Shifty Shifty]是实现了动态标签的一个Awesome 3的扩展。它也实现了一个配置系统来让你设置几个变量和键位绑定就完全掌控你的桌面!<br />
<br />
===Space Invaders===<br />
[http://awesome.naquadah.org/wiki/Space_Invaders Space Invaders]是一个用来展现Awesome Lua API无限能力的演示。<br />
<br />
请注意它从3.4-rc1版以后就没有被包括进Awesome包里了。<br />
<br />
===Naughty弹窗提醒===<br />
请查看[http://awesome.naquadah.org/wiki/Naughty Awesome维基上的naughty页面].<br />
<br />
===弹出菜单项===<br />
这是一份 awesome3 的默认简单菜单项, 看起来要自定义也十分容易. 然而,如果你在用awesome的 2.x 版本, 那么请看''[http://awesome.naquadah.org/wiki/Awful.menu awful.menu]''.<br />
<br />
如果你想要配置 freedesktop.org 的菜单项,就到 ''[https://github.com/terceiro/awesome-freedesktop awesome-freedesktop]'' .<br />
<br />
一个 awesome3 的菜单配置示例:<br />
{{bc|1=<br />
myawesomemenu = {<br />
{ "lock", "xscreensaver-command -activate" },<br />
{ "manual", terminal .. " -e man awesome" },<br />
{ "edit config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua" },<br />
{ "restart", awesome.restart },<br />
{ "quit", awesome.quit }<br />
}<br />
<br />
mycommons = {<br />
{ "pidgin", "pidgin" },<br />
{ "OpenOffice", "soffice-dev" },<br />
{ "Graphic", "gimp" }<br />
}<br />
<br />
mymainmenu = awful.menu.new({ items = { <br />
{ "terminal", terminal },<br />
{ "icecat", "icecat" },<br />
{ "Editor", "gvim" },<br />
{ "File Manager", "pcmanfm" },<br />
{ "VirtualBox", "VirtualBox" },<br />
{ "Common App", mycommons, beautiful.awesome_icon },<br />
{ "awesome", myawesomemenu, beautiful.awesome_icon }<br />
}<br />
})<br />
}}<br />
<br />
===More Widgets in awesome===<br />
''Widgets in awesome are objects that you can add to any widget-box (statusbars and titlebars), they can provide various information about your system, and are useful for having access to this information, right from your window manager. Widgets are simple to use and offer a great deal of flexibility.'' -- Source [http://awesome.naquadah.org/wiki/Widgets_in_awesome Awesome Wiki: Widgets].<br />
<br />
There's a widely used widget library called '''Wicked''' (compatible with awesome versions '''prior to 3.4'''), that provides more widgets, like MPD widget, CPU usage, memory usage, etc. For more details see the [http://awesome.naquadah.org/wiki/Wicked Wicked page].<br />
<br />
As a replacement for Wicked in awesome v3.4 check '''[http://awesome.naquadah.org/wiki/Vicious Vicious]''', '''[http://awesome.naquadah.org/wiki/Obvious Obvious]''' and '''[http://awesome.naquadah.org/wiki/Bashets Bashets]'''. If you pick vicious, you should also take a good look at [http://git.sysphere.org/vicious/tree/README vicious documentation].<br />
<br />
===Transparency===<br />
Awesome has support for true transparency through xcompmgr. Note that you'll probably want the git version of xcompmgr, which is [https://aur.archlinux.org/packages.php?ID=16554 available in AUR]. <br />
<br />
Add this to your ~/.xinitrc:<br />
xcompmgr &<br />
See ''man xcompmgr'' or [[xcompmgr]] for more options.<br />
<br />
In awesome 3.4, window transparency can be set dynamically using signals. For example, your rc.lua could contain the following:<br />
<br />
client.add_signal("focus", function(c)<br />
c.border_color = beautiful.border_focus<br />
c.opacity = 1<br />
end)<br />
client.add_signal("unfocus", function(c)<br />
c.border_color = beautiful.border_normal<br />
c.opacity = 0.7<br />
end)<br />
'''If you got error messages about add_signal, using connect_signal insteaded.''' <br />
<br />
Note that if you are using conky, you must set it to create its own window instead of using the desktop. To do so, edit ~/.conkyrc to contain:<br />
<br />
own_window yes<br />
own_window_transparent yes<br />
own_window_type desktop<br />
<br />
Otherwise strange behavior may be observed, such as all windows becoming fully transparent. Note also that since conky will be creating a transparent window on your desktop, any actions defined in awesome's rc.lua for the desktop will not work where conky is.<br />
<br />
As of Awesome 3.1, there is built-in pseudo-transparency for wiboxes. To enable it, append 2 hexadecimal digits to the colors in your theme file (~/.config/awesome/themes/default, which is usually a copy of /usr/share/awesome/themes/default), like shown here:<br />
<br />
bg_normal = #000000AA<br />
<br />
where "AA" is the transparency value.<br />
<br />
To change transparency for the actual selected window by pressing Modkey + PageUp/PageDown you can also use tansset-df available through the community package repository and the following modification to your rc.lua:<br />
<br />
globalkeys = awful.util.table.join(<br />
-- your keybindings<br />
[...]<br />
awful.key({ modkey }, "Next", function (c)<br />
awful.util.spawn("transset-df --actual --inc 0.1")<br />
end),<br />
awful.key({ modkey }, "Prior", function (c)<br />
awful.util.spawn("transset-df --actual --dec 0.1")<br />
end),<br />
-- Your other key bindings<br />
[...]<br />
)<br />
<br />
==== ImageMagick ====<br />
You may have problems if you set your wallpaper with imagemagick's ''display'' command, it doesn't work well with xcompmgr. Please note that awsetbg may be using ''display'' if it doesn't have any other options. Installing habak, feh, hsetroot or whatever should fix the problem (''grep -A 1 wpsetters /usr/bin/awsetbg'' to see your options).<br />
<br />
===Autorun programs===<br />
''See also [https://awesome.naquadah.org/wiki/Autostart the Autostart page on the Awesome wiki].''<br />
<br />
awesome doesn't run programs set to autostart by the Freedesktop specification like GNOME or KDE. However, awesome does provide a few functions for starting programs (in addition to the Lua standard library function {{Ic|os.execute}}). To run the same programs on startup as GNOME or KDE, you can install [https://aur.archlinux.org/packages.php?ID=41099 dex] from the [[AUR]] and then run that in your rc.lua:<br />
<br />
os.execute"dex -a -e Awesome"<br />
<br />
If you just want to set up a list of apps for awesome to launch at startup, you can create a table of all the commands you want to spawn and loop through it:<br />
<br />
do<br />
local cmds = <br />
{ <br />
"swiftfox",<br />
"mutt",<br />
"consonance",<br />
"linux-fetion",<br />
"weechat-curses",<br />
--and so on...<br />
}<br />
<br />
for _,i in pairs(cmds) do<br />
awful.util.spawn(i)<br />
end<br />
end<br />
<br />
(You could also run calls to {{Ic|os.execute}} with commands ending in '{{Ic|&}}', but it's probably a better idea to stick to the proper spawn function.)<br />
<br />
To run a program only if it is not currently running, you can spawn it with a shell command that runs the program only if {{Ic|pgrep}} doesn't find a running process with the same name:<br />
function run_once(prg)<br />
awful.util.spawn_with_shell("pgrep -u $USER -x " .. prg .. " || (" .. prg .. ")")<br />
end<br />
<br />
So, for example, to run {{Ic|parcellite}} only if there is not a {{Ic|parcellite}} process already running:<br />
<br />
run_once("parcellite")<br />
<br />
===使用 awesome-client 给文本插件传递信息===<br />
<br />
只需要创建一个新的插件,就可以很容易的传递信息。<br />
{{bc|<nowiki><br />
mywidget = widget({ type = "textbox", name = "mywidget" })<br />
mywidget.text = "initial text"<br />
</nowiki>}}<br />
<br />
使用 awesome-client 从外部更新“initial text":<br />
<br />
{{bc|<nowiki> <br />
echo -e 'mywidget.text = "new text"' | awesome-client<br />
</nowiki>}}<br />
不要忘记把插件增加到 wibox.<br />
<br />
===使用其他任务栏===<br />
<br />
如果你喜欢 awesome 既轻量又强大的功能,但又不喜欢默认那个任务栏的外观, 你可以安装其他的.比如 xfce4-panel:<br />
{{bc|<br />
sudo pacman -S xfce4-panel<br />
}}<br />
<br />
当然,你可能有更好的选择.然后要把它添加到配置文件 rc.lua 的自动启动部分(该如何写请看wiki吧).你可以注释掉配置文件中给每个桌面创建 wiboxes 的那部分(开头是"mywibox[s] = awful.wibox({ position = "top", screen = s })"),因为已经不需要了. 检查配置文件没有错误之后就可以执行命令生效:<br />
{{bc|<br />
awesome -k rc.lua<br />
}}<br />
另外你还需要改变"modkey+R"的快捷键绑定, 比如用Xfrun4, bashrun等,来替代awesome自带的启动器. 请看这个[[Openbox_Themes_and_Apps#Application_launchers|Openbox]]文章中的启动器部分作为参考. 别忘了添加<br />
{{bc|<nowiki><br />
properties = { floating = true } },<br />
{ rule = { instance = "$yourapplicationlauncher" },<br />
</nowiki>}}<br />
到你 rc.lua 配置文件中<br />
<br />
===Fix Java (GUI appears gray only)===<br />
Guide taken from [https://bbs.archlinux.org/viewtopic.php?pid=450870].<br />
#Install {{Pkg|wmname}} from community<br />
#Run the following command or add it to your {{ic|.xinitrc}}: {{bc|wmname LG3D}}<br />
<br />
{{Note|<br />
If you use a non-reparenting window manager and Java 6, you should uncomment the corresponding line in {{Ic|/etc/profile.d/openjdk6.sh}}<br />
<br />
If you use a non-reparenting window manager and Java 7, you should uncomment the corresponding line in <br />
{{Ic|/etc/profile.d/jre.sh}} <br />
}}<br />
<br />
===Prevent Nautilus from displaying the desktop (Gnome3)===<br />
Run dconf-editor. Navigate to org->gnome->desktop->background and uncheck "draw-background" as well as "show-desktop-icons" for good measure. That's it!<br />
<br />
Another option is moving /usr/bin/nautilus to a new location and replacing it with a script that runs 'nautilus --no-desktop' passing any arguments it receives along.<br />
<br />
#!/bin/sh<br />
/usr/bin/nautilus-real --no-desktop $@<br />
<br />
===Transitioning away from Gnome3===<br />
Run 'gnome-session-properties' and remove programs that you won't be needing anymore (e.g Bluetooth Manager, Login Sounds, etc).<br />
<br />
If you'd like to get rid of GDM, make sure that your rc.conf DAEMONS list includes "dbus" (and "cupsd" if you have a printer). It's advisable to get a different login manager (like [https://wiki.archlinux.org/index.php/SLiM SLiM]), but you can do things manually if you wish. That entails setting up your [https://wiki.archlinux.org/index.php/Udev .xinitrc properly] and installing something like devmon ([https://aur.archlinux.org/packages.php?ID=45842 AUR]).<br />
<br />
If you wan't to keep a few convenient systray applets and your GTK theme, append this to your rc.lua;<br />
function start_daemon(dae)<br />
daeCheck = os.execute("ps -eF | grep -v grep | grep -w " .. dae)<br />
if (daeCheck ~= 0) then<br />
os.execute(dae .. " &")<br />
end<br />
end<br />
<br />
procs = {"gnome-settings-daemon", "nm-applet", "kupfer", "gnome-sound-applet", "gnome-power-manager"}<br />
for k = 1, #procs do<br />
start_daemon(procs[k])<br />
end<br />
<br />
===Prevent the mouse scroll wheel from changing tags===<br />
In your rc.lua, change the Mouse Bindings section to the following;<br />
-- {{{ Mouse bindings<br />
root.buttons(awful.util.table.join(<br />
awful.button({ }, 3, function () mymainmenu:toggle() end)))<br />
-- }}}<br />
<br />
==Troubleshooting==<br />
<br />
===LibreOffice===<br />
If you encounter UI problems with libreoffice install libreoffice-gnome.<br />
<br />
===Mod4 key===<br />
<br />
The Mod4 is by default the '''Win key'''. If it's not mapped by default, for some reason, you can check the keycode of your Mod4 key with<br />
<br />
$ xev<br />
<br />
It should be 115 for the left one. Then add this to your ~/.xinitrc<br />
<br />
xmodmap -e "keycode 115 = Super_L" -e "add mod4 = Super_L"<br />
exec awesome<br />
<br />
The problem in this case is that some xorg installations recognize keycode 115, but incorrectly as the 'Select' key. The above command explictly remaps keycode 115 to the correct 'Super_L' key.<br />
<br />
====Mod4 key vs. IBM ThinkPad users====<br />
<br />
IBM ThinkPads do not come equipped with a Window key (although Lenovo have changed this tradition on their ThinkPads). As of writing, the Alt key is not used in command combinations by the default rc.lua (refer to the Awesome wiki for a table of commands), which allows it be used as a replacement for the Super/Mod4/Win key. To do this, edit your rc.lua and replace:<br />
<br />
modkey = "Mod4"<br />
<br />
by:<br />
<br />
modkey = "Mod1"<br />
<br />
Note: Awesome does a have a few commands that make use of Mod4 plus a single letter. Changing Mod4 to Mod1/Alt could cause overlaps for some key combinations. The small amount of instances where this happens can be changed in the rc.lua file.<br />
<br />
If you do not like to change the awesome standards, you might like to remap a key. For instance the caps lock key is rather useless (for me) adding the following contents to ~/.Xmodmap <br />
<br />
clear lock <br />
add mod4 = Caps_Lock<br />
<br />
and [[Extra Keyboard Keys in Xorg#Step 2: Testing|(re)load]] the file.<br />
This will change the caps lock key into the mod4 key and works nicely with the standard awesome settings. In addition, if needed, it provides the mod4 key to other X-programs as well.<br />
<br />
Not confirmed, but if recent updates of xorg related packages break mentioned remapping the second line can be replaced by (tested on a DasKeyboard with no left Super key):<br />
<br />
keysym Caps_Lock = Super_L Caps_Lock<br />
<br />
===Eclipse: cannot resize/move main window===<br />
If you get stuck and cannot move or resize the main window (using mod4 + left/right mouse button) edit the workbench.xml and set fullscreen/maximized to false (if set) and reduce the width and height to numbers smaller than your single screen desktop area.<br />
{{Note|workbench.xml can be found in: <eclipse_workspace>/.metadata/.plugins/org.eclipse.ui.workbench/ and the line to edit is <window height&#61;"xx" maximized&#61;"true" width&#61;"xx" x&#61;"xx" y&#61;"xx">.}}<br />
<br />
===YouTube: fullscreen appears in background===<br />
[https://bbs.archlinux.org/viewtopic.php?pid=1085494#p1085494] If YouTube videos appear underneath your web browser when in fullscreen mode, add this to your rc.lua<br />
<br />
{ rule = { instance = "plugin-container" },<br />
properties = { floating = true } },<br />
<br />
With Chromium add<br />
<br />
{ rule = { instance = "exe" },<br />
properties = { floating = true } },<br />
<br />
===Starting console clients on specific tags===<br />
It does not work when the console application is invoked from a GTK terminal (e.g. LXTerminal). [[URxvt]] is known to work. <br />
<br />
===Redirecting console output to a file===<br />
Some GUI application are very verbose when launched from a terminal. As a consequence, when started from Awesome, they output everything to the TTY from where Awesome was started, which tend to get messy. To remove the garbage output, you have to redirect it. However, the {{ic|awful.util.spawn}} function does not handle pipes and redirections very well as stated in [http://awesome.naquadah.org/wiki/FAQ#How_to_execute_a_shell_command.3F the official FAQ].<br />
<br />
As example, let's redirect [[Luakit]] output to a temporary file:<br />
<br />
awful.key({ modkey, }, "w", function () awful.util.spawn_with_shell("luakit 2>>/tmp/luakit.log") end),<br />
<br />
==External Links==<br />
* http://awesome.naquadah.org/wiki/FAQ - FAQ<br />
* http://www.lua.org/pil/ - Programming in Lua (first edition)<br />
* http://awesome.naquadah.org/ - The official awesome website<br />
* http://awesome.naquadah.org/wiki/Main_Page - the awesome wiki<br />
* http://www.penguinsightings.org/desktop/awesome/ - A review<br />
* http://compsoc.tardis.ed.ac.uk/wiki/AwesomeWM_guide - Awesome guide<br />
* https://bbs.archlinux.org/viewtopic.php?id=88926 - share your awesome!</div>Yagnbhttps://wiki.archlinux.org/index.php?title=Awesome_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=280063Awesome (简体中文)2013-10-28T02:40:13Z<p>Yagnb: /* Space Invaders */</p>
<hr />
<div>[[Category:Dynamic WMs (简体中文)]]<br />
[[cs:Awesome]]<br />
[[en:Awesome]]<br />
[[es:Awesome]]<br />
[[fr:Awesome3]]<br />
[[it:Awesome]]<br />
[[ja:Awesome]]<br />
[[ru:Awesome]]<br />
{{Lowercase title}}<br />
{{translateme (简体中文)}}<br />
{{TranslationStatus (简体中文)|Awesome|2012-11-25|236478}}<br />
{{Article summary start|摘要}}<br />
{{Article summary text|关于安装、使用、配置和自定义 awesome 窗口管理器的指南。}}<br />
{{Article summary end}}<br />
<br />
来自[[Wikipedia:awesome (window manager)|awesome]]网站:<br />
<br />
''[http://awesome.naquadah.org/ Awesome] 是 XWindows 下可高度定制的新一代窗口管理器。运行快捷、扩展性强,遵循GPLv2发布。''<br />
<br />
''Awesome主要面向高级用户、开发者和那些希望完美控制自己电脑的图形界面的人。''<br />
<br />
==安装==<br />
<br />
[[pacman (简体中文)|安装]]位于[[Official Repositories (简体中文)|官方软件仓库]]的软件包 {{Pkg|awesome}}。<br />
<br />
如果你对不稳定的预览版本有兴趣,可以从 [[AUR]] 安装 {{aur|awesome-git}}。但是请注意,这是一个不稳定的开发版,配置文件会有语法差异。<br />
<br />
==使用Awesome==<br />
<br />
===不使用登陆管理器===<br />
<br />
不使用登录管理器来运行 awesome,只要添加 '''{{Ic|exec awesome}}'''到你的启动脚本(比如 ~/.xinitrc)。 详情参阅[[xinitrc]]<br />
<br />
你也可以甚至不用登陆直接使用预置用户启动Awesome,请参考[[Start X at Login]]<br />
<br />
=== 使用登陆管理器 ===<br />
要想用登陆管理器启动awesome,看[[Display Manager (简体中文)|这里]].<br />
<br />
==配置==<br />
Awesome默认的配置已经很不错了,不过你迟早会想要做一些修改的。配置文件是一个lua脚本:{{ic|~/.config/awesome/rc.lua}}.<br />
<br />
===创建配置文件===<br />
创建配置文件所在的文件夹<br />
$ mkdir -p ~/.config/awesome/<br />
<br />
Awesome会自动使用~/.config/awesome/rc.lua里的所有配置。这个文件并不会自动创建,所以我们先要从模板复制一个过来:<br />
$ cp /etc/xdg/awesome/rc.lua ~/.config/awesome<br />
<br />
配置文件的语法会随着Awesome的版本升级而变化,所以当你升级了之后遇到问题时,重复上面的步骤,或者你得手动修改配置文件。<br />
<br />
要获得关于配置Awesome的更多信息,请看[http://awesome.naquadah.org/wiki/Awesome_3_configuration Awesome wiki的配置部分]<br />
<br />
===更多的配置资源===<br />
{{注意|Awesome配置文件语法有时会变化,所以你可能得动手修改下载的配置文件。}}<br />
<br />
一些不错的rc.lua的例子可以在下面这些站点找到:<br />
<br />
* http://git.sysphere.org/awesome-configs/tree/ - Adrian C 的 Awesome 3.4 配置文件。 (anrxc)<br />
* http://pastebin.com/f6e4b064e - Darthlukan 的 Awesome 3.4 配置文件. <br />
* http://www.calmar.ws/dotfiles/dotfiledir/dot_awesomerc.lua<br />
* http://github.com/wolgri/wolgri.config/tree/master/.config/awesome/rc.lua<br />
* http://oxmoz.no-ip.org/awesome/rc.lua<br />
* http://www.ugolnik.info/downloads/awesome/rc.lua (screen) - 带有小型标题栏和状态栏的Awesome3配置文件。<br />
* http://github.com/bash/dotfiles/blob/master/.config/awesome/rc.lua<br />
* http://github.com/nblock/config/blob/master/.config/awesome/rc.lua<br />
* User Configuration Files http://awesome.naquadah.org/wiki/User_Configuration_Files<br />
<br />
===用 Xephyr 测试 rc.lua===<br />
<br />
用这种方式可以在不破坏现有桌面的情况下对rc.lua进行测试。首先把 rc.lua 复制到一个新文件rc.lua.new,接着进行修改。然后在Xephyr中运行新的rc.lua (Xephyr允许你在XWindow中植入一个新的XWindow - [http://www.dante4d.cz/pub/screenie/2009-08-01-025216_1920x1200_scrot.png screenshot])。 你可以这样测试你的新rc.lua<br />
<br />
$ Xephyr -ac -br -noreset -screen 1152x720 :1 &<br />
$ DISPLAY=:1.0 awesome -c ~/.config/awesome/rc.lua.new<br />
<br />
这种方式的巨大优势在于如果你弄坏了rc.lua.new,你不至于把现有的Awesome桌面弄得一团糟(并且很可能还会把XWindow弄崩溃了,没保存的工作全部丢失………)。一旦你觉得新的配置文件不错,就用rc.lua.new代替rc.lua,然后重启Awesome。<br />
<br />
目前(2011.07),还有一个工具{{aur|awmtt}}可以提供上述功能。<br />
<br />
==主题==<br />
<br />
[http://awesome.naquadah.org/wiki/Beautiful Beautiful]可以让你动态地改变背景图片和颜色主题,而不需要改变rc.lua文件。<br />
<br />
默认的主题文件是 /usr/share/awesome/themes/default。把它复制到 ~/.config/awesome/themes/default 然后修改一下 rc.lua中的theme_path。 <br />
beautiful.init(awful.util.getdir("config") .. "/themes/default/theme.lua")<br />
<br />
更多细节参考[http://awesome.naquadah.org/wiki/Beautiful 这里]<br />
<br />
一些样例:[http://awesome.naquadah.org/wiki/Beautiful_themes themes]<br />
<br />
===设置墙纸===<br />
<br />
Beautiful 可以设置墙纸,所以你就不用在.xinitrc 或者 .xsession 中自己设置了。Beautiful 允许你给每个主题配一个墙纸。如果你看一看默认的主题文件,可以找到一个 wallpaper_cmd 值。当beautiful.init("path_to_theme_file")运行的时候,给定的命令就会运行。如果不想要 Beautiful 修改你的墙纸,你可以在这里自己定义一个命令,或者把这个值注释掉。<br />
<br />
例如,如果你想用 awsetbg 设置墙纸,你可以这样写:<br />
<br />
theme.wallpaper_cmd = { "awsetbg -f .config/awesome/themes/awesome-wallpaper.png" }<br />
<br />
{{注意|要让Awsetbg工作,你需要有一个能设置背景图片的软件,比如"[[Feh]]"。}}<br />
<br />
====随机墙纸====<br />
想要随机切换墙纸,只需要注释掉 wallpaper_cmd 一行,然后使用下面的代码添加脚本到到你的 .xinitrc 文件中:<br />
{{bc|<br />
while true;<br />
do<br />
awsetbg -r <path/to/the/directory/of/your/wallpapers><br />
sleep 15m<br />
done &<br />
}}<br />
<br />
==小技巧==<br />
如果你有自己的小技巧想与大家分享,请随意添加。<br />
<br />
===使用awesome作为GNOME的窗口管理器===<br />
GNOME有“开包即用”的优势,你可以在使用GNOME的同时改用awesome作为窗口管理器。如果你在用GNOME 3的话,你可以安装{{AUR|awesome-gnome}}包,然后在用GDM登陆的时候选择"Awesome GNOME"。更多详细内容请参考[http://awesome.naquadah.org/wiki/Quickly_Setting_up_Awesome_with_Gnome awesome wiki]。<br />
<br />
===像compiz那样的平铺桌面效果===<br />
<br />
Revelation可以显示所有你开启的客户端;左键点击客户端会跳到该客户端所在的第一个标签并聚焦于该客户端。按下回车键会跳到当前聚焦的客户端,按下ESc键退出。更多内容请参考[http://awesome.naquadah.org/wiki/Revelation]。<br />
<br />
===在awesome 3中显示/隐藏wibox===<br />
<br />
要使用Modkey-b来在当前屏幕上隐藏/显示默认的状态栏 (Awesome 2.3中的默认行为),把下面代码加入rc.lua里的globalkeys变量:<br />
<br />
awful.key({ modkey }, "b", function ()<br />
mywibox[mouse.screen].visible = not mywibox[mouse.screen].visible<br />
end),<br />
<br />
===截图===<br />
<br />
在awesome中想要通过PrtScn按键来截图就必须借助其他截图工具. Arch软件仓库中,Scrot是个很简单就可以实现这些功能的截图工具.<br />
<br />
只需要输入:<br />
# pacman -S scrot<br />
<br />
如果optional dependencies中可选的包觉得有用,也可以安装.<br />
<br />
下一步,就是需要获得PrtScr按键的按键名, 如果不确定是什么,一般就是 "Print"了.<br />
<br />
终端里面输入命令:<br />
# xev<br />
<br />
然后按键盘上的PrtScr按键, 将会输出类似下面的结果:<br />
KeyPress event ....<br />
root 0x25c, subw 0x0, ...<br />
state 0x0, keycode 107 (keysym 0xff61, '''Print'''), same_screen YES,<br />
....<br />
<br />
我们判断没错,键名就是 "Print".<br />
<br />
接下来继续配置awesome!<br />
<br />
在配置文件中的全局数组(任意地方)中输入并保存:<br />
<br />
Lua 代码:<br />
<br />
awful.key({ }, "Print", function () awful.util.spawn("scrot -e 'mv $f ~/screenshots/ 2>/dev/null'") end),<br />
<br />
这里的 ~/screenshots/ 可以改成你截图想要保存的地方.<br />
<br />
===动态标签===<br />
<br />
[http://awesome.naquadah.org/wiki/Eminent Eminent]是一个小型的lua库,扩展了awful并提供了简单快速的wmii一样的动态标签功能。跟shifty不同, eminent无意提供全面详尽的标签系统,而是试图让动态标签越简单越好。实际上除了导入eminent库,你不用在rc.lua里改任何东西,eminent会把所有的事情帮你搞定。<br />
<br />
[http://awesome.naquadah.org/wiki/Shifty Shifty]是实现了动态标签的一个Awesome 3的扩展。它也实现了一个配置系统来让你设置几个变量和键位绑定就完全掌控你的桌面!<br />
<br />
===Space Invaders===<br />
[http://awesome.naquadah.org/wiki/Space_Invaders Space Invaders]是一个用来展现Awesome Lua API无限能力的演示。<br />
<br />
请注意它从3.4-rc1版以后就没有被包括进Awesome包里了。<br />
<br />
===Naughty for popup notification===<br />
See [http://awesome.naquadah.org/wiki/Naughty the awesome wiki page on naughty].<br />
<br />
===弹出菜单项===<br />
这是一份 awesome3 的默认简单菜单项, 看起来要自定义也十分容易. 然而,如果你在用awesome的 2.x 版本, 那么请看''[http://awesome.naquadah.org/wiki/Awful.menu awful.menu]''.<br />
<br />
如果你想要配置 freedesktop.org 的菜单项,就到 ''[https://github.com/terceiro/awesome-freedesktop awesome-freedesktop]'' .<br />
<br />
一个 awesome3 的菜单配置示例:<br />
{{bc|1=<br />
myawesomemenu = {<br />
{ "lock", "xscreensaver-command -activate" },<br />
{ "manual", terminal .. " -e man awesome" },<br />
{ "edit config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua" },<br />
{ "restart", awesome.restart },<br />
{ "quit", awesome.quit }<br />
}<br />
<br />
mycommons = {<br />
{ "pidgin", "pidgin" },<br />
{ "OpenOffice", "soffice-dev" },<br />
{ "Graphic", "gimp" }<br />
}<br />
<br />
mymainmenu = awful.menu.new({ items = { <br />
{ "terminal", terminal },<br />
{ "icecat", "icecat" },<br />
{ "Editor", "gvim" },<br />
{ "File Manager", "pcmanfm" },<br />
{ "VirtualBox", "VirtualBox" },<br />
{ "Common App", mycommons, beautiful.awesome_icon },<br />
{ "awesome", myawesomemenu, beautiful.awesome_icon }<br />
}<br />
})<br />
}}<br />
<br />
===More Widgets in awesome===<br />
''Widgets in awesome are objects that you can add to any widget-box (statusbars and titlebars), they can provide various information about your system, and are useful for having access to this information, right from your window manager. Widgets are simple to use and offer a great deal of flexibility.'' -- Source [http://awesome.naquadah.org/wiki/Widgets_in_awesome Awesome Wiki: Widgets].<br />
<br />
There's a widely used widget library called '''Wicked''' (compatible with awesome versions '''prior to 3.4'''), that provides more widgets, like MPD widget, CPU usage, memory usage, etc. For more details see the [http://awesome.naquadah.org/wiki/Wicked Wicked page].<br />
<br />
As a replacement for Wicked in awesome v3.4 check '''[http://awesome.naquadah.org/wiki/Vicious Vicious]''', '''[http://awesome.naquadah.org/wiki/Obvious Obvious]''' and '''[http://awesome.naquadah.org/wiki/Bashets Bashets]'''. If you pick vicious, you should also take a good look at [http://git.sysphere.org/vicious/tree/README vicious documentation].<br />
<br />
===Transparency===<br />
Awesome has support for true transparency through xcompmgr. Note that you'll probably want the git version of xcompmgr, which is [https://aur.archlinux.org/packages.php?ID=16554 available in AUR]. <br />
<br />
Add this to your ~/.xinitrc:<br />
xcompmgr &<br />
See ''man xcompmgr'' or [[xcompmgr]] for more options.<br />
<br />
In awesome 3.4, window transparency can be set dynamically using signals. For example, your rc.lua could contain the following:<br />
<br />
client.add_signal("focus", function(c)<br />
c.border_color = beautiful.border_focus<br />
c.opacity = 1<br />
end)<br />
client.add_signal("unfocus", function(c)<br />
c.border_color = beautiful.border_normal<br />
c.opacity = 0.7<br />
end)<br />
'''If you got error messages about add_signal, using connect_signal insteaded.''' <br />
<br />
Note that if you are using conky, you must set it to create its own window instead of using the desktop. To do so, edit ~/.conkyrc to contain:<br />
<br />
own_window yes<br />
own_window_transparent yes<br />
own_window_type desktop<br />
<br />
Otherwise strange behavior may be observed, such as all windows becoming fully transparent. Note also that since conky will be creating a transparent window on your desktop, any actions defined in awesome's rc.lua for the desktop will not work where conky is.<br />
<br />
As of Awesome 3.1, there is built-in pseudo-transparency for wiboxes. To enable it, append 2 hexadecimal digits to the colors in your theme file (~/.config/awesome/themes/default, which is usually a copy of /usr/share/awesome/themes/default), like shown here:<br />
<br />
bg_normal = #000000AA<br />
<br />
where "AA" is the transparency value.<br />
<br />
To change transparency for the actual selected window by pressing Modkey + PageUp/PageDown you can also use tansset-df available through the community package repository and the following modification to your rc.lua:<br />
<br />
globalkeys = awful.util.table.join(<br />
-- your keybindings<br />
[...]<br />
awful.key({ modkey }, "Next", function (c)<br />
awful.util.spawn("transset-df --actual --inc 0.1")<br />
end),<br />
awful.key({ modkey }, "Prior", function (c)<br />
awful.util.spawn("transset-df --actual --dec 0.1")<br />
end),<br />
-- Your other key bindings<br />
[...]<br />
)<br />
<br />
==== ImageMagick ====<br />
You may have problems if you set your wallpaper with imagemagick's ''display'' command, it doesn't work well with xcompmgr. Please note that awsetbg may be using ''display'' if it doesn't have any other options. Installing habak, feh, hsetroot or whatever should fix the problem (''grep -A 1 wpsetters /usr/bin/awsetbg'' to see your options).<br />
<br />
===Autorun programs===<br />
''See also [https://awesome.naquadah.org/wiki/Autostart the Autostart page on the Awesome wiki].''<br />
<br />
awesome doesn't run programs set to autostart by the Freedesktop specification like GNOME or KDE. However, awesome does provide a few functions for starting programs (in addition to the Lua standard library function {{Ic|os.execute}}). To run the same programs on startup as GNOME or KDE, you can install [https://aur.archlinux.org/packages.php?ID=41099 dex] from the [[AUR]] and then run that in your rc.lua:<br />
<br />
os.execute"dex -a -e Awesome"<br />
<br />
If you just want to set up a list of apps for awesome to launch at startup, you can create a table of all the commands you want to spawn and loop through it:<br />
<br />
do<br />
local cmds = <br />
{ <br />
"swiftfox",<br />
"mutt",<br />
"consonance",<br />
"linux-fetion",<br />
"weechat-curses",<br />
--and so on...<br />
}<br />
<br />
for _,i in pairs(cmds) do<br />
awful.util.spawn(i)<br />
end<br />
end<br />
<br />
(You could also run calls to {{Ic|os.execute}} with commands ending in '{{Ic|&}}', but it's probably a better idea to stick to the proper spawn function.)<br />
<br />
To run a program only if it is not currently running, you can spawn it with a shell command that runs the program only if {{Ic|pgrep}} doesn't find a running process with the same name:<br />
function run_once(prg)<br />
awful.util.spawn_with_shell("pgrep -u $USER -x " .. prg .. " || (" .. prg .. ")")<br />
end<br />
<br />
So, for example, to run {{Ic|parcellite}} only if there is not a {{Ic|parcellite}} process already running:<br />
<br />
run_once("parcellite")<br />
<br />
===使用 awesome-client 给文本插件传递信息===<br />
<br />
只需要创建一个新的插件,就可以很容易的传递信息。<br />
{{bc|<nowiki><br />
mywidget = widget({ type = "textbox", name = "mywidget" })<br />
mywidget.text = "initial text"<br />
</nowiki>}}<br />
<br />
使用 awesome-client 从外部更新“initial text":<br />
<br />
{{bc|<nowiki> <br />
echo -e 'mywidget.text = "new text"' | awesome-client<br />
</nowiki>}}<br />
不要忘记把插件增加到 wibox.<br />
<br />
===使用其他任务栏===<br />
<br />
如果你喜欢 awesome 既轻量又强大的功能,但又不喜欢默认那个任务栏的外观, 你可以安装其他的.比如 xfce4-panel:<br />
{{bc|<br />
sudo pacman -S xfce4-panel<br />
}}<br />
<br />
当然,你可能有更好的选择.然后要把它添加到配置文件 rc.lua 的自动启动部分(该如何写请看wiki吧).你可以注释掉配置文件中给每个桌面创建 wiboxes 的那部分(开头是"mywibox[s] = awful.wibox({ position = "top", screen = s })"),因为已经不需要了. 检查配置文件没有错误之后就可以执行命令生效:<br />
{{bc|<br />
awesome -k rc.lua<br />
}}<br />
另外你还需要改变"modkey+R"的快捷键绑定, 比如用Xfrun4, bashrun等,来替代awesome自带的启动器. 请看这个[[Openbox_Themes_and_Apps#Application_launchers|Openbox]]文章中的启动器部分作为参考. 别忘了添加<br />
{{bc|<nowiki><br />
properties = { floating = true } },<br />
{ rule = { instance = "$yourapplicationlauncher" },<br />
</nowiki>}}<br />
到你 rc.lua 配置文件中<br />
<br />
===Fix Java (GUI appears gray only)===<br />
Guide taken from [https://bbs.archlinux.org/viewtopic.php?pid=450870].<br />
#Install {{Pkg|wmname}} from community<br />
#Run the following command or add it to your {{ic|.xinitrc}}: {{bc|wmname LG3D}}<br />
<br />
{{Note|<br />
If you use a non-reparenting window manager and Java 6, you should uncomment the corresponding line in {{Ic|/etc/profile.d/openjdk6.sh}}<br />
<br />
If you use a non-reparenting window manager and Java 7, you should uncomment the corresponding line in <br />
{{Ic|/etc/profile.d/jre.sh}} <br />
}}<br />
<br />
===Prevent Nautilus from displaying the desktop (Gnome3)===<br />
Run dconf-editor. Navigate to org->gnome->desktop->background and uncheck "draw-background" as well as "show-desktop-icons" for good measure. That's it!<br />
<br />
Another option is moving /usr/bin/nautilus to a new location and replacing it with a script that runs 'nautilus --no-desktop' passing any arguments it receives along.<br />
<br />
#!/bin/sh<br />
/usr/bin/nautilus-real --no-desktop $@<br />
<br />
===Transitioning away from Gnome3===<br />
Run 'gnome-session-properties' and remove programs that you won't be needing anymore (e.g Bluetooth Manager, Login Sounds, etc).<br />
<br />
If you'd like to get rid of GDM, make sure that your rc.conf DAEMONS list includes "dbus" (and "cupsd" if you have a printer). It's advisable to get a different login manager (like [https://wiki.archlinux.org/index.php/SLiM SLiM]), but you can do things manually if you wish. That entails setting up your [https://wiki.archlinux.org/index.php/Udev .xinitrc properly] and installing something like devmon ([https://aur.archlinux.org/packages.php?ID=45842 AUR]).<br />
<br />
If you wan't to keep a few convenient systray applets and your GTK theme, append this to your rc.lua;<br />
function start_daemon(dae)<br />
daeCheck = os.execute("ps -eF | grep -v grep | grep -w " .. dae)<br />
if (daeCheck ~= 0) then<br />
os.execute(dae .. " &")<br />
end<br />
end<br />
<br />
procs = {"gnome-settings-daemon", "nm-applet", "kupfer", "gnome-sound-applet", "gnome-power-manager"}<br />
for k = 1, #procs do<br />
start_daemon(procs[k])<br />
end<br />
<br />
===Prevent the mouse scroll wheel from changing tags===<br />
In your rc.lua, change the Mouse Bindings section to the following;<br />
-- {{{ Mouse bindings<br />
root.buttons(awful.util.table.join(<br />
awful.button({ }, 3, function () mymainmenu:toggle() end)))<br />
-- }}}<br />
<br />
==Troubleshooting==<br />
<br />
===LibreOffice===<br />
If you encounter UI problems with libreoffice install libreoffice-gnome.<br />
<br />
===Mod4 key===<br />
<br />
The Mod4 is by default the '''Win key'''. If it's not mapped by default, for some reason, you can check the keycode of your Mod4 key with<br />
<br />
$ xev<br />
<br />
It should be 115 for the left one. Then add this to your ~/.xinitrc<br />
<br />
xmodmap -e "keycode 115 = Super_L" -e "add mod4 = Super_L"<br />
exec awesome<br />
<br />
The problem in this case is that some xorg installations recognize keycode 115, but incorrectly as the 'Select' key. The above command explictly remaps keycode 115 to the correct 'Super_L' key.<br />
<br />
====Mod4 key vs. IBM ThinkPad users====<br />
<br />
IBM ThinkPads do not come equipped with a Window key (although Lenovo have changed this tradition on their ThinkPads). As of writing, the Alt key is not used in command combinations by the default rc.lua (refer to the Awesome wiki for a table of commands), which allows it be used as a replacement for the Super/Mod4/Win key. To do this, edit your rc.lua and replace:<br />
<br />
modkey = "Mod4"<br />
<br />
by:<br />
<br />
modkey = "Mod1"<br />
<br />
Note: Awesome does a have a few commands that make use of Mod4 plus a single letter. Changing Mod4 to Mod1/Alt could cause overlaps for some key combinations. The small amount of instances where this happens can be changed in the rc.lua file.<br />
<br />
If you do not like to change the awesome standards, you might like to remap a key. For instance the caps lock key is rather useless (for me) adding the following contents to ~/.Xmodmap <br />
<br />
clear lock <br />
add mod4 = Caps_Lock<br />
<br />
and [[Extra Keyboard Keys in Xorg#Step 2: Testing|(re)load]] the file.<br />
This will change the caps lock key into the mod4 key and works nicely with the standard awesome settings. In addition, if needed, it provides the mod4 key to other X-programs as well.<br />
<br />
Not confirmed, but if recent updates of xorg related packages break mentioned remapping the second line can be replaced by (tested on a DasKeyboard with no left Super key):<br />
<br />
keysym Caps_Lock = Super_L Caps_Lock<br />
<br />
===Eclipse: cannot resize/move main window===<br />
If you get stuck and cannot move or resize the main window (using mod4 + left/right mouse button) edit the workbench.xml and set fullscreen/maximized to false (if set) and reduce the width and height to numbers smaller than your single screen desktop area.<br />
{{Note|workbench.xml can be found in: <eclipse_workspace>/.metadata/.plugins/org.eclipse.ui.workbench/ and the line to edit is <window height&#61;"xx" maximized&#61;"true" width&#61;"xx" x&#61;"xx" y&#61;"xx">.}}<br />
<br />
===YouTube: fullscreen appears in background===<br />
[https://bbs.archlinux.org/viewtopic.php?pid=1085494#p1085494] If YouTube videos appear underneath your web browser when in fullscreen mode, add this to your rc.lua<br />
<br />
{ rule = { instance = "plugin-container" },<br />
properties = { floating = true } },<br />
<br />
With Chromium add<br />
<br />
{ rule = { instance = "exe" },<br />
properties = { floating = true } },<br />
<br />
===Starting console clients on specific tags===<br />
It does not work when the console application is invoked from a GTK terminal (e.g. LXTerminal). [[URxvt]] is known to work. <br />
<br />
===Redirecting console output to a file===<br />
Some GUI application are very verbose when launched from a terminal. As a consequence, when started from Awesome, they output everything to the TTY from where Awesome was started, which tend to get messy. To remove the garbage output, you have to redirect it. However, the {{ic|awful.util.spawn}} function does not handle pipes and redirections very well as stated in [http://awesome.naquadah.org/wiki/FAQ#How_to_execute_a_shell_command.3F the official FAQ].<br />
<br />
As example, let's redirect [[Luakit]] output to a temporary file:<br />
<br />
awful.key({ modkey, }, "w", function () awful.util.spawn_with_shell("luakit 2>>/tmp/luakit.log") end),<br />
<br />
==External Links==<br />
* http://awesome.naquadah.org/wiki/FAQ - FAQ<br />
* http://www.lua.org/pil/ - Programming in Lua (first edition)<br />
* http://awesome.naquadah.org/ - The official awesome website<br />
* http://awesome.naquadah.org/wiki/Main_Page - the awesome wiki<br />
* http://www.penguinsightings.org/desktop/awesome/ - A review<br />
* http://compsoc.tardis.ed.ac.uk/wiki/AwesomeWM_guide - Awesome guide<br />
* https://bbs.archlinux.org/viewtopic.php?id=88926 - share your awesome!</div>Yagnbhttps://wiki.archlinux.org/index.php?title=Awesome_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=279983Awesome (简体中文)2013-10-27T07:09:41Z<p>Yagnb: 动态标签翻译</p>
<hr />
<div>[[Category:Dynamic WMs (简体中文)]]<br />
[[cs:Awesome]]<br />
[[en:Awesome]]<br />
[[es:Awesome]]<br />
[[fr:Awesome3]]<br />
[[it:Awesome]]<br />
[[ja:Awesome]]<br />
[[ru:Awesome]]<br />
{{Lowercase title}}<br />
{{translateme (简体中文)}}<br />
{{TranslationStatus (简体中文)|Awesome|2012-11-25|236478}}<br />
{{Article summary start|摘要}}<br />
{{Article summary text|关于安装、使用、配置和自定义 awesome 窗口管理器的指南。}}<br />
{{Article summary end}}<br />
<br />
来自[[Wikipedia:awesome (window manager)|awesome]]网站:<br />
<br />
''[http://awesome.naquadah.org/ Awesome] 是 XWindows 下可高度定制的新一代窗口管理器。运行快捷、扩展性强,遵循GPLv2发布。''<br />
<br />
''Awesome主要面向高级用户、开发者和那些希望完美控制自己电脑的图形界面的人。''<br />
<br />
==安装==<br />
<br />
[[pacman (简体中文)|安装]]位于[[Official Repositories (简体中文)|官方软件仓库]]的软件包 {{Pkg|awesome}}。<br />
<br />
如果你对不稳定的预览版本有兴趣,可以从 [[AUR]] 安装 {{aur|awesome-git}}。但是请注意,这是一个不稳定的开发版,配置文件会有语法差异。<br />
<br />
==使用Awesome==<br />
<br />
===不使用登陆管理器===<br />
<br />
不使用登录管理器来运行 awesome,只要添加 '''{{Ic|exec awesome}}'''到你的启动脚本(比如 ~/.xinitrc)。 详情参阅[[xinitrc]]<br />
<br />
你也可以甚至不用登陆直接使用预置用户启动Awesome,请参考[[Start X at Login]]<br />
<br />
=== 使用登陆管理器 ===<br />
要想用登陆管理器启动awesome,看[[Display Manager (简体中文)|这里]].<br />
<br />
==配置==<br />
Awesome默认的配置已经很不错了,不过你迟早会想要做一些修改的。配置文件是一个lua脚本:{{ic|~/.config/awesome/rc.lua}}.<br />
<br />
===创建配置文件===<br />
创建配置文件所在的文件夹<br />
$ mkdir -p ~/.config/awesome/<br />
<br />
Awesome会自动使用~/.config/awesome/rc.lua里的所有配置。这个文件并不会自动创建,所以我们先要从模板复制一个过来:<br />
$ cp /etc/xdg/awesome/rc.lua ~/.config/awesome<br />
<br />
配置文件的语法会随着Awesome的版本升级而变化,所以当你升级了之后遇到问题时,重复上面的步骤,或者你得手动修改配置文件。<br />
<br />
要获得关于配置Awesome的更多信息,请看[http://awesome.naquadah.org/wiki/Awesome_3_configuration Awesome wiki的配置部分]<br />
<br />
===更多的配置资源===<br />
{{注意|Awesome配置文件语法有时会变化,所以你可能得动手修改下载的配置文件。}}<br />
<br />
一些不错的rc.lua的例子可以在下面这些站点找到:<br />
<br />
* http://git.sysphere.org/awesome-configs/tree/ - Adrian C 的 Awesome 3.4 配置文件。 (anrxc)<br />
* http://pastebin.com/f6e4b064e - Darthlukan 的 Awesome 3.4 配置文件. <br />
* http://www.calmar.ws/dotfiles/dotfiledir/dot_awesomerc.lua<br />
* http://github.com/wolgri/wolgri.config/tree/master/.config/awesome/rc.lua<br />
* http://oxmoz.no-ip.org/awesome/rc.lua<br />
* http://www.ugolnik.info/downloads/awesome/rc.lua (screen) - 带有小型标题栏和状态栏的Awesome3配置文件。<br />
* http://github.com/bash/dotfiles/blob/master/.config/awesome/rc.lua<br />
* http://github.com/nblock/config/blob/master/.config/awesome/rc.lua<br />
* User Configuration Files http://awesome.naquadah.org/wiki/User_Configuration_Files<br />
<br />
===用 Xephyr 测试 rc.lua===<br />
<br />
用这种方式可以在不破坏现有桌面的情况下对rc.lua进行测试。首先把 rc.lua 复制到一个新文件rc.lua.new,接着进行修改。然后在Xephyr中运行新的rc.lua (Xephyr允许你在XWindow中植入一个新的XWindow - [http://www.dante4d.cz/pub/screenie/2009-08-01-025216_1920x1200_scrot.png screenshot])。 你可以这样测试你的新rc.lua<br />
<br />
$ Xephyr -ac -br -noreset -screen 1152x720 :1 &<br />
$ DISPLAY=:1.0 awesome -c ~/.config/awesome/rc.lua.new<br />
<br />
这种方式的巨大优势在于如果你弄坏了rc.lua.new,你不至于把现有的Awesome桌面弄得一团糟(并且很可能还会把XWindow弄崩溃了,没保存的工作全部丢失………)。一旦你觉得新的配置文件不错,就用rc.lua.new代替rc.lua,然后重启Awesome。<br />
<br />
目前(2011.07),还有一个工具{{aur|awmtt}}可以提供上述功能。<br />
<br />
==主题==<br />
<br />
[http://awesome.naquadah.org/wiki/Beautiful Beautiful]可以让你动态地改变背景图片和颜色主题,而不需要改变rc.lua文件。<br />
<br />
默认的主题文件是 /usr/share/awesome/themes/default。把它复制到 ~/.config/awesome/themes/default 然后修改一下 rc.lua中的theme_path。 <br />
beautiful.init(awful.util.getdir("config") .. "/themes/default/theme.lua")<br />
<br />
更多细节参考[http://awesome.naquadah.org/wiki/Beautiful 这里]<br />
<br />
一些样例:[http://awesome.naquadah.org/wiki/Beautiful_themes themes]<br />
<br />
===设置墙纸===<br />
<br />
Beautiful 可以设置墙纸,所以你就不用在.xinitrc 或者 .xsession 中自己设置了。Beautiful 允许你给每个主题配一个墙纸。如果你看一看默认的主题文件,可以找到一个 wallpaper_cmd 值。当beautiful.init("path_to_theme_file")运行的时候,给定的命令就会运行。如果不想要 Beautiful 修改你的墙纸,你可以在这里自己定义一个命令,或者把这个值注释掉。<br />
<br />
例如,如果你想用 awsetbg 设置墙纸,你可以这样写:<br />
<br />
theme.wallpaper_cmd = { "awsetbg -f .config/awesome/themes/awesome-wallpaper.png" }<br />
<br />
{{注意|要让Awsetbg工作,你需要有一个能设置背景图片的软件,比如"[[Feh]]"。}}<br />
<br />
====随机墙纸====<br />
想要随机切换墙纸,只需要注释掉 wallpaper_cmd 一行,然后使用下面的代码添加脚本到到你的 .xinitrc 文件中:<br />
{{bc|<br />
while true;<br />
do<br />
awsetbg -r <path/to/the/directory/of/your/wallpapers><br />
sleep 15m<br />
done &<br />
}}<br />
<br />
==小技巧==<br />
如果你有自己的小技巧想与大家分享,请随意添加。<br />
<br />
===使用awesome作为GNOME的窗口管理器===<br />
GNOME有“开包即用”的优势,你可以在使用GNOME的同时改用awesome作为窗口管理器。如果你在用GNOME 3的话,你可以安装{{AUR|awesome-gnome}}包,然后在用GDM登陆的时候选择"Awesome GNOME"。更多详细内容请参考[http://awesome.naquadah.org/wiki/Quickly_Setting_up_Awesome_with_Gnome awesome wiki]。<br />
<br />
===像compiz那样的平铺桌面效果===<br />
<br />
Revelation可以显示所有你开启的客户端;左键点击客户端会跳到该客户端所在的第一个标签并聚焦于该客户端。按下回车键会跳到当前聚焦的客户端,按下ESc键退出。更多内容请参考[http://awesome.naquadah.org/wiki/Revelation]。<br />
<br />
===在awesome 3中显示/隐藏wibox===<br />
<br />
要使用Modkey-b来在当前屏幕上隐藏/显示默认的状态栏 (Awesome 2.3中的默认行为),把下面代码加入rc.lua里的globalkeys变量:<br />
<br />
awful.key({ modkey }, "b", function ()<br />
mywibox[mouse.screen].visible = not mywibox[mouse.screen].visible<br />
end),<br />
<br />
===截图===<br />
<br />
在awesome中想要通过PrtScn按键来截图就必须借助其他截图工具. Arch软件仓库中,Scrot是个很简单就可以实现这些功能的截图工具.<br />
<br />
只需要输入:<br />
# pacman -S scrot<br />
<br />
如果optional dependencies中可选的包觉得有用,也可以安装.<br />
<br />
下一步,就是需要获得PrtScr按键的按键名, 如果不确定是什么,一般就是 "Print"了.<br />
<br />
终端里面输入命令:<br />
# xev<br />
<br />
然后按键盘上的PrtScr按键, 将会输出类似下面的结果:<br />
KeyPress event ....<br />
root 0x25c, subw 0x0, ...<br />
state 0x0, keycode 107 (keysym 0xff61, '''Print'''), same_screen YES,<br />
....<br />
<br />
我们判断没错,键名就是 "Print".<br />
<br />
接下来继续配置awesome!<br />
<br />
在配置文件中的全局数组(任意地方)中输入并保存:<br />
<br />
Lua 代码:<br />
<br />
awful.key({ }, "Print", function () awful.util.spawn("scrot -e 'mv $f ~/screenshots/ 2>/dev/null'") end),<br />
<br />
这里的 ~/screenshots/ 可以改成你截图想要保存的地方.<br />
<br />
===动态标签===<br />
<br />
[http://awesome.naquadah.org/wiki/Eminent Eminent]是一个小型的lua库,扩展了awful并提供了简单快速的wmii一样的动态标签功能。跟shifty不同, eminent无意提供全面详尽的标签系统,而是试图让动态标签越简单越好。实际上除了导入eminent库,你不用在rc.lua里改任何东西,eminent会把所有的事情帮你搞定。<br />
<br />
[http://awesome.naquadah.org/wiki/Shifty Shifty]是实现了动态标签的一个Awesome 3的扩展。它也实现了一个配置系统来让你设置几个变量和键位绑定就完全掌控你的桌面!<br />
<br />
===Space Invaders===<br />
[http://awesome.naquadah.org/wiki/Space_Invaders Space Invaders] is a demo to show the possibilities of the Awesome Lua API.<br />
<br />
Please note that it is no longer included in the Awesome package since the 3.4-rc1 release.<br />
<br />
===Naughty for popup notification===<br />
See [http://awesome.naquadah.org/wiki/Naughty the awesome wiki page on naughty].<br />
<br />
===弹出菜单项===<br />
这是一份 awesome3 的默认简单菜单项, 看起来要自定义也十分容易. 然而,如果你在用awesome的 2.x 版本, 那么请看''[http://awesome.naquadah.org/wiki/Awful.menu awful.menu]''.<br />
<br />
如果你想要配置 freedesktop.org 的菜单项,就到 ''[https://github.com/terceiro/awesome-freedesktop awesome-freedesktop]'' .<br />
<br />
一个 awesome3 的菜单配置示例:<br />
{{bc|1=<br />
myawesomemenu = {<br />
{ "lock", "xscreensaver-command -activate" },<br />
{ "manual", terminal .. " -e man awesome" },<br />
{ "edit config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua" },<br />
{ "restart", awesome.restart },<br />
{ "quit", awesome.quit }<br />
}<br />
<br />
mycommons = {<br />
{ "pidgin", "pidgin" },<br />
{ "OpenOffice", "soffice-dev" },<br />
{ "Graphic", "gimp" }<br />
}<br />
<br />
mymainmenu = awful.menu.new({ items = { <br />
{ "terminal", terminal },<br />
{ "icecat", "icecat" },<br />
{ "Editor", "gvim" },<br />
{ "File Manager", "pcmanfm" },<br />
{ "VirtualBox", "VirtualBox" },<br />
{ "Common App", mycommons, beautiful.awesome_icon },<br />
{ "awesome", myawesomemenu, beautiful.awesome_icon }<br />
}<br />
})<br />
}}<br />
<br />
===More Widgets in awesome===<br />
''Widgets in awesome are objects that you can add to any widget-box (statusbars and titlebars), they can provide various information about your system, and are useful for having access to this information, right from your window manager. Widgets are simple to use and offer a great deal of flexibility.'' -- Source [http://awesome.naquadah.org/wiki/Widgets_in_awesome Awesome Wiki: Widgets].<br />
<br />
There's a widely used widget library called '''Wicked''' (compatible with awesome versions '''prior to 3.4'''), that provides more widgets, like MPD widget, CPU usage, memory usage, etc. For more details see the [http://awesome.naquadah.org/wiki/Wicked Wicked page].<br />
<br />
As a replacement for Wicked in awesome v3.4 check '''[http://awesome.naquadah.org/wiki/Vicious Vicious]''', '''[http://awesome.naquadah.org/wiki/Obvious Obvious]''' and '''[http://awesome.naquadah.org/wiki/Bashets Bashets]'''. If you pick vicious, you should also take a good look at [http://git.sysphere.org/vicious/tree/README vicious documentation].<br />
<br />
===Transparency===<br />
Awesome has support for true transparency through xcompmgr. Note that you'll probably want the git version of xcompmgr, which is [https://aur.archlinux.org/packages.php?ID=16554 available in AUR]. <br />
<br />
Add this to your ~/.xinitrc:<br />
xcompmgr &<br />
See ''man xcompmgr'' or [[xcompmgr]] for more options.<br />
<br />
In awesome 3.4, window transparency can be set dynamically using signals. For example, your rc.lua could contain the following:<br />
<br />
client.add_signal("focus", function(c)<br />
c.border_color = beautiful.border_focus<br />
c.opacity = 1<br />
end)<br />
client.add_signal("unfocus", function(c)<br />
c.border_color = beautiful.border_normal<br />
c.opacity = 0.7<br />
end)<br />
'''If you got error messages about add_signal, using connect_signal insteaded.''' <br />
<br />
Note that if you are using conky, you must set it to create its own window instead of using the desktop. To do so, edit ~/.conkyrc to contain:<br />
<br />
own_window yes<br />
own_window_transparent yes<br />
own_window_type desktop<br />
<br />
Otherwise strange behavior may be observed, such as all windows becoming fully transparent. Note also that since conky will be creating a transparent window on your desktop, any actions defined in awesome's rc.lua for the desktop will not work where conky is.<br />
<br />
As of Awesome 3.1, there is built-in pseudo-transparency for wiboxes. To enable it, append 2 hexadecimal digits to the colors in your theme file (~/.config/awesome/themes/default, which is usually a copy of /usr/share/awesome/themes/default), like shown here:<br />
<br />
bg_normal = #000000AA<br />
<br />
where "AA" is the transparency value.<br />
<br />
To change transparency for the actual selected window by pressing Modkey + PageUp/PageDown you can also use tansset-df available through the community package repository and the following modification to your rc.lua:<br />
<br />
globalkeys = awful.util.table.join(<br />
-- your keybindings<br />
[...]<br />
awful.key({ modkey }, "Next", function (c)<br />
awful.util.spawn("transset-df --actual --inc 0.1")<br />
end),<br />
awful.key({ modkey }, "Prior", function (c)<br />
awful.util.spawn("transset-df --actual --dec 0.1")<br />
end),<br />
-- Your other key bindings<br />
[...]<br />
)<br />
<br />
==== ImageMagick ====<br />
You may have problems if you set your wallpaper with imagemagick's ''display'' command, it doesn't work well with xcompmgr. Please note that awsetbg may be using ''display'' if it doesn't have any other options. Installing habak, feh, hsetroot or whatever should fix the problem (''grep -A 1 wpsetters /usr/bin/awsetbg'' to see your options).<br />
<br />
===Autorun programs===<br />
''See also [https://awesome.naquadah.org/wiki/Autostart the Autostart page on the Awesome wiki].''<br />
<br />
awesome doesn't run programs set to autostart by the Freedesktop specification like GNOME or KDE. However, awesome does provide a few functions for starting programs (in addition to the Lua standard library function {{Ic|os.execute}}). To run the same programs on startup as GNOME or KDE, you can install [https://aur.archlinux.org/packages.php?ID=41099 dex] from the [[AUR]] and then run that in your rc.lua:<br />
<br />
os.execute"dex -a -e Awesome"<br />
<br />
If you just want to set up a list of apps for awesome to launch at startup, you can create a table of all the commands you want to spawn and loop through it:<br />
<br />
do<br />
local cmds = <br />
{ <br />
"swiftfox",<br />
"mutt",<br />
"consonance",<br />
"linux-fetion",<br />
"weechat-curses",<br />
--and so on...<br />
}<br />
<br />
for _,i in pairs(cmds) do<br />
awful.util.spawn(i)<br />
end<br />
end<br />
<br />
(You could also run calls to {{Ic|os.execute}} with commands ending in '{{Ic|&}}', but it's probably a better idea to stick to the proper spawn function.)<br />
<br />
To run a program only if it is not currently running, you can spawn it with a shell command that runs the program only if {{Ic|pgrep}} doesn't find a running process with the same name:<br />
function run_once(prg)<br />
awful.util.spawn_with_shell("pgrep -u $USER -x " .. prg .. " || (" .. prg .. ")")<br />
end<br />
<br />
So, for example, to run {{Ic|parcellite}} only if there is not a {{Ic|parcellite}} process already running:<br />
<br />
run_once("parcellite")<br />
<br />
===使用 awesome-client 给文本插件传递信息===<br />
<br />
只需要创建一个新的插件,就可以很容易的传递信息。<br />
{{bc|<nowiki><br />
mywidget = widget({ type = "textbox", name = "mywidget" })<br />
mywidget.text = "initial text"<br />
</nowiki>}}<br />
<br />
使用 awesome-client 从外部更新“initial text":<br />
<br />
{{bc|<nowiki> <br />
echo -e 'mywidget.text = "new text"' | awesome-client<br />
</nowiki>}}<br />
不要忘记把插件增加到 wibox.<br />
<br />
===使用其他任务栏===<br />
<br />
如果你喜欢 awesome 既轻量又强大的功能,但又不喜欢默认那个任务栏的外观, 你可以安装其他的.比如 xfce4-panel:<br />
{{bc|<br />
sudo pacman -S xfce4-panel<br />
}}<br />
<br />
当然,你可能有更好的选择.然后要把它添加到配置文件 rc.lua 的自动启动部分(该如何写请看wiki吧).你可以注释掉配置文件中给每个桌面创建 wiboxes 的那部分(开头是"mywibox[s] = awful.wibox({ position = "top", screen = s })"),因为已经不需要了. 检查配置文件没有错误之后就可以执行命令生效:<br />
{{bc|<br />
awesome -k rc.lua<br />
}}<br />
另外你还需要改变"modkey+R"的快捷键绑定, 比如用Xfrun4, bashrun等,来替代awesome自带的启动器. 请看这个[[Openbox_Themes_and_Apps#Application_launchers|Openbox]]文章中的启动器部分作为参考. 别忘了添加<br />
{{bc|<nowiki><br />
properties = { floating = true } },<br />
{ rule = { instance = "$yourapplicationlauncher" },<br />
</nowiki>}}<br />
到你 rc.lua 配置文件中<br />
<br />
===Fix Java (GUI appears gray only)===<br />
Guide taken from [https://bbs.archlinux.org/viewtopic.php?pid=450870].<br />
#Install {{Pkg|wmname}} from community<br />
#Run the following command or add it to your {{ic|.xinitrc}}: {{bc|wmname LG3D}}<br />
<br />
{{Note|<br />
If you use a non-reparenting window manager and Java 6, you should uncomment the corresponding line in {{Ic|/etc/profile.d/openjdk6.sh}}<br />
<br />
If you use a non-reparenting window manager and Java 7, you should uncomment the corresponding line in <br />
{{Ic|/etc/profile.d/jre.sh}} <br />
}}<br />
<br />
===Prevent Nautilus from displaying the desktop (Gnome3)===<br />
Run dconf-editor. Navigate to org->gnome->desktop->background and uncheck "draw-background" as well as "show-desktop-icons" for good measure. That's it!<br />
<br />
Another option is moving /usr/bin/nautilus to a new location and replacing it with a script that runs 'nautilus --no-desktop' passing any arguments it receives along.<br />
<br />
#!/bin/sh<br />
/usr/bin/nautilus-real --no-desktop $@<br />
<br />
===Transitioning away from Gnome3===<br />
Run 'gnome-session-properties' and remove programs that you won't be needing anymore (e.g Bluetooth Manager, Login Sounds, etc).<br />
<br />
If you'd like to get rid of GDM, make sure that your rc.conf DAEMONS list includes "dbus" (and "cupsd" if you have a printer). It's advisable to get a different login manager (like [https://wiki.archlinux.org/index.php/SLiM SLiM]), but you can do things manually if you wish. That entails setting up your [https://wiki.archlinux.org/index.php/Udev .xinitrc properly] and installing something like devmon ([https://aur.archlinux.org/packages.php?ID=45842 AUR]).<br />
<br />
If you wan't to keep a few convenient systray applets and your GTK theme, append this to your rc.lua;<br />
function start_daemon(dae)<br />
daeCheck = os.execute("ps -eF | grep -v grep | grep -w " .. dae)<br />
if (daeCheck ~= 0) then<br />
os.execute(dae .. " &")<br />
end<br />
end<br />
<br />
procs = {"gnome-settings-daemon", "nm-applet", "kupfer", "gnome-sound-applet", "gnome-power-manager"}<br />
for k = 1, #procs do<br />
start_daemon(procs[k])<br />
end<br />
<br />
===Prevent the mouse scroll wheel from changing tags===<br />
In your rc.lua, change the Mouse Bindings section to the following;<br />
-- {{{ Mouse bindings<br />
root.buttons(awful.util.table.join(<br />
awful.button({ }, 3, function () mymainmenu:toggle() end)))<br />
-- }}}<br />
<br />
==Troubleshooting==<br />
<br />
===LibreOffice===<br />
If you encounter UI problems with libreoffice install libreoffice-gnome.<br />
<br />
===Mod4 key===<br />
<br />
The Mod4 is by default the '''Win key'''. If it's not mapped by default, for some reason, you can check the keycode of your Mod4 key with<br />
<br />
$ xev<br />
<br />
It should be 115 for the left one. Then add this to your ~/.xinitrc<br />
<br />
xmodmap -e "keycode 115 = Super_L" -e "add mod4 = Super_L"<br />
exec awesome<br />
<br />
The problem in this case is that some xorg installations recognize keycode 115, but incorrectly as the 'Select' key. The above command explictly remaps keycode 115 to the correct 'Super_L' key.<br />
<br />
====Mod4 key vs. IBM ThinkPad users====<br />
<br />
IBM ThinkPads do not come equipped with a Window key (although Lenovo have changed this tradition on their ThinkPads). As of writing, the Alt key is not used in command combinations by the default rc.lua (refer to the Awesome wiki for a table of commands), which allows it be used as a replacement for the Super/Mod4/Win key. To do this, edit your rc.lua and replace:<br />
<br />
modkey = "Mod4"<br />
<br />
by:<br />
<br />
modkey = "Mod1"<br />
<br />
Note: Awesome does a have a few commands that make use of Mod4 plus a single letter. Changing Mod4 to Mod1/Alt could cause overlaps for some key combinations. The small amount of instances where this happens can be changed in the rc.lua file.<br />
<br />
If you do not like to change the awesome standards, you might like to remap a key. For instance the caps lock key is rather useless (for me) adding the following contents to ~/.Xmodmap <br />
<br />
clear lock <br />
add mod4 = Caps_Lock<br />
<br />
and [[Extra Keyboard Keys in Xorg#Step 2: Testing|(re)load]] the file.<br />
This will change the caps lock key into the mod4 key and works nicely with the standard awesome settings. In addition, if needed, it provides the mod4 key to other X-programs as well.<br />
<br />
Not confirmed, but if recent updates of xorg related packages break mentioned remapping the second line can be replaced by (tested on a DasKeyboard with no left Super key):<br />
<br />
keysym Caps_Lock = Super_L Caps_Lock<br />
<br />
===Eclipse: cannot resize/move main window===<br />
If you get stuck and cannot move or resize the main window (using mod4 + left/right mouse button) edit the workbench.xml and set fullscreen/maximized to false (if set) and reduce the width and height to numbers smaller than your single screen desktop area.<br />
{{Note|workbench.xml can be found in: <eclipse_workspace>/.metadata/.plugins/org.eclipse.ui.workbench/ and the line to edit is <window height&#61;"xx" maximized&#61;"true" width&#61;"xx" x&#61;"xx" y&#61;"xx">.}}<br />
<br />
===YouTube: fullscreen appears in background===<br />
[https://bbs.archlinux.org/viewtopic.php?pid=1085494#p1085494] If YouTube videos appear underneath your web browser when in fullscreen mode, add this to your rc.lua<br />
<br />
{ rule = { instance = "plugin-container" },<br />
properties = { floating = true } },<br />
<br />
With Chromium add<br />
<br />
{ rule = { instance = "exe" },<br />
properties = { floating = true } },<br />
<br />
===Starting console clients on specific tags===<br />
It does not work when the console application is invoked from a GTK terminal (e.g. LXTerminal). [[URxvt]] is known to work. <br />
<br />
===Redirecting console output to a file===<br />
Some GUI application are very verbose when launched from a terminal. As a consequence, when started from Awesome, they output everything to the TTY from where Awesome was started, which tend to get messy. To remove the garbage output, you have to redirect it. However, the {{ic|awful.util.spawn}} function does not handle pipes and redirections very well as stated in [http://awesome.naquadah.org/wiki/FAQ#How_to_execute_a_shell_command.3F the official FAQ].<br />
<br />
As example, let's redirect [[Luakit]] output to a temporary file:<br />
<br />
awful.key({ modkey, }, "w", function () awful.util.spawn_with_shell("luakit 2>>/tmp/luakit.log") end),<br />
<br />
==External Links==<br />
* http://awesome.naquadah.org/wiki/FAQ - FAQ<br />
* http://www.lua.org/pil/ - Programming in Lua (first edition)<br />
* http://awesome.naquadah.org/ - The official awesome website<br />
* http://awesome.naquadah.org/wiki/Main_Page - the awesome wiki<br />
* http://www.penguinsightings.org/desktop/awesome/ - A review<br />
* http://compsoc.tardis.ed.ac.uk/wiki/AwesomeWM_guide - Awesome guide<br />
* https://bbs.archlinux.org/viewtopic.php?id=88926 - share your awesome!</div>Yagnbhttps://wiki.archlinux.org/index.php?title=Awesome_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=279979Awesome (简体中文)2013-10-27T06:42:16Z<p>Yagnb: /* 在awesome 3中显示/隐藏wibox */</p>
<hr />
<div>[[Category:Dynamic WMs (简体中文)]]<br />
[[cs:Awesome]]<br />
[[en:Awesome]]<br />
[[es:Awesome]]<br />
[[fr:Awesome3]]<br />
[[it:Awesome]]<br />
[[ja:Awesome]]<br />
[[ru:Awesome]]<br />
{{Lowercase title}}<br />
{{translateme (简体中文)}}<br />
{{TranslationStatus (简体中文)|Awesome|2012-11-25|236478}}<br />
{{Article summary start|摘要}}<br />
{{Article summary text|关于安装、使用、配置和自定义 awesome 窗口管理器的指南。}}<br />
{{Article summary end}}<br />
<br />
来自[[Wikipedia:awesome (window manager)|awesome]]网站:<br />
<br />
''[http://awesome.naquadah.org/ Awesome] 是 XWindows 下可高度定制的新一代窗口管理器。运行快捷、扩展性强,遵循GPLv2发布。''<br />
<br />
''Awesome主要面向高级用户、开发者和那些希望完美控制自己电脑的图形界面的人。''<br />
<br />
==安装==<br />
<br />
[[pacman (简体中文)|安装]]位于[[Official Repositories (简体中文)|官方软件仓库]]的软件包 {{Pkg|awesome}}。<br />
<br />
如果你对不稳定的预览版本有兴趣,可以从 [[AUR]] 安装 {{aur|awesome-git}}。但是请注意,这是一个不稳定的开发版,配置文件会有语法差异。<br />
<br />
==使用Awesome==<br />
<br />
===不使用登陆管理器===<br />
<br />
不使用登录管理器来运行 awesome,只要添加 '''{{Ic|exec awesome}}'''到你的启动脚本(比如 ~/.xinitrc)。 详情参阅[[xinitrc]]<br />
<br />
你也可以甚至不用登陆直接使用预置用户启动Awesome,请参考[[Start X at Login]]<br />
<br />
=== 使用登陆管理器 ===<br />
要想用登陆管理器启动awesome,看[[Display Manager (简体中文)|这里]].<br />
<br />
==配置==<br />
Awesome默认的配置已经很不错了,不过你迟早会想要做一些修改的。配置文件是一个lua脚本:{{ic|~/.config/awesome/rc.lua}}.<br />
<br />
===创建配置文件===<br />
创建配置文件所在的文件夹<br />
$ mkdir -p ~/.config/awesome/<br />
<br />
Awesome会自动使用~/.config/awesome/rc.lua里的所有配置。这个文件并不会自动创建,所以我们先要从模板复制一个过来:<br />
$ cp /etc/xdg/awesome/rc.lua ~/.config/awesome<br />
<br />
配置文件的语法会随着Awesome的版本升级而变化,所以当你升级了之后遇到问题时,重复上面的步骤,或者你得手动修改配置文件。<br />
<br />
要获得关于配置Awesome的更多信息,请看[http://awesome.naquadah.org/wiki/Awesome_3_configuration Awesome wiki的配置部分]<br />
<br />
===更多的配置资源===<br />
{{注意|Awesome配置文件语法有时会变化,所以你可能得动手修改下载的配置文件。}}<br />
<br />
一些不错的rc.lua的例子可以在下面这些站点找到:<br />
<br />
* http://git.sysphere.org/awesome-configs/tree/ - Adrian C 的 Awesome 3.4 配置文件。 (anrxc)<br />
* http://pastebin.com/f6e4b064e - Darthlukan 的 Awesome 3.4 配置文件. <br />
* http://www.calmar.ws/dotfiles/dotfiledir/dot_awesomerc.lua<br />
* http://github.com/wolgri/wolgri.config/tree/master/.config/awesome/rc.lua<br />
* http://oxmoz.no-ip.org/awesome/rc.lua<br />
* http://www.ugolnik.info/downloads/awesome/rc.lua (screen) - 带有小型标题栏和状态栏的Awesome3配置文件。<br />
* http://github.com/bash/dotfiles/blob/master/.config/awesome/rc.lua<br />
* http://github.com/nblock/config/blob/master/.config/awesome/rc.lua<br />
* User Configuration Files http://awesome.naquadah.org/wiki/User_Configuration_Files<br />
<br />
===用 Xephyr 测试 rc.lua===<br />
<br />
用这种方式可以在不破坏现有桌面的情况下对rc.lua进行测试。首先把 rc.lua 复制到一个新文件rc.lua.new,接着进行修改。然后在Xephyr中运行新的rc.lua (Xephyr允许你在XWindow中植入一个新的XWindow - [http://www.dante4d.cz/pub/screenie/2009-08-01-025216_1920x1200_scrot.png screenshot])。 你可以这样测试你的新rc.lua<br />
<br />
$ Xephyr -ac -br -noreset -screen 1152x720 :1 &<br />
$ DISPLAY=:1.0 awesome -c ~/.config/awesome/rc.lua.new<br />
<br />
这种方式的巨大优势在于如果你弄坏了rc.lua.new,你不至于把现有的Awesome桌面弄得一团糟(并且很可能还会把XWindow弄崩溃了,没保存的工作全部丢失………)。一旦你觉得新的配置文件不错,就用rc.lua.new代替rc.lua,然后重启Awesome。<br />
<br />
目前(2011.07),还有一个工具{{aur|awmtt}}可以提供上述功能。<br />
<br />
==主题==<br />
<br />
[http://awesome.naquadah.org/wiki/Beautiful Beautiful]可以让你动态地改变背景图片和颜色主题,而不需要改变rc.lua文件。<br />
<br />
默认的主题文件是 /usr/share/awesome/themes/default。把它复制到 ~/.config/awesome/themes/default 然后修改一下 rc.lua中的theme_path。 <br />
beautiful.init(awful.util.getdir("config") .. "/themes/default/theme.lua")<br />
<br />
更多细节参考[http://awesome.naquadah.org/wiki/Beautiful 这里]<br />
<br />
一些样例:[http://awesome.naquadah.org/wiki/Beautiful_themes themes]<br />
<br />
===设置墙纸===<br />
<br />
Beautiful 可以设置墙纸,所以你就不用在.xinitrc 或者 .xsession 中自己设置了。Beautiful 允许你给每个主题配一个墙纸。如果你看一看默认的主题文件,可以找到一个 wallpaper_cmd 值。当beautiful.init("path_to_theme_file")运行的时候,给定的命令就会运行。如果不想要 Beautiful 修改你的墙纸,你可以在这里自己定义一个命令,或者把这个值注释掉。<br />
<br />
例如,如果你想用 awsetbg 设置墙纸,你可以这样写:<br />
<br />
theme.wallpaper_cmd = { "awsetbg -f .config/awesome/themes/awesome-wallpaper.png" }<br />
<br />
{{注意|要让Awsetbg工作,你需要有一个能设置背景图片的软件,比如"[[Feh]]"。}}<br />
<br />
====随机墙纸====<br />
想要随机切换墙纸,只需要注释掉 wallpaper_cmd 一行,然后使用下面的代码添加脚本到到你的 .xinitrc 文件中:<br />
{{bc|<br />
while true;<br />
do<br />
awsetbg -r <path/to/the/directory/of/your/wallpapers><br />
sleep 15m<br />
done &<br />
}}<br />
<br />
==小技巧==<br />
如果你有自己的小技巧想与大家分享,请随意添加。<br />
<br />
===使用awesome作为GNOME的窗口管理器===<br />
GNOME有“开包即用”的优势,你可以在使用GNOME的同时改用awesome作为窗口管理器。如果你在用GNOME 3的话,你可以安装{{AUR|awesome-gnome}}包,然后在用GDM登陆的时候选择"Awesome GNOME"。更多详细内容请参考[http://awesome.naquadah.org/wiki/Quickly_Setting_up_Awesome_with_Gnome awesome wiki]。<br />
<br />
===像compiz那样的平铺桌面效果===<br />
<br />
Revelation可以显示所有你开启的客户端;左键点击客户端会跳到该客户端所在的第一个标签并聚焦于该客户端。按下回车键会跳到当前聚焦的客户端,按下ESc键退出。更多内容请参考[http://awesome.naquadah.org/wiki/Revelation]。<br />
<br />
===在awesome 3中显示/隐藏wibox===<br />
<br />
要使用Modkey-b来在当前屏幕上隐藏/显示默认的状态栏 (Awesome 2.3中的默认行为),把下面代码加入rc.lua里的globalkeys变量:<br />
<br />
awful.key({ modkey }, "b", function ()<br />
mywibox[mouse.screen].visible = not mywibox[mouse.screen].visible<br />
end),<br />
<br />
===截图===<br />
<br />
在awesome中想要通过PrtScn按键来截图就必须借助其他截图工具. Arch软件仓库中,Scrot是个很简单就可以实现这些功能的截图工具.<br />
<br />
只需要输入:<br />
# pacman -S scrot<br />
<br />
如果optional dependencies中可选的包觉得有用,也可以安装.<br />
<br />
下一步,就是需要获得PrtScr按键的按键名, 如果不确定是什么,一般就是 "Print"了.<br />
<br />
终端里面输入命令:<br />
# xev<br />
<br />
然后按键盘上的PrtScr按键, 将会输出类似下面的结果:<br />
KeyPress event ....<br />
root 0x25c, subw 0x0, ...<br />
state 0x0, keycode 107 (keysym 0xff61, '''Print'''), same_screen YES,<br />
....<br />
<br />
我们判断没错,键名就是 "Print".<br />
<br />
接下来继续配置awesome!<br />
<br />
在配置文件中的全局数组(任意地方)中输入并保存:<br />
<br />
Lua 代码:<br />
<br />
awful.key({ }, "Print", function () awful.util.spawn("scrot -e 'mv $f ~/screenshots/ 2>/dev/null'") end),<br />
<br />
这里的 ~/screenshots/ 可以改成你截图想要保存的地方.<br />
<br />
===Dynamic tagging===<br />
<br />
[http://awesome.naquadah.org/wiki/Eminent Eminent] is a small lua library that monkey-patches awful to provide you with effortless and quick wmii-style dynamic tagging. Unlike shifty, eminent does not aim to provide a comprehensive tagging system, but tries to make dynamic tagging as simple as possible. In fact, besides importing the eminent library, you do not have to change your rc.lua at all, eminent does all the work for you.<br />
<br />
[http://awesome.naquadah.org/wiki/Shifty Shifty] is an Awesome 3 extension that implements dynamic tagging. It also implements fine client matching configuration allowing YOU to be the master of YOUR desktop only by setting two simple config variables and some keybindings!<br />
<br />
===Space Invaders===<br />
[http://awesome.naquadah.org/wiki/Space_Invaders Space Invaders] is a demo to show the possibilities of the Awesome Lua API.<br />
<br />
Please note that it is no longer included in the Awesome package since the 3.4-rc1 release.<br />
<br />
===Naughty for popup notification===<br />
See [http://awesome.naquadah.org/wiki/Naughty the awesome wiki page on naughty].<br />
<br />
===弹出菜单项===<br />
这是一份 awesome3 的默认简单菜单项, 看起来要自定义也十分容易. 然而,如果你在用awesome的 2.x 版本, 那么请看''[http://awesome.naquadah.org/wiki/Awful.menu awful.menu]''.<br />
<br />
如果你想要配置 freedesktop.org 的菜单项,就到 ''[https://github.com/terceiro/awesome-freedesktop awesome-freedesktop]'' .<br />
<br />
一个 awesome3 的菜单配置示例:<br />
{{bc|1=<br />
myawesomemenu = {<br />
{ "lock", "xscreensaver-command -activate" },<br />
{ "manual", terminal .. " -e man awesome" },<br />
{ "edit config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua" },<br />
{ "restart", awesome.restart },<br />
{ "quit", awesome.quit }<br />
}<br />
<br />
mycommons = {<br />
{ "pidgin", "pidgin" },<br />
{ "OpenOffice", "soffice-dev" },<br />
{ "Graphic", "gimp" }<br />
}<br />
<br />
mymainmenu = awful.menu.new({ items = { <br />
{ "terminal", terminal },<br />
{ "icecat", "icecat" },<br />
{ "Editor", "gvim" },<br />
{ "File Manager", "pcmanfm" },<br />
{ "VirtualBox", "VirtualBox" },<br />
{ "Common App", mycommons, beautiful.awesome_icon },<br />
{ "awesome", myawesomemenu, beautiful.awesome_icon }<br />
}<br />
})<br />
}}<br />
<br />
===More Widgets in awesome===<br />
''Widgets in awesome are objects that you can add to any widget-box (statusbars and titlebars), they can provide various information about your system, and are useful for having access to this information, right from your window manager. Widgets are simple to use and offer a great deal of flexibility.'' -- Source [http://awesome.naquadah.org/wiki/Widgets_in_awesome Awesome Wiki: Widgets].<br />
<br />
There's a widely used widget library called '''Wicked''' (compatible with awesome versions '''prior to 3.4'''), that provides more widgets, like MPD widget, CPU usage, memory usage, etc. For more details see the [http://awesome.naquadah.org/wiki/Wicked Wicked page].<br />
<br />
As a replacement for Wicked in awesome v3.4 check '''[http://awesome.naquadah.org/wiki/Vicious Vicious]''', '''[http://awesome.naquadah.org/wiki/Obvious Obvious]''' and '''[http://awesome.naquadah.org/wiki/Bashets Bashets]'''. If you pick vicious, you should also take a good look at [http://git.sysphere.org/vicious/tree/README vicious documentation].<br />
<br />
===Transparency===<br />
Awesome has support for true transparency through xcompmgr. Note that you'll probably want the git version of xcompmgr, which is [https://aur.archlinux.org/packages.php?ID=16554 available in AUR]. <br />
<br />
Add this to your ~/.xinitrc:<br />
xcompmgr &<br />
See ''man xcompmgr'' or [[xcompmgr]] for more options.<br />
<br />
In awesome 3.4, window transparency can be set dynamically using signals. For example, your rc.lua could contain the following:<br />
<br />
client.add_signal("focus", function(c)<br />
c.border_color = beautiful.border_focus<br />
c.opacity = 1<br />
end)<br />
client.add_signal("unfocus", function(c)<br />
c.border_color = beautiful.border_normal<br />
c.opacity = 0.7<br />
end)<br />
'''If you got error messages about add_signal, using connect_signal insteaded.''' <br />
<br />
Note that if you are using conky, you must set it to create its own window instead of using the desktop. To do so, edit ~/.conkyrc to contain:<br />
<br />
own_window yes<br />
own_window_transparent yes<br />
own_window_type desktop<br />
<br />
Otherwise strange behavior may be observed, such as all windows becoming fully transparent. Note also that since conky will be creating a transparent window on your desktop, any actions defined in awesome's rc.lua for the desktop will not work where conky is.<br />
<br />
As of Awesome 3.1, there is built-in pseudo-transparency for wiboxes. To enable it, append 2 hexadecimal digits to the colors in your theme file (~/.config/awesome/themes/default, which is usually a copy of /usr/share/awesome/themes/default), like shown here:<br />
<br />
bg_normal = #000000AA<br />
<br />
where "AA" is the transparency value.<br />
<br />
To change transparency for the actual selected window by pressing Modkey + PageUp/PageDown you can also use tansset-df available through the community package repository and the following modification to your rc.lua:<br />
<br />
globalkeys = awful.util.table.join(<br />
-- your keybindings<br />
[...]<br />
awful.key({ modkey }, "Next", function (c)<br />
awful.util.spawn("transset-df --actual --inc 0.1")<br />
end),<br />
awful.key({ modkey }, "Prior", function (c)<br />
awful.util.spawn("transset-df --actual --dec 0.1")<br />
end),<br />
-- Your other key bindings<br />
[...]<br />
)<br />
<br />
==== ImageMagick ====<br />
You may have problems if you set your wallpaper with imagemagick's ''display'' command, it doesn't work well with xcompmgr. Please note that awsetbg may be using ''display'' if it doesn't have any other options. Installing habak, feh, hsetroot or whatever should fix the problem (''grep -A 1 wpsetters /usr/bin/awsetbg'' to see your options).<br />
<br />
===Autorun programs===<br />
''See also [https://awesome.naquadah.org/wiki/Autostart the Autostart page on the Awesome wiki].''<br />
<br />
awesome doesn't run programs set to autostart by the Freedesktop specification like GNOME or KDE. However, awesome does provide a few functions for starting programs (in addition to the Lua standard library function {{Ic|os.execute}}). To run the same programs on startup as GNOME or KDE, you can install [https://aur.archlinux.org/packages.php?ID=41099 dex] from the [[AUR]] and then run that in your rc.lua:<br />
<br />
os.execute"dex -a -e Awesome"<br />
<br />
If you just want to set up a list of apps for awesome to launch at startup, you can create a table of all the commands you want to spawn and loop through it:<br />
<br />
do<br />
local cmds = <br />
{ <br />
"swiftfox",<br />
"mutt",<br />
"consonance",<br />
"linux-fetion",<br />
"weechat-curses",<br />
--and so on...<br />
}<br />
<br />
for _,i in pairs(cmds) do<br />
awful.util.spawn(i)<br />
end<br />
end<br />
<br />
(You could also run calls to {{Ic|os.execute}} with commands ending in '{{Ic|&}}', but it's probably a better idea to stick to the proper spawn function.)<br />
<br />
To run a program only if it is not currently running, you can spawn it with a shell command that runs the program only if {{Ic|pgrep}} doesn't find a running process with the same name:<br />
function run_once(prg)<br />
awful.util.spawn_with_shell("pgrep -u $USER -x " .. prg .. " || (" .. prg .. ")")<br />
end<br />
<br />
So, for example, to run {{Ic|parcellite}} only if there is not a {{Ic|parcellite}} process already running:<br />
<br />
run_once("parcellite")<br />
<br />
===使用 awesome-client 给文本插件传递信息===<br />
<br />
只需要创建一个新的插件,就可以很容易的传递信息。<br />
{{bc|<nowiki><br />
mywidget = widget({ type = "textbox", name = "mywidget" })<br />
mywidget.text = "initial text"<br />
</nowiki>}}<br />
<br />
使用 awesome-client 从外部更新“initial text":<br />
<br />
{{bc|<nowiki> <br />
echo -e 'mywidget.text = "new text"' | awesome-client<br />
</nowiki>}}<br />
不要忘记把插件增加到 wibox.<br />
<br />
===使用其他任务栏===<br />
<br />
如果你喜欢 awesome 既轻量又强大的功能,但又不喜欢默认那个任务栏的外观, 你可以安装其他的.比如 xfce4-panel:<br />
{{bc|<br />
sudo pacman -S xfce4-panel<br />
}}<br />
<br />
当然,你可能有更好的选择.然后要把它添加到配置文件 rc.lua 的自动启动部分(该如何写请看wiki吧).你可以注释掉配置文件中给每个桌面创建 wiboxes 的那部分(开头是"mywibox[s] = awful.wibox({ position = "top", screen = s })"),因为已经不需要了. 检查配置文件没有错误之后就可以执行命令生效:<br />
{{bc|<br />
awesome -k rc.lua<br />
}}<br />
另外你还需要改变"modkey+R"的快捷键绑定, 比如用Xfrun4, bashrun等,来替代awesome自带的启动器. 请看这个[[Openbox_Themes_and_Apps#Application_launchers|Openbox]]文章中的启动器部分作为参考. 别忘了添加<br />
{{bc|<nowiki><br />
properties = { floating = true } },<br />
{ rule = { instance = "$yourapplicationlauncher" },<br />
</nowiki>}}<br />
到你 rc.lua 配置文件中<br />
<br />
===Fix Java (GUI appears gray only)===<br />
Guide taken from [https://bbs.archlinux.org/viewtopic.php?pid=450870].<br />
#Install {{Pkg|wmname}} from community<br />
#Run the following command or add it to your {{ic|.xinitrc}}: {{bc|wmname LG3D}}<br />
<br />
{{Note|<br />
If you use a non-reparenting window manager and Java 6, you should uncomment the corresponding line in {{Ic|/etc/profile.d/openjdk6.sh}}<br />
<br />
If you use a non-reparenting window manager and Java 7, you should uncomment the corresponding line in <br />
{{Ic|/etc/profile.d/jre.sh}} <br />
}}<br />
<br />
===Prevent Nautilus from displaying the desktop (Gnome3)===<br />
Run dconf-editor. Navigate to org->gnome->desktop->background and uncheck "draw-background" as well as "show-desktop-icons" for good measure. That's it!<br />
<br />
Another option is moving /usr/bin/nautilus to a new location and replacing it with a script that runs 'nautilus --no-desktop' passing any arguments it receives along.<br />
<br />
#!/bin/sh<br />
/usr/bin/nautilus-real --no-desktop $@<br />
<br />
===Transitioning away from Gnome3===<br />
Run 'gnome-session-properties' and remove programs that you won't be needing anymore (e.g Bluetooth Manager, Login Sounds, etc).<br />
<br />
If you'd like to get rid of GDM, make sure that your rc.conf DAEMONS list includes "dbus" (and "cupsd" if you have a printer). It's advisable to get a different login manager (like [https://wiki.archlinux.org/index.php/SLiM SLiM]), but you can do things manually if you wish. That entails setting up your [https://wiki.archlinux.org/index.php/Udev .xinitrc properly] and installing something like devmon ([https://aur.archlinux.org/packages.php?ID=45842 AUR]).<br />
<br />
If you wan't to keep a few convenient systray applets and your GTK theme, append this to your rc.lua;<br />
function start_daemon(dae)<br />
daeCheck = os.execute("ps -eF | grep -v grep | grep -w " .. dae)<br />
if (daeCheck ~= 0) then<br />
os.execute(dae .. " &")<br />
end<br />
end<br />
<br />
procs = {"gnome-settings-daemon", "nm-applet", "kupfer", "gnome-sound-applet", "gnome-power-manager"}<br />
for k = 1, #procs do<br />
start_daemon(procs[k])<br />
end<br />
<br />
===Prevent the mouse scroll wheel from changing tags===<br />
In your rc.lua, change the Mouse Bindings section to the following;<br />
-- {{{ Mouse bindings<br />
root.buttons(awful.util.table.join(<br />
awful.button({ }, 3, function () mymainmenu:toggle() end)))<br />
-- }}}<br />
<br />
==Troubleshooting==<br />
<br />
===LibreOffice===<br />
If you encounter UI problems with libreoffice install libreoffice-gnome.<br />
<br />
===Mod4 key===<br />
<br />
The Mod4 is by default the '''Win key'''. If it's not mapped by default, for some reason, you can check the keycode of your Mod4 key with<br />
<br />
$ xev<br />
<br />
It should be 115 for the left one. Then add this to your ~/.xinitrc<br />
<br />
xmodmap -e "keycode 115 = Super_L" -e "add mod4 = Super_L"<br />
exec awesome<br />
<br />
The problem in this case is that some xorg installations recognize keycode 115, but incorrectly as the 'Select' key. The above command explictly remaps keycode 115 to the correct 'Super_L' key.<br />
<br />
====Mod4 key vs. IBM ThinkPad users====<br />
<br />
IBM ThinkPads do not come equipped with a Window key (although Lenovo have changed this tradition on their ThinkPads). As of writing, the Alt key is not used in command combinations by the default rc.lua (refer to the Awesome wiki for a table of commands), which allows it be used as a replacement for the Super/Mod4/Win key. To do this, edit your rc.lua and replace:<br />
<br />
modkey = "Mod4"<br />
<br />
by:<br />
<br />
modkey = "Mod1"<br />
<br />
Note: Awesome does a have a few commands that make use of Mod4 plus a single letter. Changing Mod4 to Mod1/Alt could cause overlaps for some key combinations. The small amount of instances where this happens can be changed in the rc.lua file.<br />
<br />
If you do not like to change the awesome standards, you might like to remap a key. For instance the caps lock key is rather useless (for me) adding the following contents to ~/.Xmodmap <br />
<br />
clear lock <br />
add mod4 = Caps_Lock<br />
<br />
and [[Extra Keyboard Keys in Xorg#Step 2: Testing|(re)load]] the file.<br />
This will change the caps lock key into the mod4 key and works nicely with the standard awesome settings. In addition, if needed, it provides the mod4 key to other X-programs as well.<br />
<br />
Not confirmed, but if recent updates of xorg related packages break mentioned remapping the second line can be replaced by (tested on a DasKeyboard with no left Super key):<br />
<br />
keysym Caps_Lock = Super_L Caps_Lock<br />
<br />
===Eclipse: cannot resize/move main window===<br />
If you get stuck and cannot move or resize the main window (using mod4 + left/right mouse button) edit the workbench.xml and set fullscreen/maximized to false (if set) and reduce the width and height to numbers smaller than your single screen desktop area.<br />
{{Note|workbench.xml can be found in: <eclipse_workspace>/.metadata/.plugins/org.eclipse.ui.workbench/ and the line to edit is <window height&#61;"xx" maximized&#61;"true" width&#61;"xx" x&#61;"xx" y&#61;"xx">.}}<br />
<br />
===YouTube: fullscreen appears in background===<br />
[https://bbs.archlinux.org/viewtopic.php?pid=1085494#p1085494] If YouTube videos appear underneath your web browser when in fullscreen mode, add this to your rc.lua<br />
<br />
{ rule = { instance = "plugin-container" },<br />
properties = { floating = true } },<br />
<br />
With Chromium add<br />
<br />
{ rule = { instance = "exe" },<br />
properties = { floating = true } },<br />
<br />
===Starting console clients on specific tags===<br />
It does not work when the console application is invoked from a GTK terminal (e.g. LXTerminal). [[URxvt]] is known to work. <br />
<br />
===Redirecting console output to a file===<br />
Some GUI application are very verbose when launched from a terminal. As a consequence, when started from Awesome, they output everything to the TTY from where Awesome was started, which tend to get messy. To remove the garbage output, you have to redirect it. However, the {{ic|awful.util.spawn}} function does not handle pipes and redirections very well as stated in [http://awesome.naquadah.org/wiki/FAQ#How_to_execute_a_shell_command.3F the official FAQ].<br />
<br />
As example, let's redirect [[Luakit]] output to a temporary file:<br />
<br />
awful.key({ modkey, }, "w", function () awful.util.spawn_with_shell("luakit 2>>/tmp/luakit.log") end),<br />
<br />
==External Links==<br />
* http://awesome.naquadah.org/wiki/FAQ - FAQ<br />
* http://www.lua.org/pil/ - Programming in Lua (first edition)<br />
* http://awesome.naquadah.org/ - The official awesome website<br />
* http://awesome.naquadah.org/wiki/Main_Page - the awesome wiki<br />
* http://www.penguinsightings.org/desktop/awesome/ - A review<br />
* http://compsoc.tardis.ed.ac.uk/wiki/AwesomeWM_guide - Awesome guide<br />
* https://bbs.archlinux.org/viewtopic.php?id=88926 - share your awesome!</div>Yagnbhttps://wiki.archlinux.org/index.php?title=IBus_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=254993IBus (简体中文)2013-04-23T14:12:22Z<p>Yagnb: /* LibreOffice */</p>
<hr />
<div>[[Category:Internationalization (简体中文)]]<br />
[[Category:简体中文]]<br />
[[en:IBus]]<br />
[[zh-TW:IBus]]<br />
{{translateme (简体中文)}}<br />
[http://en.wikipedia.org/wiki/Intelligent_Input_Bus IBus] ("Intelligent Input Bus") 是一个 [http://en.wikipedia.org/wiki/Input_method 输入法框架],一个输入非英语字符的系统。IBus 的功能与 [[Smart_Common_Input_Method_platform_(简体中文)|SCIM]] 和 [[UIM]] 类似。 <br />
<br />
==安装==<br />
<br />
从官方仓库安装{{Pkg|ibus}}软件包:<br />
# pacman -S ibus<br />
<br />
此外,为了启动{{Pkg|ibus}}的Qt应用程序支持, 安装{{Pkg|ibus-qt}}软件库:<br />
# pacman -S ibus-qt <br />
<br />
===输入法引擎===<br />
<br />
你至少需要一个支持你所想用的语言的输入法。可用的输入法包括:<br />
* ibus-anthy: 一个日文输入法引擎,基于{{Pkg|anthy}}。<br />
* ibus-pinyin: 一个智能中文语音输入法引擎,支持汉语拼音与注音符号。设计者为Ibus的主要作者,而且有许多的高级功能(如英文拼错修改)。<br />
* ibus-rime:一个强大的智能中文输入法,支持拼音、注音或者没有音调的拼音、双拼、粤拼、中州韵、仓颉和五笔86。<br />
* ibus-chewing:一个智能中文语音输入法引擎,支持注音符号,基于{{Pkg|libchewing}}。<br />
* ibus-hangul: 一个韩文输入法,基于{{Pkg|libhangul}}。<br />
* ibus-unikey: 支持越南文字的输入法引擎。<br />
* ibus-table: 一个支持查表型输入法的输入法引擎。<br />
* ibus-m17n: 一个m17n输入法引擎,可以用m17n-db数据库中的输入法来输入许多语言。<br />
* ibus-keymagic:一个复合型智能输入法,它被设计成可以工作于所有语言,但需要和kms脚本生成的km2键盘布局共同使用。<br />
见所有可用的输入法:<br />
$ pacman -Ss ^ibus-*<br />
<br />
其他软包也供给于[[AUR]].<br />
<br />
===初始安装===<br />
现在运行ibus-setup的初始程序(当要用Ibus的用户):<br />
$ ibus-setup<br />
它会启动后台程序,并给你这条信息:<br />
IBus has been started! If you cannot use IBus, please add below lines in $HOME/.bashrc, and relogin your desktop.<br />
(译:IBus已启动!如果您还不能用Ibus,请您先将以下的三行代码加到$HOME/.bashrc,再重新登录。)<br />
export GTK_IM_MODULE=ibus<br />
export XMODIFIERS=@im=ibus<br />
export QT_IM_MODULE=ibus<br />
{{注意|虽然Ibus使用一个后台程序,但是它不是被/etc/rc.conf中的DAEMONS(后台程序)阵列管理的那种后台程序:它当普通用户运行,并你登录时,它会启动。}}<br />
{{注意|但是,如果ibus尚未启动,先将那些"export"的代码复制到$HOME/.xprofile,并将这行代码加到该文件:“ibus-daemon -x -d”,再重新登录。}}<br />
之后,你会看到一张设置屏幕。Ibus运行时,可以随时访问该屏幕,在系统托盘中的Ibus图符点击右键,选择"Preferences"(选项)即可。详见[[#Configuration|Configuration]].<br />
<br />
如果Ibus在Qt、KDE应用程序中不工作,保证ibus-qt软件库已安装,并在Qt设置编辑器中将Ibus制定为默认输入法引擎:<br />
$ qtconfig<br />
在 "Interface" -> "Default Input Method" (译:“界面”->“默认输入法引擎”) 中,选择“ibus”,而不是"xim"。<br />
<br />
==配置==<br />
{{注意|如果你想输入汉、日、韩、越南文字,需要安装[[Fonts_FAQ#Chinese.2C_Japanese.2C_Korean.2C_Vietnamese|东亚字体]]。}}<br />
<br />
默认的"General"(常规)设置应该可以用,但是点击“Input Methods"(输入法), 在键下拉式列表框中选择你的输入法之后,点击“Add"(添加)。<br />
Ibus一配置好,就可以按Ctrl+Space使用(按多次为多语言转换)。在每个窗口当中,Ibus会记住你所用的输入法,所以每个窗口都需要重新启动。<br />
你可以超驰这种行为。在系统托盘的图符上点击右键,选择“Preferences"(首选项),然后点击“Advanced"(高级)的标签即可。<br />
<br />
==小贴士及技巧==<br />
===使用拼音===<br />
当使用 ibus-pinyin时,<br />
* 首先用拼音(无声调)打你想输入的字。<br />
* 反复地按上和下选择一个字(如果有必要,启程前往下一页)<br />
* 按Space使用一个字。<br />
* 你也可以用上页和下页,并使用1-5的数字键选择你需要的字。<br />
* 你可以一次输入组成一个词或一条短语的若干字(如"zhongwen"可以输入"中文"). ibus-pinyin会记住你最经常打的字,并渐渐做适合你的打字配置文件的建议。<br />
<br />
==疑难解答==<br />
<br />
===Kimpanel===<br />
目前IBus的主界面只支持GTK,{{Pkg|Kimpanel}} 提供了原生的 Qt/KDE 输入界面。 但是,目前kimpanel在Arch Linux环境下因并不能很好的工作(部分原因是{{bug|19580}}),因此需要额外地配置一下。<br />
<br />
安装Kimpanel:<br />
<br />
# pacman -S kdeplasma-addons-applets-kimpanel<br />
<br />
下载和你的KDE版本对应的 kdeplasma-addons 的源文件,并解压缩。<br />
<br />
$ wget -c http://download.kde.org/stable/4.x.x/src/kdeplasma-addons-4.x.x.tar.bz2<br />
$ tar -xvf kdeplasma-addons-4.x.x.tar.bz2<br />
<br />
拷贝系统里没有的文件:<br />
# mkdir /usr/share/ibus/ui/qt<br />
# cp kdeplasma-addons-4.x.x/applets/kimpanel/backend/ibus/panel.py /usr/share/ibus/ui/qt/panel.py<br />
# cp kdeplasma-addons-4.x.x/applets/kimpanel/backend/ibus/qtpanel.xml /usr/share/ibus/component/qtpanel.xml<br />
<br />
编辑 {{ic|/usr/share/ibus/ui/qt/panel.py}}:<br />
#!/usr/bin/env '''python2'''<br />
# vim:set et sts=4 sw=4:<br />
...<br />
<br />
编辑 {{ic|/usr/share/ibus/component/qtpanel.xml}}:<br />
<?xml version=1.0 encoding=utf-8?><br />
&#60;!-- filename: '''qtpanel.xml''' --&#62;<br />
<component><br />
<name>org.freedesktop.IBus.Panel</name><br />
<description>Qt Panel Component</description><br />
<exec>'''/usr/lib/ibus/ibus-ui-qt'''</exec><br />
<version>0.0.1</version><br />
<author>Wang Hoi &lt;zealot.hoi@gmail.com&gt;</author><br />
<license>LGPL</license><br />
<homepage></homepage><br />
<textdomain>ibus</textdomain><br />
</component><br />
<br />
拷贝 {{ic|/usr/lib/ibus/ibus-ui-gtk}} 文件到 {{ic|/usr/lib/ibus/ibus-ui-qt}} 并编辑:<br />
# cp /usr/lib/ibus/ibus-ui-gtk /usr/lib/ibus/ibus-ui-qt<br />
<br />
#!/bin/sh<br />
#<br />
# ibus - The Input Bus<br />
#<br />
# Copyright (c) 2007-2010 Peng Huang <shawn.p.huang@gmail.com><br />
# Copyright (c) 2007-2010 Red Hat, Inc.<br />
#<br />
# This library is free software; you can redistribute it and/or<br />
# modify it under the terms of the GNU Lesser General Public<br />
# License as published by the Free Software Foundation; either<br />
# version 2 of the License, or (at your option) any later version.<br />
#<br />
# This library is distributed in the hope that it will be useful, <br />
# but WITHOUT ANY WARRANTY; without even the implied warranty of <br />
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the <br />
# GNU Lesser General Public License for more details. <br />
# <br />
# You should have received a copy of the GNU Lesser General Public <br />
# License along with this program; if not, write to the <br />
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, <br />
# Boston, MA 02111-1307 USA <br />
<br />
prefix=/usr <br />
exec_prefix=${prefix} <br />
datarootdir=${prefix}/share <br />
export IBUS_PREFIX=/usr<br />
export IBUS_DATAROOTDIR=${prefix}/share<br />
export IBUS_LOCALEDIR=${datarootdir}/locale<br />
<br />
exec python2 '''/usr/share/ibus/ui/qt/panel.py''' $@<br />
<br />
最后,在你的任务栏上添加小工具 {{ic|Input Methode Panel}} 并运行 {{ic|ibus-setup}}:<br />
$ ibus-setup<br />
<br />
===rxvt-unicode===<br />
如果有ibus与rxvt-unicode包的问题,以下的步骤应该将它解决好。<br />
<br />
将以下的两行代码添加到你的.Xdefaults文件(可能不需要,先尝试,如果问题出现,再添加代码):<br />
<br />
URxvt.inputMethod: ibus<br />
URxvt.preeditType: OnTheSpot,None<br />
<br />
然后用以下的命令启动Ibus:<br />
ibus-daemon --xim<br />
<br />
如果你自动地开始ibus-daemon(如在~/.xinitrc或~/.xsession中),但是以前用过没有'--xim'选项的'ibus-daemon &' 命令,先保证已经将已存在的流程杀掉,再尝试新命令。<br />
<br />
===GTK 应用程序===<br />
有些用户在GTK应用程序下使用输入法时会因为无法找到gtk.immodules文件而出现问题。在$HOME/.bashrc中加入<br />
(gtk2) export GTK_IM_MODULE_FILE=/etc/gtk-2.0/gtk.immodules<br />
(gtk3) export GTK_IM_MODULE_FILE=/usr/lib/gtk-3.0/3.0.0/immodules.cache<br />
应该会解决问题。<br />
<br />
{{注意|如果你设置为gtk2,那么你无法使用gtk3的应用程序比如gedit, 如果你设置为gtk3,那么你无法使用gtk2的应用程序比如xfce}}<br />
<br />
===中文输入===<br />
如果你在输入中文时遇到问题,检查你的 locale 设置。比如在香港,export LANG=zh_HK.utf8。<br />
<br />
{{注意| ibus 在 1.4 版本后有些大的修正,你可能无法使用 ibus-pinyin 或 ibus-sunpinyin 输入中文。解决方法有:<br />
* 安装 ibus-libpinyin。<br />
}}<br />
你可以安装 {{Pkg|ibus-libpinyin}}。<br />
<br />
如需 ibus 随 gnome 启动,把这些加入 ~/.profile 后重启 gnome。<br />
<br />
export GTK_IM_MODULE=ibus<br />
export XMODIFIERS=@im=ibus<br />
export QT_IM_MODULE=ibus<br />
ibus-daemon -d -x<br />
<br />
更详细的解决方案可以查看 [http://forum.ubuntu.org.cn/viewtopic.php?f=155&t=346639 这里]。<br />
<br />
===LibreOffice===<br />
如果 IBus 确实已经启动,但是在 LibreOffice 里没有出现输入窗口,你需要在 ~/.bashrc 里加入这行:<br />
export XMODIFIERS=@im=ibus<br />
然后你需要用 "--xim -d" 参数来启动 ibus, 你可以在 ~/.xinitrc 中加入这行:<br />
ibus-daemon --xim -d<br />
但是可怕的是你必须在终端中启动 LibreOffice。<br />
<br />
如果你使用 KDE 而上面的方法没用,而你也不介意在 GTK2 模式下运行 LibreOffice,安装 "libreoffice-gnome" 然后在 ~/.xprofile 中添加此行:<br />
export OOO_FORCE_DESKTOP="gnome"<br />
<br />
这会使 IBus 在 LibreOffice 正常使用,你也可以在任何地方启动 LibreOffice -- 而不只是在终端。</div>Yagnbhttps://wiki.archlinux.org/index.php?title=IBus_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=254991IBus (简体中文)2013-04-23T14:03:31Z<p>Yagnb: /* 中文输入 */</p>
<hr />
<div>[[Category:Internationalization (简体中文)]]<br />
[[Category:简体中文]]<br />
[[en:IBus]]<br />
[[zh-TW:IBus]]<br />
{{translateme (简体中文)}}<br />
[http://en.wikipedia.org/wiki/Intelligent_Input_Bus IBus] ("Intelligent Input Bus") 是一个 [http://en.wikipedia.org/wiki/Input_method 输入法框架],一个输入非英语字符的系统。IBus 的功能与 [[Smart_Common_Input_Method_platform_(简体中文)|SCIM]] 和 [[UIM]] 类似。 <br />
<br />
==安装==<br />
<br />
从官方仓库安装{{Pkg|ibus}}软件包:<br />
# pacman -S ibus<br />
<br />
此外,为了启动{{Pkg|ibus}}的Qt应用程序支持, 安装{{Pkg|ibus-qt}}软件库:<br />
# pacman -S ibus-qt <br />
<br />
===输入法引擎===<br />
<br />
你至少需要一个支持你所想用的语言的输入法。可用的输入法包括:<br />
* ibus-anthy: 一个日文输入法引擎,基于{{Pkg|anthy}}。<br />
* ibus-pinyin: 一个智能中文语音输入法引擎,支持汉语拼音与注音符号。设计者为Ibus的主要作者,而且有许多的高级功能(如英文拼错修改)。<br />
* ibus-rime:一个强大的智能中文输入法,支持拼音、注音或者没有音调的拼音、双拼、粤拼、中州韵、仓颉和五笔86。<br />
* ibus-chewing:一个智能中文语音输入法引擎,支持注音符号,基于{{Pkg|libchewing}}。<br />
* ibus-hangul: 一个韩文输入法,基于{{Pkg|libhangul}}。<br />
* ibus-unikey: 支持越南文字的输入法引擎。<br />
* ibus-table: 一个支持查表型输入法的输入法引擎。<br />
* ibus-m17n: 一个m17n输入法引擎,可以用m17n-db数据库中的输入法来输入许多语言。<br />
* ibus-keymagic:一个复合型智能输入法,它被设计成可以工作于所有语言,但需要和kms脚本生成的km2键盘布局共同使用。<br />
见所有可用的输入法:<br />
$ pacman -Ss ^ibus-*<br />
<br />
其他软包也供给于[[AUR]].<br />
<br />
===初始安装===<br />
现在运行ibus-setup的初始程序(当要用Ibus的用户):<br />
$ ibus-setup<br />
它会启动后台程序,并给你这条信息:<br />
IBus has been started! If you cannot use IBus, please add below lines in $HOME/.bashrc, and relogin your desktop.<br />
(译:IBus已启动!如果您还不能用Ibus,请您先将以下的三行代码加到$HOME/.bashrc,再重新登录。)<br />
export GTK_IM_MODULE=ibus<br />
export XMODIFIERS=@im=ibus<br />
export QT_IM_MODULE=ibus<br />
{{注意|虽然Ibus使用一个后台程序,但是它不是被/etc/rc.conf中的DAEMONS(后台程序)阵列管理的那种后台程序:它当普通用户运行,并你登录时,它会启动。}}<br />
{{注意|但是,如果ibus尚未启动,先将那些"export"的代码复制到$HOME/.xprofile,并将这行代码加到该文件:“ibus-daemon -x -d”,再重新登录。}}<br />
之后,你会看到一张设置屏幕。Ibus运行时,可以随时访问该屏幕,在系统托盘中的Ibus图符点击右键,选择"Preferences"(选项)即可。详见[[#Configuration|Configuration]].<br />
<br />
如果Ibus在Qt、KDE应用程序中不工作,保证ibus-qt软件库已安装,并在Qt设置编辑器中将Ibus制定为默认输入法引擎:<br />
$ qtconfig<br />
在 "Interface" -> "Default Input Method" (译:“界面”->“默认输入法引擎”) 中,选择“ibus”,而不是"xim"。<br />
<br />
==配置==<br />
{{注意|如果你想输入汉、日、韩、越南文字,需要安装[[Fonts_FAQ#Chinese.2C_Japanese.2C_Korean.2C_Vietnamese|东亚字体]]。}}<br />
<br />
默认的"General"(常规)设置应该可以用,但是点击“Input Methods"(输入法), 在键下拉式列表框中选择你的输入法之后,点击“Add"(添加)。<br />
Ibus一配置好,就可以按Ctrl+Space使用(按多次为多语言转换)。在每个窗口当中,Ibus会记住你所用的输入法,所以每个窗口都需要重新启动。<br />
你可以超驰这种行为。在系统托盘的图符上点击右键,选择“Preferences"(首选项),然后点击“Advanced"(高级)的标签即可。<br />
<br />
==小贴士及技巧==<br />
===使用拼音===<br />
当使用 ibus-pinyin时,<br />
* 首先用拼音(无声调)打你想输入的字。<br />
* 反复地按上和下选择一个字(如果有必要,启程前往下一页)<br />
* 按Space使用一个字。<br />
* 你也可以用上页和下页,并使用1-5的数字键选择你需要的字。<br />
* 你可以一次输入组成一个词或一条短语的若干字(如"zhongwen"可以输入"中文"). ibus-pinyin会记住你最经常打的字,并渐渐做适合你的打字配置文件的建议。<br />
<br />
==疑难解答==<br />
<br />
===Kimpanel===<br />
目前IBus的主界面只支持GTK,{{Pkg|Kimpanel}} 提供了原生的 Qt/KDE 输入界面。 但是,目前kimpanel在Arch Linux环境下因并不能很好的工作(部分原因是{{bug|19580}}),因此需要额外地配置一下。<br />
<br />
安装Kimpanel:<br />
<br />
# pacman -S kdeplasma-addons-applets-kimpanel<br />
<br />
下载和你的KDE版本对应的 kdeplasma-addons 的源文件,并解压缩。<br />
<br />
$ wget -c http://download.kde.org/stable/4.x.x/src/kdeplasma-addons-4.x.x.tar.bz2<br />
$ tar -xvf kdeplasma-addons-4.x.x.tar.bz2<br />
<br />
拷贝系统里没有的文件:<br />
# mkdir /usr/share/ibus/ui/qt<br />
# cp kdeplasma-addons-4.x.x/applets/kimpanel/backend/ibus/panel.py /usr/share/ibus/ui/qt/panel.py<br />
# cp kdeplasma-addons-4.x.x/applets/kimpanel/backend/ibus/qtpanel.xml /usr/share/ibus/component/qtpanel.xml<br />
<br />
编辑 {{ic|/usr/share/ibus/ui/qt/panel.py}}:<br />
#!/usr/bin/env '''python2'''<br />
# vim:set et sts=4 sw=4:<br />
...<br />
<br />
编辑 {{ic|/usr/share/ibus/component/qtpanel.xml}}:<br />
<?xml version=1.0 encoding=utf-8?><br />
&#60;!-- filename: '''qtpanel.xml''' --&#62;<br />
<component><br />
<name>org.freedesktop.IBus.Panel</name><br />
<description>Qt Panel Component</description><br />
<exec>'''/usr/lib/ibus/ibus-ui-qt'''</exec><br />
<version>0.0.1</version><br />
<author>Wang Hoi &lt;zealot.hoi@gmail.com&gt;</author><br />
<license>LGPL</license><br />
<homepage></homepage><br />
<textdomain>ibus</textdomain><br />
</component><br />
<br />
拷贝 {{ic|/usr/lib/ibus/ibus-ui-gtk}} 文件到 {{ic|/usr/lib/ibus/ibus-ui-qt}} 并编辑:<br />
# cp /usr/lib/ibus/ibus-ui-gtk /usr/lib/ibus/ibus-ui-qt<br />
<br />
#!/bin/sh<br />
#<br />
# ibus - The Input Bus<br />
#<br />
# Copyright (c) 2007-2010 Peng Huang <shawn.p.huang@gmail.com><br />
# Copyright (c) 2007-2010 Red Hat, Inc.<br />
#<br />
# This library is free software; you can redistribute it and/or<br />
# modify it under the terms of the GNU Lesser General Public<br />
# License as published by the Free Software Foundation; either<br />
# version 2 of the License, or (at your option) any later version.<br />
#<br />
# This library is distributed in the hope that it will be useful, <br />
# but WITHOUT ANY WARRANTY; without even the implied warranty of <br />
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the <br />
# GNU Lesser General Public License for more details. <br />
# <br />
# You should have received a copy of the GNU Lesser General Public <br />
# License along with this program; if not, write to the <br />
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, <br />
# Boston, MA 02111-1307 USA <br />
<br />
prefix=/usr <br />
exec_prefix=${prefix} <br />
datarootdir=${prefix}/share <br />
export IBUS_PREFIX=/usr<br />
export IBUS_DATAROOTDIR=${prefix}/share<br />
export IBUS_LOCALEDIR=${datarootdir}/locale<br />
<br />
exec python2 '''/usr/share/ibus/ui/qt/panel.py''' $@<br />
<br />
最后,在你的任务栏上添加小工具 {{ic|Input Methode Panel}} 并运行 {{ic|ibus-setup}}:<br />
$ ibus-setup<br />
<br />
===rxvt-unicode===<br />
如果有ibus与rxvt-unicode包的问题,以下的步骤应该将它解决好。<br />
<br />
将以下的两行代码添加到你的.Xdefaults文件(可能不需要,先尝试,如果问题出现,再添加代码):<br />
<br />
URxvt.inputMethod: ibus<br />
URxvt.preeditType: OnTheSpot,None<br />
<br />
然后用以下的命令启动Ibus:<br />
ibus-daemon --xim<br />
<br />
如果你自动地开始ibus-daemon(如在~/.xinitrc或~/.xsession中),但是以前用过没有'--xim'选项的'ibus-daemon &' 命令,先保证已经将已存在的流程杀掉,再尝试新命令。<br />
<br />
===GTK 应用程序===<br />
有些用户在GTK应用程序下使用输入法时会因为无法找到gtk.immodules文件而出现问题。在$HOME/.bashrc中加入<br />
(gtk2) export GTK_IM_MODULE_FILE=/etc/gtk-2.0/gtk.immodules<br />
(gtk3) export GTK_IM_MODULE_FILE=/usr/lib/gtk-3.0/3.0.0/immodules.cache<br />
应该会解决问题。<br />
<br />
{{注意|如果你设置为gtk2,那么你无法使用gtk3的应用程序比如gedit, 如果你设置为gtk3,那么你无法使用gtk2的应用程序比如xfce}}<br />
<br />
===中文输入===<br />
如果你在输入中文时遇到问题,检查你的 locale 设置。比如在香港,export LANG=zh_HK.utf8。<br />
<br />
{{注意| ibus 在 1.4 版本后有些大的修正,你可能无法使用 ibus-pinyin 或 ibus-sunpinyin 输入中文。解决方法有:<br />
* 安装 ibus-libpinyin。<br />
}}<br />
你可以安装 {{Pkg|ibus-libpinyin}}。<br />
<br />
如需 ibus 随 gnome 启动,把这些加入 ~/.profile 后重启 gnome。<br />
<br />
export GTK_IM_MODULE=ibus<br />
export XMODIFIERS=@im=ibus<br />
export QT_IM_MODULE=ibus<br />
ibus-daemon -d -x<br />
<br />
更详细的解决方案可以查看 [http://forum.ubuntu.org.cn/viewtopic.php?f=155&t=346639 这里]。<br />
<br />
===LibreOffice===<br />
LibreOffice (and OpenOffice) ship with an old libc version which causes ibus to fail to load. To fix this, remove the shipped libstdc++.so.6 at "/usr/lib/libreoffice/basis-link/ure-link/lib/libstdc++.so.6".<br />
<br />
If IBus does load but doesn't see LibreOffice as an input window, add this line to ~/.bashrc:<br />
export XMODIFIERS=@im=ibus<br />
And then, you need to start ibus with "-xim -d", for example, add this line to ~/.xinitrc:<br />
ibus-daemon --xim -d<br />
But the horrible thing is that you need to start libreoffice in terminal.</div>Yagnbhttps://wiki.archlinux.org/index.php?title=IBus_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=254989IBus (简体中文)2013-04-23T13:50:53Z<p>Yagnb: /* GTK 应用程序 */</p>
<hr />
<div>[[Category:Internationalization (简体中文)]]<br />
[[Category:简体中文]]<br />
[[en:IBus]]<br />
[[zh-TW:IBus]]<br />
{{translateme (简体中文)}}<br />
[http://en.wikipedia.org/wiki/Intelligent_Input_Bus IBus] ("Intelligent Input Bus") 是一个 [http://en.wikipedia.org/wiki/Input_method 输入法框架],一个输入非英语字符的系统。IBus 的功能与 [[Smart_Common_Input_Method_platform_(简体中文)|SCIM]] 和 [[UIM]] 类似。 <br />
<br />
==安装==<br />
<br />
从官方仓库安装{{Pkg|ibus}}软件包:<br />
# pacman -S ibus<br />
<br />
此外,为了启动{{Pkg|ibus}}的Qt应用程序支持, 安装{{Pkg|ibus-qt}}软件库:<br />
# pacman -S ibus-qt <br />
<br />
===输入法引擎===<br />
<br />
你至少需要一个支持你所想用的语言的输入法。可用的输入法包括:<br />
* ibus-anthy: 一个日文输入法引擎,基于{{Pkg|anthy}}。<br />
* ibus-pinyin: 一个智能中文语音输入法引擎,支持汉语拼音与注音符号。设计者为Ibus的主要作者,而且有许多的高级功能(如英文拼错修改)。<br />
* ibus-rime:一个强大的智能中文输入法,支持拼音、注音或者没有音调的拼音、双拼、粤拼、中州韵、仓颉和五笔86。<br />
* ibus-chewing:一个智能中文语音输入法引擎,支持注音符号,基于{{Pkg|libchewing}}。<br />
* ibus-hangul: 一个韩文输入法,基于{{Pkg|libhangul}}。<br />
* ibus-unikey: 支持越南文字的输入法引擎。<br />
* ibus-table: 一个支持查表型输入法的输入法引擎。<br />
* ibus-m17n: 一个m17n输入法引擎,可以用m17n-db数据库中的输入法来输入许多语言。<br />
* ibus-keymagic:一个复合型智能输入法,它被设计成可以工作于所有语言,但需要和kms脚本生成的km2键盘布局共同使用。<br />
见所有可用的输入法:<br />
$ pacman -Ss ^ibus-*<br />
<br />
其他软包也供给于[[AUR]].<br />
<br />
===初始安装===<br />
现在运行ibus-setup的初始程序(当要用Ibus的用户):<br />
$ ibus-setup<br />
它会启动后台程序,并给你这条信息:<br />
IBus has been started! If you cannot use IBus, please add below lines in $HOME/.bashrc, and relogin your desktop.<br />
(译:IBus已启动!如果您还不能用Ibus,请您先将以下的三行代码加到$HOME/.bashrc,再重新登录。)<br />
export GTK_IM_MODULE=ibus<br />
export XMODIFIERS=@im=ibus<br />
export QT_IM_MODULE=ibus<br />
{{注意|虽然Ibus使用一个后台程序,但是它不是被/etc/rc.conf中的DAEMONS(后台程序)阵列管理的那种后台程序:它当普通用户运行,并你登录时,它会启动。}}<br />
{{注意|但是,如果ibus尚未启动,先将那些"export"的代码复制到$HOME/.xprofile,并将这行代码加到该文件:“ibus-daemon -x -d”,再重新登录。}}<br />
之后,你会看到一张设置屏幕。Ibus运行时,可以随时访问该屏幕,在系统托盘中的Ibus图符点击右键,选择"Preferences"(选项)即可。详见[[#Configuration|Configuration]].<br />
<br />
如果Ibus在Qt、KDE应用程序中不工作,保证ibus-qt软件库已安装,并在Qt设置编辑器中将Ibus制定为默认输入法引擎:<br />
$ qtconfig<br />
在 "Interface" -> "Default Input Method" (译:“界面”->“默认输入法引擎”) 中,选择“ibus”,而不是"xim"。<br />
<br />
==配置==<br />
{{注意|如果你想输入汉、日、韩、越南文字,需要安装[[Fonts_FAQ#Chinese.2C_Japanese.2C_Korean.2C_Vietnamese|东亚字体]]。}}<br />
<br />
默认的"General"(常规)设置应该可以用,但是点击“Input Methods"(输入法), 在键下拉式列表框中选择你的输入法之后,点击“Add"(添加)。<br />
Ibus一配置好,就可以按Ctrl+Space使用(按多次为多语言转换)。在每个窗口当中,Ibus会记住你所用的输入法,所以每个窗口都需要重新启动。<br />
你可以超驰这种行为。在系统托盘的图符上点击右键,选择“Preferences"(首选项),然后点击“Advanced"(高级)的标签即可。<br />
<br />
==小贴士及技巧==<br />
===使用拼音===<br />
当使用 ibus-pinyin时,<br />
* 首先用拼音(无声调)打你想输入的字。<br />
* 反复地按上和下选择一个字(如果有必要,启程前往下一页)<br />
* 按Space使用一个字。<br />
* 你也可以用上页和下页,并使用1-5的数字键选择你需要的字。<br />
* 你可以一次输入组成一个词或一条短语的若干字(如"zhongwen"可以输入"中文"). ibus-pinyin会记住你最经常打的字,并渐渐做适合你的打字配置文件的建议。<br />
<br />
==疑难解答==<br />
<br />
===Kimpanel===<br />
目前IBus的主界面只支持GTK,{{Pkg|Kimpanel}} 提供了原生的 Qt/KDE 输入界面。 但是,目前kimpanel在Arch Linux环境下因并不能很好的工作(部分原因是{{bug|19580}}),因此需要额外地配置一下。<br />
<br />
安装Kimpanel:<br />
<br />
# pacman -S kdeplasma-addons-applets-kimpanel<br />
<br />
下载和你的KDE版本对应的 kdeplasma-addons 的源文件,并解压缩。<br />
<br />
$ wget -c http://download.kde.org/stable/4.x.x/src/kdeplasma-addons-4.x.x.tar.bz2<br />
$ tar -xvf kdeplasma-addons-4.x.x.tar.bz2<br />
<br />
拷贝系统里没有的文件:<br />
# mkdir /usr/share/ibus/ui/qt<br />
# cp kdeplasma-addons-4.x.x/applets/kimpanel/backend/ibus/panel.py /usr/share/ibus/ui/qt/panel.py<br />
# cp kdeplasma-addons-4.x.x/applets/kimpanel/backend/ibus/qtpanel.xml /usr/share/ibus/component/qtpanel.xml<br />
<br />
编辑 {{ic|/usr/share/ibus/ui/qt/panel.py}}:<br />
#!/usr/bin/env '''python2'''<br />
# vim:set et sts=4 sw=4:<br />
...<br />
<br />
编辑 {{ic|/usr/share/ibus/component/qtpanel.xml}}:<br />
<?xml version=1.0 encoding=utf-8?><br />
&#60;!-- filename: '''qtpanel.xml''' --&#62;<br />
<component><br />
<name>org.freedesktop.IBus.Panel</name><br />
<description>Qt Panel Component</description><br />
<exec>'''/usr/lib/ibus/ibus-ui-qt'''</exec><br />
<version>0.0.1</version><br />
<author>Wang Hoi &lt;zealot.hoi@gmail.com&gt;</author><br />
<license>LGPL</license><br />
<homepage></homepage><br />
<textdomain>ibus</textdomain><br />
</component><br />
<br />
拷贝 {{ic|/usr/lib/ibus/ibus-ui-gtk}} 文件到 {{ic|/usr/lib/ibus/ibus-ui-qt}} 并编辑:<br />
# cp /usr/lib/ibus/ibus-ui-gtk /usr/lib/ibus/ibus-ui-qt<br />
<br />
#!/bin/sh<br />
#<br />
# ibus - The Input Bus<br />
#<br />
# Copyright (c) 2007-2010 Peng Huang <shawn.p.huang@gmail.com><br />
# Copyright (c) 2007-2010 Red Hat, Inc.<br />
#<br />
# This library is free software; you can redistribute it and/or<br />
# modify it under the terms of the GNU Lesser General Public<br />
# License as published by the Free Software Foundation; either<br />
# version 2 of the License, or (at your option) any later version.<br />
#<br />
# This library is distributed in the hope that it will be useful, <br />
# but WITHOUT ANY WARRANTY; without even the implied warranty of <br />
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the <br />
# GNU Lesser General Public License for more details. <br />
# <br />
# You should have received a copy of the GNU Lesser General Public <br />
# License along with this program; if not, write to the <br />
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, <br />
# Boston, MA 02111-1307 USA <br />
<br />
prefix=/usr <br />
exec_prefix=${prefix} <br />
datarootdir=${prefix}/share <br />
export IBUS_PREFIX=/usr<br />
export IBUS_DATAROOTDIR=${prefix}/share<br />
export IBUS_LOCALEDIR=${datarootdir}/locale<br />
<br />
exec python2 '''/usr/share/ibus/ui/qt/panel.py''' $@<br />
<br />
最后,在你的任务栏上添加小工具 {{ic|Input Methode Panel}} 并运行 {{ic|ibus-setup}}:<br />
$ ibus-setup<br />
<br />
===rxvt-unicode===<br />
如果有ibus与rxvt-unicode包的问题,以下的步骤应该将它解决好。<br />
<br />
将以下的两行代码添加到你的.Xdefaults文件(可能不需要,先尝试,如果问题出现,再添加代码):<br />
<br />
URxvt.inputMethod: ibus<br />
URxvt.preeditType: OnTheSpot,None<br />
<br />
然后用以下的命令启动Ibus:<br />
ibus-daemon --xim<br />
<br />
如果你自动地开始ibus-daemon(如在~/.xinitrc或~/.xsession中),但是以前用过没有'--xim'选项的'ibus-daemon &' 命令,先保证已经将已存在的流程杀掉,再尝试新命令。<br />
<br />
===GTK 应用程序===<br />
有些用户在GTK应用程序下使用输入法时会因为无法找到gtk.immodules文件而出现问题。在$HOME/.bashrc中加入<br />
(gtk2) export GTK_IM_MODULE_FILE=/etc/gtk-2.0/gtk.immodules<br />
(gtk3) export GTK_IM_MODULE_FILE=/usr/lib/gtk-3.0/3.0.0/immodules.cache<br />
应该会解决问题。<br />
<br />
{{注意|如果你设置为gtk2,那么你无法使用gtk3的应用程序比如gedit, 如果你设置为gtk3,那么你无法使用gtk2的应用程序比如xfce}}<br />
<br />
===中文输入===<br />
If you encounter problems when using chinese input, check your locale settting. For example in Hong Kong, export LANG=zh_HK.utf8.<br />
<br />
{{Note| There are large revisions after ibus1.4, you might not be able to input chinese words with ibus-pinyin or ibus-sunpinyin, which are written in C. So the solution is:<br />
<br />
* Recompile ibus-sunpinyin in ABS by yourself. or<br />
* Install ibus-googlepinyin, which is developed in python. <br />
}}<br />
You can install {{AUR|ibus-googlepinyin}} from the [[AUR]].<br />
<br />
To start ibus with gnome, add this in ~/.profile and restart the gnome.<br />
<br />
export GTK_IM_MODULE=ibus<br />
export XMODIFIERS=@im=ibus<br />
export QT_IM_MODULE=ibus<br />
ibus-daemon -d -x<br />
<br />
Chinese users can refer to this [http://forum.ubuntu.org.cn/viewtopic.php?f=155&t=346639 page] for detailed solution concerning this bug.<br />
<br />
===LibreOffice===<br />
LibreOffice (and OpenOffice) ship with an old libc version which causes ibus to fail to load. To fix this, remove the shipped libstdc++.so.6 at "/usr/lib/libreoffice/basis-link/ure-link/lib/libstdc++.so.6".<br />
<br />
If IBus does load but doesn't see LibreOffice as an input window, add this line to ~/.bashrc:<br />
export XMODIFIERS=@im=ibus<br />
And then, you need to start ibus with "-xim -d", for example, add this line to ~/.xinitrc:<br />
ibus-daemon --xim -d<br />
But the horrible thing is that you need to start libreoffice in terminal.</div>Yagnbhttps://wiki.archlinux.org/index.php?title=Bumblebee_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=253107Bumblebee (简体中文)2013-04-06T12:00:29Z<p>Yagnb: /* 安装 */</p>
<hr />
<div>[[Category:简体中文]]<br />
[[Category:Graphics (简体中文)]]<br />
[[Category:X Server (简体中文)]]<br />
[[en:Bumblebee]]<br />
[[es:Bumblebee]]<br />
[[fr:Bumblebee]]<br />
[[it:Bumblebee]]<br />
[[ru:Bumblebee]]<br />
[[tr:Bumblebee]]<br />
{{TranslationStatus (简体中文)|Bumblebee|2012-07-11|212581}}<br />
转自 Bumblebee [https://github.com/Bumblebee-Project/Bumblebee/wiki/FAQ FAQ]:<br />
<br />
"Bumblebee 致力于使 NVIDIA Optimus 在 GNU/Linux 系统上可用,实现两块不同的供电配置的显卡同时插入使用,共享同一个 framebuffer。"<br />
<br />
== Bumblebee: Linux上的擎天柱 ==<br />
<br />
[http://www.nvidia.com/object/optimus_technology.html Optimus 技术] 是不依赖于硬件复杂结构的 ''[http://hybrid-graphics-linux.tuxfamily.org/index.php?title=Hybrid_graphics 交火显卡 ]'' 实现。独立显卡按需渲染,并传输给集成显卡,集成显卡则负责显示功能。当笔记本通过电池供电时,独立显卡将关闭,以延长电池寿命。<br />
<br />
Bumblebee 是基于 VirtualGl 和内核驱动的软件实现,以支持使用并不是物理直连显示器的独立显卡。<br />
<br />
Bumblebee 试图模拟 Optimus 技术的行为;当需要的时候,使用独立显卡进行渲染,不使用的时候则关闭。当前的版本仅支持按需渲染,电源管理功能仍然在开发之中。<br />
<br />
NVIDIA 独立显卡在管理的时候,是作为一个连接到“伪屏幕”(配置了显示器,但是并不使用)上的独立的 X 服务器的。第二个服务器被称为使用 VirtualGL,因为他看起来就像一个远程服务器。这就是说,你需要一系列步骤来设置内核驱动、X 服务器以及守护进程。<br />
<br />
{{警告|Bumblebee 的开发任务仍然很重! 我们非常欢迎您的帮助。}}<br />
<br />
==安装==<br />
<br />
安装 Bumblebee 之前,如果有可能,检查你的 BIOS 已激活 Optimus (共享显卡, BISO有可能没有提供此项设置),并且为次要显卡安装 [[Intel_Graphics_(简体中文)|intel 驱动]]。<br />
<br />
完整的配置需要安装这些包:<br />
<br />
* {{Pkg|bumblebee}} (或 {{aur|bumblebee-git}}) - 提供守护进程以及程序的主要安装包。<br />
* (可选) {{Pkg|bbswitch}} (或 {{aur|dkms-bbswitch}}) - 推荐安装用来关闭Nvidia显卡省电。<br />
* (可选) 如果你不止想节电,也就是说要在独立的Nvidia显卡上渲染程序,那么你也需要:<br />
** Nvidia显卡驱动。开源的 [[nouveau]] 驱动或是闭源的 [[NVIDIA_(简体中文)|nvidia]] 驱动,参见下面小节。<br />
** 一个渲染/显示的连接。目前有两个包可以适用 {{Pkg|primus}} (或 {{aur|primus-git}}) 和 {{Pkg|virtualgl}}。其中只需要安装一个包,不过两个都安装也不会有问题。<br />
<br />
{{注意|如果你想在64位系统上运行32位程序,你必须为你的程序安装正确的lib32-*库。除此之外,你还要根据你安装的渲染连接来安装 {{Pkg|lib32-virtualgl}} 或者 {{Pkg|lib32-primus}} (或 {{AUR|lib32-primus-git}})。如果你打算使用Primus,你得运行 {{ic|primusrun}} 而不是 {{ic|optirun}}。}}<br />
<br />
=== 为 Intel / nvidia 安装 Bumblebee ===<br />
<br />
* 安装 {{pkg|intel-dri}},{{pkg|bumblebee}} 和 {{pkg|nvidia}}。<br />
<br />
# pacman -S intel-dri bumblebee nvidia<br />
<br />
如果你想要在64位系统上运行32位的程序 (比如用wine来运行游戏) 你需要安装 {{pkg|lib32-nvidia-utils}}。<br />
<br />
# pacman -S lib32-nvidia-utils<br />
<br />
{{注意|不要安装lib32-nvidia-libgl! Bumblebee不需要它来找到正确的32位nvidia运行库。}}<br />
<br />
=== 为 Intel / nouveau 安装 Bumblebee ===<br />
<br />
首先安装 nouveau 以及以来的包:<br />
{{bc|# pacman -S xf86-video-nouveau nouveau-dri mesa}}<br />
<br />
* {{Pkg|xf86-video-nouveau}} experimental 3D acceleration driver<br />
* {{Pkg|nouveau-dri}} Mesa classic DRI + Gallium3D drivers<br />
* {{Pkg|mesa}} Mesa 3-D graphics libraries<br />
<br />
==启动 Bumblebee==<br />
<br />
使用之前,请确保添加相关用户到 Bumblebee 组:<br />
<br />
# usermod -a -G bumblebee $USER<br />
<br />
{{ic|$USER}} 是要添加的用户登录名称。 之后注销,并重新登录,以应用组变更。<br />
<br />
要自动启动 bumblebee,将其添加到启动服务中:<br />
<br />
# systemctl enable bumblebeed.service<br />
<br />
结束了。 - 重启之后,使用 shell 程序 {{ic|[[#Usage|optirun]]}} 来支持 Optimus NVIDIA 渲染!<br />
<br />
== 使用 ==<br />
<br />
随 bumblebee 发布的 {{ic|optirun}} 程序是用来使用 Optimus NVIDIA 显卡的最好方法。<br />
<br />
测试 Bumblebee 是否支持你的 Optimus 系统:<br />
{{bc|$ optirun glxgears -info}}<br />
<br />
如果在终端中看到一个关于你的 Nvidia 的提示,恭喜你,Bumblebee 和 Optimus 已经开始工作了。<br />
<br />
常用命令:<br />
<br />
{{bc|$ optirun [options] <application> [application-parameters]}}<br />
<br />
一些例子:<br />
<br />
启动 firefox ,并使用 Optimus 加速:<br />
<br />
{{bc|$ optirun firefox}}<br />
<br />
启动 Windows 应用程序:<br />
<br />
{{bc|$ optirun wine <windows application>.exe}}<br />
<br />
启动 NVIDIA 设置:<br />
<br />
{{bc|$ optirun nvidia-settings -c :8 }}<br />
<br />
要获取 {{ic|optirun}} 的可用选项,运行:<br />
{{bc|$ optirun --help}}<br />
<br />
== 配置 ==<br />
<br />
你可以按需配置 Bumblebee 的行为,可以通过 {{ic|/etc/bumblebee/bumblebee.conf}} 来调节诸如优化,电源管理,以及其他任务。<br />
<br />
=== 速度优化 ===<br />
<br />
Bumblebee 使用你的 Optimus NVIDIA 显卡来渲染一个配置了 VirtualGL 的不可见的 X 服务器,并且将结果传输到你当前的 X 服务器上。传输之前将压缩侦,这可以节省带宽并且能够用于加速 bumblebee 的优化。<br />
<br />
要为单个应用程序指定不同的压缩方法:<br />
<br />
$ optirun -c <compress-method> application<br />
<br />
压缩方法会影响 GPU性能和GPU使用,压缩方法(比如 {{ic|jpeg}})会最大限度的使用 CPU,并且尽可能少的使用 GPU;非压缩的方法最大限度的使用 GPU,而尽可能少的使用 CPU。<br />
<br />
压缩方法如有: {{ic|jpeg}}, {{ic|rgb}}, {{ic|yuv}}<br />
<br />
非压缩方法有: {{ic|proxy}}, {{ic|xv}}<br />
<br />
要为所有应用程序使用一个标准的压缩方法,在 {{ic|/etc/bumblebee/bumblebee.conf}} 中设置 {{ic|VGLTransport}} to {{ic|<compress-method>}} 。<br />
<br />
{{hc|/etc/bumblebee/bumblebee.conf|<nowiki><br />
...<br />
[optirun]<br />
VGLTransport=proxy<br />
...<br />
</nowiki>}}<br />
<br />
{{注意|CPU频率调节可能会影响渲染的性能。}}<br />
<br />
=== 电源管理 ===<br />
<br />
电源管理的目的是为了自动关闭 bumblebee 不再使用的 NVIDIA 显卡。<br />
<br />
要启用电源管理,需要从 AUR 安装 {{AUR|bbswitch}}。<br />
<br />
{{警告| 确保备用 Xrog 服务器在不用的时候是关闭的!}}<br />
<br />
设置{{ic|/etc/bumblebee/bumblebee.conf}} 中驱动一节的{{ic|PMMethod}} 为 {{ic|bbswitch}}:<br />
<br />
{{hc|/etc/bumblebee/bumblebee.conf|<nowiki><br />
[bumblebeed]<br />
KeepUnusedXServer=false<br />
...<br />
[driver-nvidia]<br />
PMMethod=bbswitch<br />
...<br />
[driver-nouveau]<br />
PMMethod=bbswitch<br />
...<br />
</nowiki>}}<br />
<br />
==== 默认的 NVIDIA 电源状态 ====<br />
<br />
根据你的需要,设置 {{ic|load_state}} 以及 {{ic|unload_state}} 模块选项 (参考 [https://github.com/Bumblebee-Project/bbswitch bbswitch 文档])。<br />
<br />
{{hc|/etc/modprobe.d/bbswitch.conf|<nowiki><br />
options bbswitch load_state=0 unload_state=0<br />
</nowiki>}}<br />
<br />
重启 bumblebee 守护进车功能以激活电源管理功能:<br />
<br />
{{bc|# rc.d restart bumblebeed}}<br />
<br />
==== 关机时启用 NVIDIA 显卡 ====<br />
<br />
如果系统上次关闭时,NVIDIA显卡为关闭(断电)状态,NVIDIA 显卡可能在启动时不能正确初始化。一个解决的办法是在{{ic|/etc/bumblebee/bumblebee.conf}}文件中设置{{ic|TurnCardOffAtExit&#61;false}} ,但是这会导致每次你停止 Bumblebee 守护进程时,NVIDIA 显卡都会启用,即使是你手工关闭守护进程。要保证在关闭时 NVIDIA 显卡总是供电状态,增加如下启动进程[[Boot process#Custom_hooks|钩子函数]] (假如你使用 {{AUR|bbswitch}}的话):<br />
<br />
{{hc|/etc/rc.d/functions.d/nvidia-card-enable|<nowiki><br />
nvidia_card_enable() {<br />
BBSWITCH=/proc/acpi/bbswitch<br />
<br />
stat_busy "Enabling NVIDIA GPU"<br />
<br />
if [ -w ${BBSWITCH} ]; then<br />
echo ON > ${BBSWITCH}<br />
stat_done<br />
else<br />
stat_fail<br />
fi<br />
}<br />
<br />
add_hook shutdown_poweroff nvidia_card_enable<br />
</nowiki>}}<br />
<br />
=== 多显示器 ===<br />
<br />
你可以通过 xorg.conf 设置多个显示器。设置他们使用 Intel 显卡,然后 Bumblebee 可以仍然使用 NVIDIA 显卡。下面的配置文件示例配置了两个不同的 1080p 的显示器,并且使用了 HDMI 输出。<br />
<br />
{{hc|/etc/X11/xorg.conf|<nowiki><br />
Section "Screen"<br />
Identifier "Screen0"<br />
Device "intelgpu0"<br />
Monitor "Monitor0"<br />
DefaultDepth 24<br />
Option "TwinView" "0"<br />
SubSection "Display"<br />
Depth 24<br />
Modes "1980x1080_60.00"<br />
EndSubSection<br />
EndSection<br />
<br />
Section "Screen"<br />
Identifier "Screen1"<br />
Device "intelgpu1"<br />
Monitor "Monitor1"<br />
DefaultDepth 24<br />
Option "TwinView" "0"<br />
SubSection "Display"<br />
Depth 24<br />
Modes "1980x1080_60.00"<br />
EndSubSection<br />
EndSection<br />
<br />
Section "Monitor"<br />
Identifier "Monitor0"<br />
Option "Enable" "true"<br />
EndSection<br />
<br />
Section "Monitor"<br />
Identifier "Monitor1"<br />
Option "Enable" "true"<br />
EndSection<br />
<br />
Section "Device"<br />
Identifier "intelgpu0"<br />
Driver "intel"<br />
Option "XvMC" "true"<br />
Option "UseEvents" "true"<br />
Option "AccelMethod" "UXA"<br />
BusID "PCI:0:2:0"<br />
EndSection<br />
<br />
Section "Device"<br />
Identifier "intelgpu1"<br />
Driver "intel"<br />
Option "XvMC" "true"<br />
Option "UseEvents" "true"<br />
Option "AccelMethod" "UXA"<br />
BusID "PCI:0:2:0"<br />
EndSection<br />
</nowiki>}}<br />
<br />
你可能需要跳着功能 BusID 字段的值:<br />
<br />
{{hc|<nowiki>$ lspci | grep VGA</nowiki>|<br />
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)<br />
}}<br />
<br />
BusID 的值为 0:2:0<br />
<br />
==不依赖Bumblebee来使用CUDA==<br />
<br />
关于这个的文档不是很多,但是你不需要Bumblebee来使用CUDA。就算实在optirun无法正常运行的机器上CUDA也可能正常运作。如需在Lenovo IdeaPad Y580(使用GeForce 660M显卡)上让使用CUDA,参见:https://wiki.archlinux.org/index.php/Lenovo_IdeaPad_Y580#NVIDIA_Card。那些步骤很有可能也能在其他机器上使用(除了要在acpi上做点小改动,可能不需要这个)。<br />
<br />
==疑难问题==<br />
<br />
{{注意|报告 Bug 的位置在 [https://github.com/Bumblebee-Project/Bumblebee Bumblebee-Project],Bumblebee 的 [https://github.com/Bumblebee-Project/Bumblebee/wiki/Reporting-Issues Wiki] 中描述。}}<br />
<br />
=== [VGL] ERROR: Could not open display :8 ===<br />
<br />
There is a known problem with some wine applications that fork and kill the parent process without keeping track of it (for example the free to play online game "Runes of Magic")<br />
<br />
A workaround for this problem is:<br />
<br />
{{bc|$ optirun bash<br>$ optirun wine <windows program>.exe}}<br />
<br />
If using NVIDA drivers a fix for this problem is to edit /etc/bumblebee/xorg.conf.nvidia and change Option "ConnectedMonitor" to "CRT-0".<br />
<br />
=== [ERROR]Cannot access secondary GPU ===<br />
<br />
有时候,运行optirun会返回:<br />
<br />
{{Ic|[ERROR]Cannot access secondary GPU - error: [XORG] (EE) No devices detected. <br><br />
<br><br />
[ERROR]Aborting because fallback start is disabled.}}<br />
<br />
这种情况下,你需要把文件{{ic|/etc/X11/xorg.conf.d/20-intel.conf}} 移动到别的地方,重启bumblebeed 守护进程,之后应该正常了。<br />
Credit for this goes to Lekensteyn on #bumblebee at freenode.net<br />
<br />
=== 视频撕裂 ===<br />
<br />
视频撕裂是 Bumblebee 上一个常见的问题,要修复这个问题,你需要启用 vsync。默认情况下,Intel 显卡已启用此设置,但是还是检查一下 Xorg 的日志,要检查 nvidia 是否启用了此设置,运行:<br />
<br />
{{bc|$ optirun nvidia-settings -c :8 }}<br />
<br />
{{ic|1=X Server XVideo Settings -> Sync to VBlank}} 以及 {{ic|1=OpenGL Settings -> Sync to VBlank}} 应该都是已经启用状态。 Intel 显卡通常有比较少的撕裂,所以应该作为视频回放设备。特别是使用 VA-API 编码视频的时候(比如:{{ic|mplayer-vaapi}} 以及 {{ic|-vsync}} 参数)。<br />
<br />
参考[[Intel#Video_tearing|Intel]]了解如何修复 Intel 显卡的视频撕裂。<br />
<br />
如果仍然无效,尝试从桌面环境压缩 compositing。同时可尝试禁用 triple buffering。<br />
<br />
== 重要的链接 ==<br />
* [http://www.bumblebee-project.org Bumblebee Project repository]<br />
* [http://wiki.bumblebee-project.org/ Bumblebee Project Wiki]<br />
* [https://github.com/Bumblebee-Project/bbswitch Bumblebee Project bbswitch repository]<br />
<br />
Join us at #bumblebee at freenode.net</div>Yagnbhttps://wiki.archlinux.org/index.php?title=Bumblebee_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=253063Bumblebee (简体中文)2013-04-05T20:24:26Z<p>Yagnb: /* CUDA Without Bumblebee */</p>
<hr />
<div>[[Category:简体中文]]<br />
[[Category:Graphics (简体中文)]]<br />
[[Category:X Server (简体中文)]]<br />
[[en:Bumblebee]]<br />
[[es:Bumblebee]]<br />
[[fr:Bumblebee]]<br />
[[it:Bumblebee]]<br />
[[ru:Bumblebee]]<br />
[[tr:Bumblebee]]<br />
{{TranslationStatus (简体中文)|Bumblebee|2012-07-11|212581}}<br />
转自 Bumblebee [https://github.com/Bumblebee-Project/Bumblebee/wiki/FAQ FAQ]:<br />
<br />
"Bumblebee 致力于使 NVIDIA Optimus 在 GNU/Linux 系统上可用,实现两块不同的供电配置的显卡同时插入使用,共享同一个 framebuffer。"<br />
<br />
== Bumblebee: Linux上的擎天柱 ==<br />
<br />
[http://www.nvidia.com/object/optimus_technology.html Optimus 技术] 是不依赖于硬件复杂结构的 ''[http://hybrid-graphics-linux.tuxfamily.org/index.php?title=Hybrid_graphics 交火显卡 ]'' 实现。独立显卡按需渲染,并传输给集成显卡,集成显卡则负责显示功能。当笔记本通过电池供电时,独立显卡将关闭,以延长电池寿命。<br />
<br />
Bumblebee 是基于 VirtualGl 和内核驱动的软件实现,以支持使用并不是物理直连显示器的独立显卡。<br />
<br />
Bumblebee 试图模拟 Optimus 技术的行为;当需要的时候,使用独立显卡进行渲染,不使用的时候则关闭。当前的版本仅支持按需渲染,电源管理功能仍然在开发之中。<br />
<br />
NVIDIA 独立显卡在管理的时候,是作为一个连接到“伪屏幕”(配置了显示器,但是并不使用)上的独立的 X 服务器的。第二个服务器被称为使用 VirtualGL,因为他看起来就像一个远程服务器。这就是说,你需要一系列步骤来设置内核驱动、X 服务器以及守护进程。<br />
<br />
{{警告|Bumblebee 的开发任务仍然很重! 我们非常欢迎您的帮助。}}<br />
<br />
==安装==<br />
<br />
安装 Bumblebee 之前,如果有可能,检查你的 BIOS 已激活 Optimus (共享显卡, BISO有可能没有提供此项设置),并且为次要显卡安装 [[Intel_Graphics_(简体中文)|intel 驱动]]。<br />
<br />
完整的配置需要安装这些包:<br />
<br />
* {{Pkg|bumblebee}} (或 {{aur|bumblebee-git}}) - 提供守护进程以及程序的主要安装包。<br />
* (可选) {{Pkg|bbswitch}} (或 {{aur|dkms-bbswitch}}) - 推荐安装用来关闭Nvidia显卡省电。<br />
* (可选) 如果你不止想节电,也就是说要在独立的Nvidia显卡上渲染程序,那么你也需要:<br />
** Nvidia显卡驱动。开源的 [[nouveau]] 驱动或是闭源的 [[NVIDIA_(简体中文)|nvidia]] 驱动,参见下面小节。<br />
** 一个渲染/显示的连接。目前有两个包可以适用 {{Pkg|primus}} (或 {{aur|primus-git}}) 和 {{Pkg|virtualgl}}。其中只需要安装一个包,不过两个都安装也不会有问题。<br />
<br />
{{Note|如果你想在64位系统上运行32位程序,你必须为你的程序安装正确的lib32-*库。除此之外,你还要根据你安装的渲染连接来安装 {{Pkg|lib32-virtualgl}} 或者 {{Pkg|lib32-primus}} (或 {{AUR|lib32-primus-git}})。如果你打算使用Primus,你得运行 {{ic|primusrun}} 而不是 {{ic|optirun}}。}}<br />
<br />
=== 为 Intel / nvidia 安装 Bumblebee ===<br />
<br />
* 安装 {{pkg|intel-dri}},{{pkg|bumblebee}} 和 {{pkg|nvidia}}。<br />
<br />
# pacman -S intel-dri bumblebee nvidia<br />
<br />
如果你想要在64位系统上运行32位的程序 (比如用wine来运行游戏) 你需要安装 {{pkg|lib32-nvidia-utils}}。<br />
<br />
# pacman -S lib32-nvidia-utils<br />
<br />
{{Note|不要安装lib32-nvidia-libgl! Bumblebee不需要它来找到正确的32位nvidia运行库。}}<br />
<br />
=== 为 Intel / nouveau 安装 Bumblebee ===<br />
<br />
首先安装 nouveau 以及以来的包:<br />
{{bc|# pacman -S xf86-video-nouveau nouveau-dri mesa}}<br />
<br />
* {{Pkg|xf86-video-nouveau}} experimental 3D acceleration driver<br />
* {{Pkg|nouveau-dri}} Mesa classic DRI + Gallium3D drivers<br />
* {{Pkg|mesa}} Mesa 3-D graphics libraries<br />
<br />
==启动 Bumblebee==<br />
<br />
使用之前,请确保添加相关用户到 Bumblebee 组:<br />
<br />
# usermod -a -G bumblebee $USER<br />
<br />
{{ic|$USER}} 是要添加的用户登录名称。 之后注销,并重新登录,以应用组变更。<br />
<br />
要自动启动 bumblebee,将其添加到启动服务中:<br />
<br />
# systemctl enable bumblebeed.service<br />
<br />
结束了。 - 重启之后,使用 shell 程序 {{ic|[[#Usage|optirun]]}} 来支持 Optimus NVIDIA 渲染!<br />
<br />
== 使用 ==<br />
<br />
随 bumblebee 发布的 {{ic|optirun}} 程序是用来使用 Optimus NVIDIA 显卡的最好方法。<br />
<br />
测试 Bumblebee 是否支持你的 Optimus 系统:<br />
{{bc|$ optirun glxgears -info}}<br />
<br />
如果在终端中看到一个关于你的 Nvidia 的提示,恭喜你,Bumblebee 和 Optimus 已经开始工作了。<br />
<br />
常用命令:<br />
<br />
{{bc|$ optirun [options] <application> [application-parameters]}}<br />
<br />
一些例子:<br />
<br />
启动 firefox ,并使用 Optimus 加速:<br />
<br />
{{bc|$ optirun firefox}}<br />
<br />
启动 Windows 应用程序:<br />
<br />
{{bc|$ optirun wine <windows application>.exe}}<br />
<br />
启动 NVIDIA 设置:<br />
<br />
{{bc|$ optirun nvidia-settings -c :8 }}<br />
<br />
要获取 {{ic|optirun}} 的可用选项,运行:<br />
{{bc|$ optirun --help}}<br />
<br />
== 配置 ==<br />
<br />
你可以按需配置 Bumblebee 的行为,可以通过 {{ic|/etc/bumblebee/bumblebee.conf}} 来调节诸如优化,电源管理,以及其他任务。<br />
<br />
=== 速度优化 ===<br />
<br />
Bumblebee 使用你的 Optimus NVIDIA 显卡来渲染一个配置了 VirtualGL 的不可见的 X 服务器,并且将结果传输到你当前的 X 服务器上。传输之前将压缩侦,这可以节省带宽并且能够用于加速 bumblebee 的优化。<br />
<br />
要为单个应用程序指定不同的压缩方法:<br />
<br />
$ optirun -c <compress-method> application<br />
<br />
压缩方法会影响 GPU性能和GPU使用,压缩方法(比如 {{ic|jpeg}})会最大限度的使用 CPU,并且尽可能少的使用 GPU;非压缩的方法最大限度的使用 GPU,而尽可能少的使用 CPU。<br />
<br />
压缩方法如有: {{ic|jpeg}}, {{ic|rgb}}, {{ic|yuv}}<br />
<br />
非压缩方法有: {{ic|proxy}}, {{ic|xv}}<br />
<br />
要为所有应用程序使用一个标准的压缩方法,在 {{ic|/etc/bumblebee/bumblebee.conf}} 中设置 {{ic|VGLTransport}} to {{ic|<compress-method>}} 。<br />
<br />
{{hc|/etc/bumblebee/bumblebee.conf|<nowiki><br />
...<br />
[optirun]<br />
VGLTransport=proxy<br />
...<br />
</nowiki>}}<br />
<br />
{{注意|CPU频率调节可能会影响渲染的性能。}}<br />
<br />
=== 电源管理 ===<br />
<br />
电源管理的目的是为了自动关闭 bumblebee 不再使用的 NVIDIA 显卡。<br />
<br />
要启用电源管理,需要从 AUR 安装 {{AUR|bbswitch}}。<br />
<br />
{{警告| 确保备用 Xrog 服务器在不用的时候是关闭的!}}<br />
<br />
设置{{ic|/etc/bumblebee/bumblebee.conf}} 中驱动一节的{{ic|PMMethod}} 为 {{ic|bbswitch}}:<br />
<br />
{{hc|/etc/bumblebee/bumblebee.conf|<nowiki><br />
[bumblebeed]<br />
KeepUnusedXServer=false<br />
...<br />
[driver-nvidia]<br />
PMMethod=bbswitch<br />
...<br />
[driver-nouveau]<br />
PMMethod=bbswitch<br />
...<br />
</nowiki>}}<br />
<br />
==== 默认的 NVIDIA 电源状态 ====<br />
<br />
根据你的需要,设置 {{ic|load_state}} 以及 {{ic|unload_state}} 模块选项 (参考 [https://github.com/Bumblebee-Project/bbswitch bbswitch 文档])。<br />
<br />
{{hc|/etc/modprobe.d/bbswitch.conf|<nowiki><br />
options bbswitch load_state=0 unload_state=0<br />
</nowiki>}}<br />
<br />
重启 bumblebee 守护进车功能以激活电源管理功能:<br />
<br />
{{bc|# rc.d restart bumblebeed}}<br />
<br />
==== 关机时启用 NVIDIA 显卡 ====<br />
<br />
如果系统上次关闭时,NVIDIA显卡为关闭(断电)状态,NVIDIA 显卡可能在启动时不能正确初始化。一个解决的办法是在{{ic|/etc/bumblebee/bumblebee.conf}}文件中设置{{ic|TurnCardOffAtExit&#61;false}} ,但是这会导致每次你停止 Bumblebee 守护进程时,NVIDIA 显卡都会启用,即使是你手工关闭守护进程。要保证在关闭时 NVIDIA 显卡总是供电状态,增加如下启动进程[[Boot process#Custom_hooks|钩子函数]] (假如你使用 {{AUR|bbswitch}}的话):<br />
<br />
{{hc|/etc/rc.d/functions.d/nvidia-card-enable|<nowiki><br />
nvidia_card_enable() {<br />
BBSWITCH=/proc/acpi/bbswitch<br />
<br />
stat_busy "Enabling NVIDIA GPU"<br />
<br />
if [ -w ${BBSWITCH} ]; then<br />
echo ON > ${BBSWITCH}<br />
stat_done<br />
else<br />
stat_fail<br />
fi<br />
}<br />
<br />
add_hook shutdown_poweroff nvidia_card_enable<br />
</nowiki>}}<br />
<br />
=== 多显示器 ===<br />
<br />
你可以通过 xorg.conf 设置多个显示器。设置他们使用 Intel 显卡,然后 Bumblebee 可以仍然使用 NVIDIA 显卡。下面的配置文件示例配置了两个不同的 1080p 的显示器,并且使用了 HDMI 输出。<br />
<br />
{{hc|/etc/X11/xorg.conf|<nowiki><br />
Section "Screen"<br />
Identifier "Screen0"<br />
Device "intelgpu0"<br />
Monitor "Monitor0"<br />
DefaultDepth 24<br />
Option "TwinView" "0"<br />
SubSection "Display"<br />
Depth 24<br />
Modes "1980x1080_60.00"<br />
EndSubSection<br />
EndSection<br />
<br />
Section "Screen"<br />
Identifier "Screen1"<br />
Device "intelgpu1"<br />
Monitor "Monitor1"<br />
DefaultDepth 24<br />
Option "TwinView" "0"<br />
SubSection "Display"<br />
Depth 24<br />
Modes "1980x1080_60.00"<br />
EndSubSection<br />
EndSection<br />
<br />
Section "Monitor"<br />
Identifier "Monitor0"<br />
Option "Enable" "true"<br />
EndSection<br />
<br />
Section "Monitor"<br />
Identifier "Monitor1"<br />
Option "Enable" "true"<br />
EndSection<br />
<br />
Section "Device"<br />
Identifier "intelgpu0"<br />
Driver "intel"<br />
Option "XvMC" "true"<br />
Option "UseEvents" "true"<br />
Option "AccelMethod" "UXA"<br />
BusID "PCI:0:2:0"<br />
EndSection<br />
<br />
Section "Device"<br />
Identifier "intelgpu1"<br />
Driver "intel"<br />
Option "XvMC" "true"<br />
Option "UseEvents" "true"<br />
Option "AccelMethod" "UXA"<br />
BusID "PCI:0:2:0"<br />
EndSection<br />
</nowiki>}}<br />
<br />
你可能需要跳着功能 BusID 字段的值:<br />
<br />
{{hc|<nowiki>$ lspci | grep VGA</nowiki>|<br />
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)<br />
}}<br />
<br />
BusID 的值为 0:2:0<br />
<br />
==不依赖Bumblebee来使用CUDA==<br />
<br />
关于这个的文档不是很多,但是你不需要Bumblebee来使用CUDA。就算实在optirun无法正常运行的机器上CUDA也可能正常运作。如需在Lenovo IdeaPad Y580(使用GeForce 660M显卡)上让使用CUDA,参见:https://wiki.archlinux.org/index.php/Lenovo_IdeaPad_Y580#NVIDIA_Card。那些步骤很有可能也能在其他机器上使用(除了要在acpi上做点小改动,可能不需要这个)。<br />
<br />
==疑难问题==<br />
<br />
{{注意|报告 Bug 的位置在 [https://github.com/Bumblebee-Project/Bumblebee Bumblebee-Project],Bumblebee 的 [https://github.com/Bumblebee-Project/Bumblebee/wiki/Reporting-Issues Wiki] 中描述。}}<br />
<br />
=== [VGL] ERROR: Could not open display :8 ===<br />
<br />
There is a known problem with some wine applications that fork and kill the parent process without keeping track of it (for example the free to play online game "Runes of Magic")<br />
<br />
A workaround for this problem is:<br />
<br />
{{bc|$ optirun bash<br>$ optirun wine <windows program>.exe}}<br />
<br />
If using NVIDA drivers a fix for this problem is to edit /etc/bumblebee/xorg.conf.nvidia and change Option "ConnectedMonitor" to "CRT-0".<br />
<br />
=== [ERROR]Cannot access secondary GPU ===<br />
<br />
有时候,运行optirun会返回:<br />
<br />
{{Ic|[ERROR]Cannot access secondary GPU - error: [XORG] (EE) No devices detected. <br><br />
<br><br />
[ERROR]Aborting because fallback start is disabled.}}<br />
<br />
这种情况下,你需要把文件{{ic|/etc/X11/xorg.conf.d/20-intel.conf}} 移动到别的地方,重启bumblebeed 守护进程,之后应该正常了。<br />
Credit for this goes to Lekensteyn on #bumblebee at freenode.net<br />
<br />
=== 视频撕裂 ===<br />
<br />
视频撕裂是 Bumblebee 上一个常见的问题,要修复这个问题,你需要启用 vsync。默认情况下,Intel 显卡已启用此设置,但是还是检查一下 Xorg 的日志,要检查 nvidia 是否启用了此设置,运行:<br />
<br />
{{bc|$ optirun nvidia-settings -c :8 }}<br />
<br />
{{ic|1=X Server XVideo Settings -> Sync to VBlank}} 以及 {{ic|1=OpenGL Settings -> Sync to VBlank}} 应该都是已经启用状态。 Intel 显卡通常有比较少的撕裂,所以应该作为视频回放设备。特别是使用 VA-API 编码视频的时候(比如:{{ic|mplayer-vaapi}} 以及 {{ic|-vsync}} 参数)。<br />
<br />
参考[[Intel#Video_tearing|Intel]]了解如何修复 Intel 显卡的视频撕裂。<br />
<br />
如果仍然无效,尝试从桌面环境压缩 compositing。同时可尝试禁用 triple buffering。<br />
<br />
== 重要的链接 ==<br />
* [http://www.bumblebee-project.org Bumblebee Project repository]<br />
* [http://wiki.bumblebee-project.org/ Bumblebee Project Wiki]<br />
* [https://github.com/Bumblebee-Project/bbswitch Bumblebee Project bbswitch repository]<br />
<br />
Join us at #bumblebee at freenode.net</div>Yagnbhttps://wiki.archlinux.org/index.php?title=Bumblebee_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=253058Bumblebee (简体中文)2013-04-05T20:07:05Z<p>Yagnb: /* 安装 */</p>
<hr />
<div>[[Category:简体中文]]<br />
[[Category:Graphics (简体中文)]]<br />
[[Category:X Server (简体中文)]]<br />
[[en:Bumblebee]]<br />
[[es:Bumblebee]]<br />
[[fr:Bumblebee]]<br />
[[it:Bumblebee]]<br />
[[ru:Bumblebee]]<br />
[[tr:Bumblebee]]<br />
{{TranslationStatus (简体中文)|Bumblebee|2012-07-11|212581}}<br />
转自 Bumblebee [https://github.com/Bumblebee-Project/Bumblebee/wiki/FAQ FAQ]:<br />
<br />
"Bumblebee 致力于使 NVIDIA Optimus 在 GNU/Linux 系统上可用,实现两块不同的供电配置的显卡同时插入使用,共享同一个 framebuffer。"<br />
<br />
== Bumblebee: Linux上的擎天柱 ==<br />
<br />
[http://www.nvidia.com/object/optimus_technology.html Optimus 技术] 是不依赖于硬件复杂结构的 ''[http://hybrid-graphics-linux.tuxfamily.org/index.php?title=Hybrid_graphics 交火显卡 ]'' 实现。独立显卡按需渲染,并传输给集成显卡,集成显卡则负责显示功能。当笔记本通过电池供电时,独立显卡将关闭,以延长电池寿命。<br />
<br />
Bumblebee 是基于 VirtualGl 和内核驱动的软件实现,以支持使用并不是物理直连显示器的独立显卡。<br />
<br />
Bumblebee 试图模拟 Optimus 技术的行为;当需要的时候,使用独立显卡进行渲染,不使用的时候则关闭。当前的版本仅支持按需渲染,电源管理功能仍然在开发之中。<br />
<br />
NVIDIA 独立显卡在管理的时候,是作为一个连接到“伪屏幕”(配置了显示器,但是并不使用)上的独立的 X 服务器的。第二个服务器被称为使用 VirtualGL,因为他看起来就像一个远程服务器。这就是说,你需要一系列步骤来设置内核驱动、X 服务器以及守护进程。<br />
<br />
{{警告|Bumblebee 的开发任务仍然很重! 我们非常欢迎您的帮助。}}<br />
<br />
==安装==<br />
<br />
安装 Bumblebee 之前,如果有可能,检查你的 BIOS 已激活 Optimus (共享显卡, BISO有可能没有提供此项设置),并且为次要显卡安装 [[Intel_Graphics_(简体中文)|intel 驱动]]。<br />
<br />
完整的配置需要安装这些包:<br />
<br />
* {{Pkg|bumblebee}} (或 {{aur|bumblebee-git}}) - 提供守护进程以及程序的主要安装包。<br />
* (可选) {{Pkg|bbswitch}} (或 {{aur|dkms-bbswitch}}) - 推荐安装用来关闭Nvidia显卡省电。<br />
* (可选) 如果你不止想节电,也就是说要在独立的Nvidia显卡上渲染程序,那么你也需要:<br />
** Nvidia显卡驱动。开源的 [[nouveau]] 驱动或是闭源的 [[NVIDIA_(简体中文)|nvidia]] 驱动,参见下面小节。<br />
** 一个渲染/显示的连接。目前有两个包可以适用 {{Pkg|primus}} (或 {{aur|primus-git}}) 和 {{Pkg|virtualgl}}。其中只需要安装一个包,不过两个都安装也不会有问题。<br />
<br />
{{Note|如果你想在64位系统上运行32位程序,你必须为你的程序安装正确的lib32-*库。除此之外,你还要根据你安装的渲染连接来安装 {{Pkg|lib32-virtualgl}} 或者 {{Pkg|lib32-primus}} (或 {{AUR|lib32-primus-git}})。如果你打算使用Primus,你得运行 {{ic|primusrun}} 而不是 {{ic|optirun}}。}}<br />
<br />
=== 为 Intel / nvidia 安装 Bumblebee ===<br />
<br />
* 安装 {{pkg|intel-dri}},{{pkg|bumblebee}} 和 {{pkg|nvidia}}。<br />
<br />
# pacman -S intel-dri bumblebee nvidia<br />
<br />
如果你想要在64位系统上运行32位的程序 (比如用wine来运行游戏) 你需要安装 {{pkg|lib32-nvidia-utils}}。<br />
<br />
# pacman -S lib32-nvidia-utils<br />
<br />
{{Note|不要安装lib32-nvidia-libgl! Bumblebee不需要它来找到正确的32位nvidia运行库。}}<br />
<br />
=== 为 Intel / nouveau 安装 Bumblebee ===<br />
<br />
首先安装 nouveau 以及以来的包:<br />
{{bc|# pacman -S xf86-video-nouveau nouveau-dri mesa}}<br />
<br />
* {{Pkg|xf86-video-nouveau}} experimental 3D acceleration driver<br />
* {{Pkg|nouveau-dri}} Mesa classic DRI + Gallium3D drivers<br />
* {{Pkg|mesa}} Mesa 3-D graphics libraries<br />
<br />
==启动 Bumblebee==<br />
<br />
使用之前,请确保添加相关用户到 Bumblebee 组:<br />
<br />
# usermod -a -G bumblebee $USER<br />
<br />
{{ic|$USER}} 是要添加的用户登录名称。 之后注销,并重新登录,以应用组变更。<br />
<br />
要自动启动 bumblebee,将其添加到启动服务中:<br />
<br />
# systemctl enable bumblebeed.service<br />
<br />
结束了。 - 重启之后,使用 shell 程序 {{ic|[[#Usage|optirun]]}} 来支持 Optimus NVIDIA 渲染!<br />
<br />
== 使用 ==<br />
<br />
随 bumblebee 发布的 {{ic|optirun}} 程序是用来使用 Optimus NVIDIA 显卡的最好方法。<br />
<br />
测试 Bumblebee 是否支持你的 Optimus 系统:<br />
{{bc|$ optirun glxgears -info}}<br />
<br />
如果在终端中看到一个关于你的 Nvidia 的提示,恭喜你,Bumblebee 和 Optimus 已经开始工作了。<br />
<br />
常用命令:<br />
<br />
{{bc|$ optirun [options] <application> [application-parameters]}}<br />
<br />
一些例子:<br />
<br />
启动 firefox ,并使用 Optimus 加速:<br />
<br />
{{bc|$ optirun firefox}}<br />
<br />
启动 Windows 应用程序:<br />
<br />
{{bc|$ optirun wine <windows application>.exe}}<br />
<br />
启动 NVIDIA 设置:<br />
<br />
{{bc|$ optirun nvidia-settings -c :8 }}<br />
<br />
要获取 {{ic|optirun}} 的可用选项,运行:<br />
{{bc|$ optirun --help}}<br />
<br />
== 配置 ==<br />
<br />
你可以按需配置 Bumblebee 的行为,可以通过 {{ic|/etc/bumblebee/bumblebee.conf}} 来调节诸如优化,电源管理,以及其他任务。<br />
<br />
=== 速度优化 ===<br />
<br />
Bumblebee 使用你的 Optimus NVIDIA 显卡来渲染一个配置了 VirtualGL 的不可见的 X 服务器,并且将结果传输到你当前的 X 服务器上。传输之前将压缩侦,这可以节省带宽并且能够用于加速 bumblebee 的优化。<br />
<br />
要为单个应用程序指定不同的压缩方法:<br />
<br />
$ optirun -c <compress-method> application<br />
<br />
压缩方法会影响 GPU性能和GPU使用,压缩方法(比如 {{ic|jpeg}})会最大限度的使用 CPU,并且尽可能少的使用 GPU;非压缩的方法最大限度的使用 GPU,而尽可能少的使用 CPU。<br />
<br />
压缩方法如有: {{ic|jpeg}}, {{ic|rgb}}, {{ic|yuv}}<br />
<br />
非压缩方法有: {{ic|proxy}}, {{ic|xv}}<br />
<br />
要为所有应用程序使用一个标准的压缩方法,在 {{ic|/etc/bumblebee/bumblebee.conf}} 中设置 {{ic|VGLTransport}} to {{ic|<compress-method>}} 。<br />
<br />
{{hc|/etc/bumblebee/bumblebee.conf|<nowiki><br />
...<br />
[optirun]<br />
VGLTransport=proxy<br />
...<br />
</nowiki>}}<br />
<br />
{{注意|CPU频率调节可能会影响渲染的性能。}}<br />
<br />
=== 电源管理 ===<br />
<br />
电源管理的目的是为了自动关闭 bumblebee 不再使用的 NVIDIA 显卡。<br />
<br />
要启用电源管理,需要从 AUR 安装 {{AUR|bbswitch}}。<br />
<br />
{{警告| 确保备用 Xrog 服务器在不用的时候是关闭的!}}<br />
<br />
设置{{ic|/etc/bumblebee/bumblebee.conf}} 中驱动一节的{{ic|PMMethod}} 为 {{ic|bbswitch}}:<br />
<br />
{{hc|/etc/bumblebee/bumblebee.conf|<nowiki><br />
[bumblebeed]<br />
KeepUnusedXServer=false<br />
...<br />
[driver-nvidia]<br />
PMMethod=bbswitch<br />
...<br />
[driver-nouveau]<br />
PMMethod=bbswitch<br />
...<br />
</nowiki>}}<br />
<br />
==== 默认的 NVIDIA 电源状态 ====<br />
<br />
根据你的需要,设置 {{ic|load_state}} 以及 {{ic|unload_state}} 模块选项 (参考 [https://github.com/Bumblebee-Project/bbswitch bbswitch 文档])。<br />
<br />
{{hc|/etc/modprobe.d/bbswitch.conf|<nowiki><br />
options bbswitch load_state=0 unload_state=0<br />
</nowiki>}}<br />
<br />
重启 bumblebee 守护进车功能以激活电源管理功能:<br />
<br />
{{bc|# rc.d restart bumblebeed}}<br />
<br />
==== 关机时启用 NVIDIA 显卡 ====<br />
<br />
如果系统上次关闭时,NVIDIA显卡为关闭(断电)状态,NVIDIA 显卡可能在启动时不能正确初始化。一个解决的办法是在{{ic|/etc/bumblebee/bumblebee.conf}}文件中设置{{ic|TurnCardOffAtExit&#61;false}} ,但是这会导致每次你停止 Bumblebee 守护进程时,NVIDIA 显卡都会启用,即使是你手工关闭守护进程。要保证在关闭时 NVIDIA 显卡总是供电状态,增加如下启动进程[[Boot process#Custom_hooks|钩子函数]] (假如你使用 {{AUR|bbswitch}}的话):<br />
<br />
{{hc|/etc/rc.d/functions.d/nvidia-card-enable|<nowiki><br />
nvidia_card_enable() {<br />
BBSWITCH=/proc/acpi/bbswitch<br />
<br />
stat_busy "Enabling NVIDIA GPU"<br />
<br />
if [ -w ${BBSWITCH} ]; then<br />
echo ON > ${BBSWITCH}<br />
stat_done<br />
else<br />
stat_fail<br />
fi<br />
}<br />
<br />
add_hook shutdown_poweroff nvidia_card_enable<br />
</nowiki>}}<br />
<br />
=== 多显示器 ===<br />
<br />
你可以通过 xorg.conf 设置多个显示器。设置他们使用 Intel 显卡,然后 Bumblebee 可以仍然使用 NVIDIA 显卡。下面的配置文件示例配置了两个不同的 1080p 的显示器,并且使用了 HDMI 输出。<br />
<br />
{{hc|/etc/X11/xorg.conf|<nowiki><br />
Section "Screen"<br />
Identifier "Screen0"<br />
Device "intelgpu0"<br />
Monitor "Monitor0"<br />
DefaultDepth 24<br />
Option "TwinView" "0"<br />
SubSection "Display"<br />
Depth 24<br />
Modes "1980x1080_60.00"<br />
EndSubSection<br />
EndSection<br />
<br />
Section "Screen"<br />
Identifier "Screen1"<br />
Device "intelgpu1"<br />
Monitor "Monitor1"<br />
DefaultDepth 24<br />
Option "TwinView" "0"<br />
SubSection "Display"<br />
Depth 24<br />
Modes "1980x1080_60.00"<br />
EndSubSection<br />
EndSection<br />
<br />
Section "Monitor"<br />
Identifier "Monitor0"<br />
Option "Enable" "true"<br />
EndSection<br />
<br />
Section "Monitor"<br />
Identifier "Monitor1"<br />
Option "Enable" "true"<br />
EndSection<br />
<br />
Section "Device"<br />
Identifier "intelgpu0"<br />
Driver "intel"<br />
Option "XvMC" "true"<br />
Option "UseEvents" "true"<br />
Option "AccelMethod" "UXA"<br />
BusID "PCI:0:2:0"<br />
EndSection<br />
<br />
Section "Device"<br />
Identifier "intelgpu1"<br />
Driver "intel"<br />
Option "XvMC" "true"<br />
Option "UseEvents" "true"<br />
Option "AccelMethod" "UXA"<br />
BusID "PCI:0:2:0"<br />
EndSection<br />
</nowiki>}}<br />
<br />
你可能需要跳着功能 BusID 字段的值:<br />
<br />
{{hc|<nowiki>$ lspci | grep VGA</nowiki>|<br />
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)<br />
}}<br />
<br />
BusID 的值为 0:2:0<br />
<br />
==CUDA Without Bumblebee==<br />
<br />
This is not well documented, but you do not need Bumblebee to use CUDA and it may work even on machines where optirun fails. For a guide on how to get it working with the Lenovo IdeaPad Y580 (which uses the GeForce 660M), see: https://wiki.archlinux.org/index.php/Lenovo_IdeaPad_Y580#NVIDIA_Card. Those instructions are very likely to work with other machines (except for the acpi-handle-hack part, which may not be necessary).<br />
<br />
==疑难问题==<br />
<br />
{{注意|报告 Bug 的位置在 [https://github.com/Bumblebee-Project/Bumblebee Bumblebee-Project],Bumblebee 的 [https://github.com/Bumblebee-Project/Bumblebee/wiki/Reporting-Issues Wiki] 中描述。}}<br />
<br />
=== [VGL] ERROR: Could not open display :8 ===<br />
<br />
There is a known problem with some wine applications that fork and kill the parent process without keeping track of it (for example the free to play online game "Runes of Magic")<br />
<br />
A workaround for this problem is:<br />
<br />
{{bc|$ optirun bash<br>$ optirun wine <windows program>.exe}}<br />
<br />
If using NVIDA drivers a fix for this problem is to edit /etc/bumblebee/xorg.conf.nvidia and change Option "ConnectedMonitor" to "CRT-0".<br />
<br />
=== [ERROR]Cannot access secondary GPU ===<br />
<br />
有时候,运行optirun会返回:<br />
<br />
{{Ic|[ERROR]Cannot access secondary GPU - error: [XORG] (EE) No devices detected. <br><br />
<br><br />
[ERROR]Aborting because fallback start is disabled.}}<br />
<br />
这种情况下,你需要把文件{{ic|/etc/X11/xorg.conf.d/20-intel.conf}} 移动到别的地方,重启bumblebeed 守护进程,之后应该正常了。<br />
Credit for this goes to Lekensteyn on #bumblebee at freenode.net<br />
<br />
=== 视频撕裂 ===<br />
<br />
视频撕裂是 Bumblebee 上一个常见的问题,要修复这个问题,你需要启用 vsync。默认情况下,Intel 显卡已启用此设置,但是还是检查一下 Xorg 的日志,要检查 nvidia 是否启用了此设置,运行:<br />
<br />
{{bc|$ optirun nvidia-settings -c :8 }}<br />
<br />
{{ic|1=X Server XVideo Settings -> Sync to VBlank}} 以及 {{ic|1=OpenGL Settings -> Sync to VBlank}} 应该都是已经启用状态。 Intel 显卡通常有比较少的撕裂,所以应该作为视频回放设备。特别是使用 VA-API 编码视频的时候(比如:{{ic|mplayer-vaapi}} 以及 {{ic|-vsync}} 参数)。<br />
<br />
参考[[Intel#Video_tearing|Intel]]了解如何修复 Intel 显卡的视频撕裂。<br />
<br />
如果仍然无效,尝试从桌面环境压缩 compositing。同时可尝试禁用 triple buffering。<br />
<br />
== 重要的链接 ==<br />
* [http://www.bumblebee-project.org Bumblebee Project repository]<br />
* [http://wiki.bumblebee-project.org/ Bumblebee Project Wiki]<br />
* [https://github.com/Bumblebee-Project/bbswitch Bumblebee Project bbswitch repository]<br />
<br />
Join us at #bumblebee at freenode.net</div>Yagnbhttps://wiki.archlinux.org/index.php?title=Bumblebee_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=253057Bumblebee (简体中文)2013-04-05T20:05:51Z<p>Yagnb: /* 安装 */</p>
<hr />
<div>[[Category:简体中文]]<br />
[[Category:Graphics (简体中文)]]<br />
[[Category:X Server (简体中文)]]<br />
[[en:Bumblebee]]<br />
[[es:Bumblebee]]<br />
[[fr:Bumblebee]]<br />
[[it:Bumblebee]]<br />
[[ru:Bumblebee]]<br />
[[tr:Bumblebee]]<br />
{{TranslationStatus (简体中文)|Bumblebee|2012-07-11|212581}}<br />
转自 Bumblebee [https://github.com/Bumblebee-Project/Bumblebee/wiki/FAQ FAQ]:<br />
<br />
"Bumblebee 致力于使 NVIDIA Optimus 在 GNU/Linux 系统上可用,实现两块不同的供电配置的显卡同时插入使用,共享同一个 framebuffer。"<br />
<br />
== Bumblebee: Linux上的擎天柱 ==<br />
<br />
[http://www.nvidia.com/object/optimus_technology.html Optimus 技术] 是不依赖于硬件复杂结构的 ''[http://hybrid-graphics-linux.tuxfamily.org/index.php?title=Hybrid_graphics 交火显卡 ]'' 实现。独立显卡按需渲染,并传输给集成显卡,集成显卡则负责显示功能。当笔记本通过电池供电时,独立显卡将关闭,以延长电池寿命。<br />
<br />
Bumblebee 是基于 VirtualGl 和内核驱动的软件实现,以支持使用并不是物理直连显示器的独立显卡。<br />
<br />
Bumblebee 试图模拟 Optimus 技术的行为;当需要的时候,使用独立显卡进行渲染,不使用的时候则关闭。当前的版本仅支持按需渲染,电源管理功能仍然在开发之中。<br />
<br />
NVIDIA 独立显卡在管理的时候,是作为一个连接到“伪屏幕”(配置了显示器,但是并不使用)上的独立的 X 服务器的。第二个服务器被称为使用 VirtualGL,因为他看起来就像一个远程服务器。这就是说,你需要一系列步骤来设置内核驱动、X 服务器以及守护进程。<br />
<br />
{{警告|Bumblebee 的开发任务仍然很重! 我们非常欢迎您的帮助。}}<br />
<br />
==安装==<br />
<br />
安装 Bumblebee 之前,如果有可能,检查你的 BIOS 已激活 Optimus (共享显卡, BISO有可能没有提供此项设置),并且为次要显卡安装 [[Intel_Graphics_(简体中文)|intel 驱动]]。<br />
<br />
完整的配置需要安装这些包:<br />
<br />
* {{Pkg|bumblebee}} (或 {{aur|bumblebee-git}}) - 提供守护进程以及程序的主要安装包.<br />
* (可选) {{Pkg|bbswitch}} (或 {{aur|dkms-bbswitch}}) - 推荐安装用来关闭Nvidia显卡省电.<br />
* (可选) 如果你不止想节电,也就是说要在独立的Nvidia显卡上渲染程序,那么你也需要:<br />
** Nvidia显卡驱动. 开源的 [[nouveau]] 驱动或是闭源的 [[NVIDIA_(简体中文)|nvidia]] 驱动,参见下面小节。<br />
** 一个渲染/显示的连接。目前有两个包可以适用 {{Pkg|primus}} (或 {{aur|primus-git}}) 和 {{Pkg|virtualgl}}。其中只需要安装一个包,不过两个都安装也不会有问题。<br />
<br />
{{Note|如果你想在64位系统上运行32位程序,你必须为你的程序安装正确的lib32-*库。除此之外,你还要根据你安装的渲染连接来安装 {{Pkg|lib32-virtualgl}} 或者 {{Pkg|lib32-primus}} (或 {{AUR|lib32-primus-git}})。如果你打算使用Primus,你得运行 {{ic|primusrun}} 而不是 {{ic|optirun}}。}}<br />
<br />
=== 为 Intel / nvidia 安装 Bumblebee ===<br />
<br />
* 安装 {{pkg|intel-dri}},{{pkg|bumblebee}} 和 {{pkg|nvidia}}。<br />
<br />
# pacman -S intel-dri bumblebee nvidia<br />
<br />
如果你想要在64位系统上运行32位的程序 (比如用wine来运行游戏) 你需要安装 {{pkg|lib32-nvidia-utils}}。<br />
<br />
# pacman -S lib32-nvidia-utils<br />
<br />
{{Note|不要安装lib32-nvidia-libgl! Bumblebee不需要它来找到正确的32位nvidia运行库。}}<br />
<br />
=== 为 Intel / nouveau 安装 Bumblebee ===<br />
<br />
首先安装 nouveau 以及以来的包:<br />
{{bc|# pacman -S xf86-video-nouveau nouveau-dri mesa}}<br />
<br />
* {{Pkg|xf86-video-nouveau}} experimental 3D acceleration driver<br />
* {{Pkg|nouveau-dri}} Mesa classic DRI + Gallium3D drivers<br />
* {{Pkg|mesa}} Mesa 3-D graphics libraries<br />
<br />
==启动 Bumblebee==<br />
<br />
使用之前,请确保添加相关用户到 Bumblebee 组:<br />
<br />
# usermod -a -G bumblebee $USER<br />
<br />
{{ic|$USER}} 是要添加的用户登录名称。 之后注销,并重新登录,以应用组变更。<br />
<br />
要自动启动 bumblebee,将其添加到启动服务中:<br />
<br />
# systemctl enable bumblebeed.service<br />
<br />
结束了。 - 重启之后,使用 shell 程序 {{ic|[[#Usage|optirun]]}} 来支持 Optimus NVIDIA 渲染!<br />
<br />
== 使用 ==<br />
<br />
随 bumblebee 发布的 {{ic|optirun}} 程序是用来使用 Optimus NVIDIA 显卡的最好方法。<br />
<br />
测试 Bumblebee 是否支持你的 Optimus 系统:<br />
{{bc|$ optirun glxgears -info}}<br />
<br />
如果在终端中看到一个关于你的 Nvidia 的提示,恭喜你,Bumblebee 和 Optimus 已经开始工作了。<br />
<br />
常用命令:<br />
<br />
{{bc|$ optirun [options] <application> [application-parameters]}}<br />
<br />
一些例子:<br />
<br />
启动 firefox ,并使用 Optimus 加速:<br />
<br />
{{bc|$ optirun firefox}}<br />
<br />
启动 Windows 应用程序:<br />
<br />
{{bc|$ optirun wine <windows application>.exe}}<br />
<br />
启动 NVIDIA 设置:<br />
<br />
{{bc|$ optirun nvidia-settings -c :8 }}<br />
<br />
要获取 {{ic|optirun}} 的可用选项,运行:<br />
{{bc|$ optirun --help}}<br />
<br />
== 配置 ==<br />
<br />
你可以按需配置 Bumblebee 的行为,可以通过 {{ic|/etc/bumblebee/bumblebee.conf}} 来调节诸如优化,电源管理,以及其他任务。<br />
<br />
=== 速度优化 ===<br />
<br />
Bumblebee 使用你的 Optimus NVIDIA 显卡来渲染一个配置了 VirtualGL 的不可见的 X 服务器,并且将结果传输到你当前的 X 服务器上。传输之前将压缩侦,这可以节省带宽并且能够用于加速 bumblebee 的优化。<br />
<br />
要为单个应用程序指定不同的压缩方法:<br />
<br />
$ optirun -c <compress-method> application<br />
<br />
压缩方法会影响 GPU性能和GPU使用,压缩方法(比如 {{ic|jpeg}})会最大限度的使用 CPU,并且尽可能少的使用 GPU;非压缩的方法最大限度的使用 GPU,而尽可能少的使用 CPU。<br />
<br />
压缩方法如有: {{ic|jpeg}}, {{ic|rgb}}, {{ic|yuv}}<br />
<br />
非压缩方法有: {{ic|proxy}}, {{ic|xv}}<br />
<br />
要为所有应用程序使用一个标准的压缩方法,在 {{ic|/etc/bumblebee/bumblebee.conf}} 中设置 {{ic|VGLTransport}} to {{ic|<compress-method>}} 。<br />
<br />
{{hc|/etc/bumblebee/bumblebee.conf|<nowiki><br />
...<br />
[optirun]<br />
VGLTransport=proxy<br />
...<br />
</nowiki>}}<br />
<br />
{{注意|CPU频率调节可能会影响渲染的性能。}}<br />
<br />
=== 电源管理 ===<br />
<br />
电源管理的目的是为了自动关闭 bumblebee 不再使用的 NVIDIA 显卡。<br />
<br />
要启用电源管理,需要从 AUR 安装 {{AUR|bbswitch}}。<br />
<br />
{{警告| 确保备用 Xrog 服务器在不用的时候是关闭的!}}<br />
<br />
设置{{ic|/etc/bumblebee/bumblebee.conf}} 中驱动一节的{{ic|PMMethod}} 为 {{ic|bbswitch}}:<br />
<br />
{{hc|/etc/bumblebee/bumblebee.conf|<nowiki><br />
[bumblebeed]<br />
KeepUnusedXServer=false<br />
...<br />
[driver-nvidia]<br />
PMMethod=bbswitch<br />
...<br />
[driver-nouveau]<br />
PMMethod=bbswitch<br />
...<br />
</nowiki>}}<br />
<br />
==== 默认的 NVIDIA 电源状态 ====<br />
<br />
根据你的需要,设置 {{ic|load_state}} 以及 {{ic|unload_state}} 模块选项 (参考 [https://github.com/Bumblebee-Project/bbswitch bbswitch 文档])。<br />
<br />
{{hc|/etc/modprobe.d/bbswitch.conf|<nowiki><br />
options bbswitch load_state=0 unload_state=0<br />
</nowiki>}}<br />
<br />
重启 bumblebee 守护进车功能以激活电源管理功能:<br />
<br />
{{bc|# rc.d restart bumblebeed}}<br />
<br />
==== 关机时启用 NVIDIA 显卡 ====<br />
<br />
如果系统上次关闭时,NVIDIA显卡为关闭(断电)状态,NVIDIA 显卡可能在启动时不能正确初始化。一个解决的办法是在{{ic|/etc/bumblebee/bumblebee.conf}}文件中设置{{ic|TurnCardOffAtExit&#61;false}} ,但是这会导致每次你停止 Bumblebee 守护进程时,NVIDIA 显卡都会启用,即使是你手工关闭守护进程。要保证在关闭时 NVIDIA 显卡总是供电状态,增加如下启动进程[[Boot process#Custom_hooks|钩子函数]] (假如你使用 {{AUR|bbswitch}}的话):<br />
<br />
{{hc|/etc/rc.d/functions.d/nvidia-card-enable|<nowiki><br />
nvidia_card_enable() {<br />
BBSWITCH=/proc/acpi/bbswitch<br />
<br />
stat_busy "Enabling NVIDIA GPU"<br />
<br />
if [ -w ${BBSWITCH} ]; then<br />
echo ON > ${BBSWITCH}<br />
stat_done<br />
else<br />
stat_fail<br />
fi<br />
}<br />
<br />
add_hook shutdown_poweroff nvidia_card_enable<br />
</nowiki>}}<br />
<br />
=== 多显示器 ===<br />
<br />
你可以通过 xorg.conf 设置多个显示器。设置他们使用 Intel 显卡,然后 Bumblebee 可以仍然使用 NVIDIA 显卡。下面的配置文件示例配置了两个不同的 1080p 的显示器,并且使用了 HDMI 输出。<br />
<br />
{{hc|/etc/X11/xorg.conf|<nowiki><br />
Section "Screen"<br />
Identifier "Screen0"<br />
Device "intelgpu0"<br />
Monitor "Monitor0"<br />
DefaultDepth 24<br />
Option "TwinView" "0"<br />
SubSection "Display"<br />
Depth 24<br />
Modes "1980x1080_60.00"<br />
EndSubSection<br />
EndSection<br />
<br />
Section "Screen"<br />
Identifier "Screen1"<br />
Device "intelgpu1"<br />
Monitor "Monitor1"<br />
DefaultDepth 24<br />
Option "TwinView" "0"<br />
SubSection "Display"<br />
Depth 24<br />
Modes "1980x1080_60.00"<br />
EndSubSection<br />
EndSection<br />
<br />
Section "Monitor"<br />
Identifier "Monitor0"<br />
Option "Enable" "true"<br />
EndSection<br />
<br />
Section "Monitor"<br />
Identifier "Monitor1"<br />
Option "Enable" "true"<br />
EndSection<br />
<br />
Section "Device"<br />
Identifier "intelgpu0"<br />
Driver "intel"<br />
Option "XvMC" "true"<br />
Option "UseEvents" "true"<br />
Option "AccelMethod" "UXA"<br />
BusID "PCI:0:2:0"<br />
EndSection<br />
<br />
Section "Device"<br />
Identifier "intelgpu1"<br />
Driver "intel"<br />
Option "XvMC" "true"<br />
Option "UseEvents" "true"<br />
Option "AccelMethod" "UXA"<br />
BusID "PCI:0:2:0"<br />
EndSection<br />
</nowiki>}}<br />
<br />
你可能需要跳着功能 BusID 字段的值:<br />
<br />
{{hc|<nowiki>$ lspci | grep VGA</nowiki>|<br />
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)<br />
}}<br />
<br />
BusID 的值为 0:2:0<br />
<br />
==CUDA Without Bumblebee==<br />
<br />
This is not well documented, but you do not need Bumblebee to use CUDA and it may work even on machines where optirun fails. For a guide on how to get it working with the Lenovo IdeaPad Y580 (which uses the GeForce 660M), see: https://wiki.archlinux.org/index.php/Lenovo_IdeaPad_Y580#NVIDIA_Card. Those instructions are very likely to work with other machines (except for the acpi-handle-hack part, which may not be necessary).<br />
<br />
==疑难问题==<br />
<br />
{{注意|报告 Bug 的位置在 [https://github.com/Bumblebee-Project/Bumblebee Bumblebee-Project],Bumblebee 的 [https://github.com/Bumblebee-Project/Bumblebee/wiki/Reporting-Issues Wiki] 中描述。}}<br />
<br />
=== [VGL] ERROR: Could not open display :8 ===<br />
<br />
There is a known problem with some wine applications that fork and kill the parent process without keeping track of it (for example the free to play online game "Runes of Magic")<br />
<br />
A workaround for this problem is:<br />
<br />
{{bc|$ optirun bash<br>$ optirun wine <windows program>.exe}}<br />
<br />
If using NVIDA drivers a fix for this problem is to edit /etc/bumblebee/xorg.conf.nvidia and change Option "ConnectedMonitor" to "CRT-0".<br />
<br />
=== [ERROR]Cannot access secondary GPU ===<br />
<br />
有时候,运行optirun会返回:<br />
<br />
{{Ic|[ERROR]Cannot access secondary GPU - error: [XORG] (EE) No devices detected. <br><br />
<br><br />
[ERROR]Aborting because fallback start is disabled.}}<br />
<br />
这种情况下,你需要把文件{{ic|/etc/X11/xorg.conf.d/20-intel.conf}} 移动到别的地方,重启bumblebeed 守护进程,之后应该正常了。<br />
Credit for this goes to Lekensteyn on #bumblebee at freenode.net<br />
<br />
=== 视频撕裂 ===<br />
<br />
视频撕裂是 Bumblebee 上一个常见的问题,要修复这个问题,你需要启用 vsync。默认情况下,Intel 显卡已启用此设置,但是还是检查一下 Xorg 的日志,要检查 nvidia 是否启用了此设置,运行:<br />
<br />
{{bc|$ optirun nvidia-settings -c :8 }}<br />
<br />
{{ic|1=X Server XVideo Settings -> Sync to VBlank}} 以及 {{ic|1=OpenGL Settings -> Sync to VBlank}} 应该都是已经启用状态。 Intel 显卡通常有比较少的撕裂,所以应该作为视频回放设备。特别是使用 VA-API 编码视频的时候(比如:{{ic|mplayer-vaapi}} 以及 {{ic|-vsync}} 参数)。<br />
<br />
参考[[Intel#Video_tearing|Intel]]了解如何修复 Intel 显卡的视频撕裂。<br />
<br />
如果仍然无效,尝试从桌面环境压缩 compositing。同时可尝试禁用 triple buffering。<br />
<br />
== 重要的链接 ==<br />
* [http://www.bumblebee-project.org Bumblebee Project repository]<br />
* [http://wiki.bumblebee-project.org/ Bumblebee Project Wiki]<br />
* [https://github.com/Bumblebee-Project/bbswitch Bumblebee Project bbswitch repository]<br />
<br />
Join us at #bumblebee at freenode.net</div>Yagnbhttps://wiki.archlinux.org/index.php?title=Bumblebee_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=253051Bumblebee (简体中文)2013-04-05T19:41:25Z<p>Yagnb: /* 为 Intel / nvidia 安装 Bumblebee */</p>
<hr />
<div>[[Category:简体中文]]<br />
[[Category:Graphics (简体中文)]]<br />
[[Category:X Server (简体中文)]]<br />
[[en:Bumblebee]]<br />
[[es:Bumblebee]]<br />
[[fr:Bumblebee]]<br />
[[it:Bumblebee]]<br />
[[ru:Bumblebee]]<br />
[[tr:Bumblebee]]<br />
{{TranslationStatus (简体中文)|Bumblebee|2012-07-11|212581}}<br />
转自 Bumblebee [https://github.com/Bumblebee-Project/Bumblebee/wiki/FAQ FAQ]:<br />
<br />
"Bumblebee 致力于使 NVIDIA Optimus 在 GNU/Linux 系统上可用,实现两块不同的供电配置的显卡同时插入使用,共享同一个 framebuffer。"<br />
<br />
== Bumblebee: Linux上的擎天柱 ==<br />
<br />
[http://www.nvidia.com/object/optimus_technology.html Optimus 技术] 是不依赖于硬件复杂结构的 ''[http://hybrid-graphics-linux.tuxfamily.org/index.php?title=Hybrid_graphics 交火显卡 ]'' 实现。独立显卡按需渲染,并传输给集成显卡,集成显卡则负责显示功能。当笔记本通过电池供电时,独立显卡将关闭,以延长电池寿命。<br />
<br />
Bumblebee 是基于 VirtualGl 和内核驱动的软件实现,以支持使用并不是物理直连显示器的独立显卡。<br />
<br />
Bumblebee 试图模拟 Optimus 技术的行为;当需要的时候,使用独立显卡进行渲染,不使用的时候则关闭。当前的版本仅支持按需渲染,电源管理功能仍然在开发之中。<br />
<br />
NVIDIA 独立显卡在管理的时候,是作为一个连接到“伪屏幕”(配置了显示器,但是并不使用)上的独立的 X 服务器的。第二个服务器被称为使用 VirtualGL,因为他看起来就像一个远程服务器。这就是说,你需要一系列步骤来设置内核驱动、X 服务器以及守护进程。<br />
<br />
{{警告|Bumblebee 的开发任务仍然很重! 我们非常欢迎您的帮助。}}<br />
<br />
==安装==<br />
<br />
安装 Bumblebee 之前,如果有可能,检查你的 BIOS 已激活 Optimus (共享显卡, BISO有可能没有提供此项设置),并且为次要显卡安装 [[Intel|intel 驱动]]。<br />
<br />
{{注意|如果你需要在 64 位系统上运行 32 位应用程序,你必须安装 {{AUR|lib32-virtualgl}} 以及 proper lib32-* 库。}}<br />
<br />
=== 为 Intel / nvidia 安装 Bumblebee ===<br />
<br />
* 安装 {{pkg|intel-dri}}, {{pkg|bumblebee}} 和 {{pkg|nvidia}}.<br />
<br />
# pacman -S intel-dri bumblebee nvidia<br />
<br />
如果你想要在64位系统上运行32位的程序 (比如用wine来运行游戏) 你需要安装 {{pkg|lib32-nvidia-utils}}.<br />
<br />
# pacman -S lib32-nvidia-utils<br />
<br />
{{Note|不要安装lib32-nvidia-libgl! Bumblebee不需要它来找到正确的32位nvidia运行库.}}<br />
<br />
=== 为 Intel / nouveau 安装 Bumblebee ===<br />
<br />
首先安装 nouveau 以及以来的包:<br />
{{bc|# pacman -S xf86-video-nouveau nouveau-dri mesa}}<br />
<br />
* {{Pkg|xf86-video-nouveau}} experimental 3D acceleration driver<br />
* {{Pkg|nouveau-dri}} Mesa classic DRI + Gallium3D drivers<br />
* {{Pkg|mesa}} Mesa 3-D graphics libraries<br />
<br />
现在从 [[Arch User Repository|AUR]] 安装 {{AUR|bumblebee}} :<br />
<br />
{{注意|如果你希望 bumblebee 在使用之后自动关闭 NVIDIA 显卡,你需要使用 AUR 提供的 {{AUR|bbswitch}} 包。参考下文的 [[#电源管理]]。}}<br />
<br />
==启动 Bumblebee==<br />
<br />
使用之前,请确保添加相关用户到 Bumblebee 组:<br />
<br />
# usermod -a -G bumblebee $USER<br />
<br />
{{ic|$USER}} 是要添加的用户登录名称。 之后注销,并重新登录,以应用组变更。<br />
<br />
要自动启动 bumblebee,将其添加到启动服务中:<br />
<br />
# systemctl enable bumblebeed.service<br />
<br />
结束了。 - 重启之后,使用 shell 程序 {{ic|[[#Usage|optirun]]}} 来支持 Optimus NVIDIA 渲染!<br />
<br />
== 使用 ==<br />
<br />
随 bumblebee 发布的 {{ic|optirun}} 程序是用来使用 Optimus NVIDIA 显卡的最好方法。<br />
<br />
测试 Bumblebee 是否支持你的 Optimus 系统:<br />
{{bc|$ optirun glxgears -info}}<br />
<br />
如果在终端中看到一个关于你的 Nvidia 的提示,恭喜你,Bumblebee 和 Optimus 已经开始工作了。<br />
<br />
常用命令:<br />
<br />
{{bc|$ optirun [options] <application> [application-parameters]}}<br />
<br />
一些例子:<br />
<br />
启动 firefox ,并使用 Optimus 加速:<br />
<br />
{{bc|$ optirun firefox}}<br />
<br />
启动 Windows 应用程序:<br />
<br />
{{bc|$ optirun wine <windows application>.exe}}<br />
<br />
启动 NVIDIA 设置:<br />
<br />
{{bc|$ optirun nvidia-settings -c :8 }}<br />
<br />
要获取 {{ic|optirun}} 的可用选项,运行:<br />
{{bc|$ optirun --help}}<br />
<br />
== 配置 ==<br />
<br />
你可以按需配置 Bumblebee 的行为,可以通过 {{ic|/etc/bumblebee/bumblebee.conf}} 来调节诸如优化,电源管理,以及其他任务。<br />
<br />
=== 速度优化 ===<br />
<br />
Bumblebee 使用你的 Optimus NVIDIA 显卡来渲染一个配置了 VirtualGL 的不可见的 X 服务器,并且将结果传输到你当前的 X 服务器上。传输之前将压缩侦,这可以节省带宽并且能够用于加速 bumblebee 的优化。<br />
<br />
要为单个应用程序指定不同的压缩方法:<br />
<br />
$ optirun -c <compress-method> application<br />
<br />
压缩方法会影响 GPU性能和GPU使用,压缩方法(比如 {{ic|jpeg}})会最大限度的使用 CPU,并且尽可能少的使用 GPU;非压缩的方法最大限度的使用 GPU,而尽可能少的使用 CPU。<br />
<br />
压缩方法如有: {{ic|jpeg}}, {{ic|rgb}}, {{ic|yuv}}<br />
<br />
非压缩方法有: {{ic|proxy}}, {{ic|xv}}<br />
<br />
要为所有应用程序使用一个标准的压缩方法,在 {{ic|/etc/bumblebee/bumblebee.conf}} 中设置 {{ic|VGLTransport}} to {{ic|<compress-method>}} 。<br />
<br />
{{hc|/etc/bumblebee/bumblebee.conf|<nowiki><br />
...<br />
[optirun]<br />
VGLTransport=proxy<br />
...<br />
</nowiki>}}<br />
<br />
{{注意|CPU频率调节可能会影响渲染的性能。}}<br />
<br />
=== 电源管理 ===<br />
<br />
电源管理的目的是为了自动关闭 bumblebee 不再使用的 NVIDIA 显卡。<br />
<br />
要启用电源管理,需要从 AUR 安装 {{AUR|bbswitch}}。<br />
<br />
{{警告| 确保备用 Xrog 服务器在不用的时候是关闭的!}}<br />
<br />
设置{{ic|/etc/bumblebee/bumblebee.conf}} 中驱动一节的{{ic|PMMethod}} 为 {{ic|bbswitch}}:<br />
<br />
{{hc|/etc/bumblebee/bumblebee.conf|<nowiki><br />
[bumblebeed]<br />
KeepUnusedXServer=false<br />
...<br />
[driver-nvidia]<br />
PMMethod=bbswitch<br />
...<br />
[driver-nouveau]<br />
PMMethod=bbswitch<br />
...<br />
</nowiki>}}<br />
<br />
==== 默认的 NVIDIA 电源状态 ====<br />
<br />
根据你的需要,设置 {{ic|load_state}} 以及 {{ic|unload_state}} 模块选项 (参考 [https://github.com/Bumblebee-Project/bbswitch bbswitch 文档])。<br />
<br />
{{hc|/etc/modprobe.d/bbswitch.conf|<nowiki><br />
options bbswitch load_state=0 unload_state=0<br />
</nowiki>}}<br />
<br />
重启 bumblebee 守护进车功能以激活电源管理功能:<br />
<br />
{{bc|# rc.d restart bumblebeed}}<br />
<br />
==== 关机时启用 NVIDIA 显卡 ====<br />
<br />
如果系统上次关闭时,NVIDIA显卡为关闭(断电)状态,NVIDIA 显卡可能在启动时不能正确初始化。一个解决的办法是在{{ic|/etc/bumblebee/bumblebee.conf}}文件中设置{{ic|TurnCardOffAtExit&#61;false}} ,但是这会导致每次你停止 Bumblebee 守护进程时,NVIDIA 显卡都会启用,即使是你手工关闭守护进程。要保证在关闭时 NVIDIA 显卡总是供电状态,增加如下启动进程[[Boot process#Custom_hooks|钩子函数]] (假如你使用 {{AUR|bbswitch}}的话):<br />
<br />
{{hc|/etc/rc.d/functions.d/nvidia-card-enable|<nowiki><br />
nvidia_card_enable() {<br />
BBSWITCH=/proc/acpi/bbswitch<br />
<br />
stat_busy "Enabling NVIDIA GPU"<br />
<br />
if [ -w ${BBSWITCH} ]; then<br />
echo ON > ${BBSWITCH}<br />
stat_done<br />
else<br />
stat_fail<br />
fi<br />
}<br />
<br />
add_hook shutdown_poweroff nvidia_card_enable<br />
</nowiki>}}<br />
<br />
=== 多显示器 ===<br />
<br />
你可以通过 xorg.conf 设置多个显示器。设置他们使用 Intel 显卡,然后 Bumblebee 可以仍然使用 NVIDIA 显卡。下面的配置文件示例配置了两个不同的 1080p 的显示器,并且使用了 HDMI 输出。<br />
<br />
{{hc|/etc/X11/xorg.conf|<nowiki><br />
Section "Screen"<br />
Identifier "Screen0"<br />
Device "intelgpu0"<br />
Monitor "Monitor0"<br />
DefaultDepth 24<br />
Option "TwinView" "0"<br />
SubSection "Display"<br />
Depth 24<br />
Modes "1980x1080_60.00"<br />
EndSubSection<br />
EndSection<br />
<br />
Section "Screen"<br />
Identifier "Screen1"<br />
Device "intelgpu1"<br />
Monitor "Monitor1"<br />
DefaultDepth 24<br />
Option "TwinView" "0"<br />
SubSection "Display"<br />
Depth 24<br />
Modes "1980x1080_60.00"<br />
EndSubSection<br />
EndSection<br />
<br />
Section "Monitor"<br />
Identifier "Monitor0"<br />
Option "Enable" "true"<br />
EndSection<br />
<br />
Section "Monitor"<br />
Identifier "Monitor1"<br />
Option "Enable" "true"<br />
EndSection<br />
<br />
Section "Device"<br />
Identifier "intelgpu0"<br />
Driver "intel"<br />
Option "XvMC" "true"<br />
Option "UseEvents" "true"<br />
Option "AccelMethod" "UXA"<br />
BusID "PCI:0:2:0"<br />
EndSection<br />
<br />
Section "Device"<br />
Identifier "intelgpu1"<br />
Driver "intel"<br />
Option "XvMC" "true"<br />
Option "UseEvents" "true"<br />
Option "AccelMethod" "UXA"<br />
BusID "PCI:0:2:0"<br />
EndSection<br />
</nowiki>}}<br />
<br />
你可能需要跳着功能 BusID 字段的值:<br />
<br />
{{hc|<nowiki>$ lspci | grep VGA</nowiki>|<br />
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)<br />
}}<br />
<br />
BusID 的值为 0:2:0<br />
<br />
==CUDA Without Bumblebee==<br />
<br />
This is not well documented, but you do not need Bumblebee to use CUDA and it may work even on machines where optirun fails. For a guide on how to get it working with the Lenovo IdeaPad Y580 (which uses the GeForce 660M), see: https://wiki.archlinux.org/index.php/Lenovo_IdeaPad_Y580#NVIDIA_Card. Those instructions are very likely to work with other machines (except for the acpi-handle-hack part, which may not be necessary).<br />
<br />
==疑难问题==<br />
<br />
{{注意|报告 Bug 的位置在 [https://github.com/Bumblebee-Project/Bumblebee Bumblebee-Project],Bumblebee 的 [https://github.com/Bumblebee-Project/Bumblebee/wiki/Reporting-Issues Wiki] 中描述。}}<br />
<br />
=== [VGL] ERROR: Could not open display :8 ===<br />
<br />
There is a known problem with some wine applications that fork and kill the parent process without keeping track of it (for example the free to play online game "Runes of Magic")<br />
<br />
A workaround for this problem is:<br />
<br />
{{bc|$ optirun bash<br>$ optirun wine <windows program>.exe}}<br />
<br />
If using NVIDA drivers a fix for this problem is to edit /etc/bumblebee/xorg.conf.nvidia and change Option "ConnectedMonitor" to "CRT-0".<br />
<br />
=== [ERROR]Cannot access secondary GPU ===<br />
<br />
有时候,运行optirun会返回:<br />
<br />
{{Ic|[ERROR]Cannot access secondary GPU - error: [XORG] (EE) No devices detected. <br><br />
<br><br />
[ERROR]Aborting because fallback start is disabled.}}<br />
<br />
这种情况下,你需要把文件{{ic|/etc/X11/xorg.conf.d/20-intel.conf}} 移动到别的地方,重启bumblebeed 守护进程,之后应该正常了。<br />
Credit for this goes to Lekensteyn on #bumblebee at freenode.net<br />
<br />
=== 视频撕裂 ===<br />
<br />
视频撕裂是 Bumblebee 上一个常见的问题,要修复这个问题,你需要启用 vsync。默认情况下,Intel 显卡已启用此设置,但是还是检查一下 Xorg 的日志,要检查 nvidia 是否启用了此设置,运行:<br />
<br />
{{bc|$ optirun nvidia-settings -c :8 }}<br />
<br />
{{ic|1=X Server XVideo Settings -> Sync to VBlank}} 以及 {{ic|1=OpenGL Settings -> Sync to VBlank}} 应该都是已经启用状态。 Intel 显卡通常有比较少的撕裂,所以应该作为视频回放设备。特别是使用 VA-API 编码视频的时候(比如:{{ic|mplayer-vaapi}} 以及 {{ic|-vsync}} 参数)。<br />
<br />
参考[[Intel#Video_tearing|Intel]]了解如何修复 Intel 显卡的视频撕裂。<br />
<br />
如果仍然无效,尝试从桌面环境压缩 compositing。同时可尝试禁用 triple buffering。<br />
<br />
== 重要的链接 ==<br />
* [http://www.bumblebee-project.org Bumblebee Project repository]<br />
* [http://wiki.bumblebee-project.org/ Bumblebee Project Wiki]<br />
* [https://github.com/Bumblebee-Project/bbswitch Bumblebee Project bbswitch repository]<br />
<br />
Join us at #bumblebee at freenode.net</div>Yagnb