Difference between revisions of "Awesome (简体中文)"

From ArchWiki
Jump to navigation Jump to search
Line 30: Line 30:
 
如果你对不稳定的预览版本有兴趣,可以安装 {{aur|awesome-git}}。但是请注意,这是一个不稳定的开发版,配置文件会有语法差异。
 
如果你对不稳定的预览版本有兴趣,可以安装 {{aur|awesome-git}}。但是请注意,这是一个不稳定的开发版,配置文件会有语法差异。
  
==开始==
+
==使用Awesome==
  
===使用Awesome===
+
===不使用登陆管理器===
  
 
不使用登录管理器来运行 awesome,只要添加 '''{{Ic|exec awesome}}'''
 
不使用登录管理器来运行 awesome,只要添加 '''{{Ic|exec awesome}}'''
Line 40: Line 40:
 
[[PolicyKit]] 相关文档。当你不使用登录管理器时,系统不会自动载入任何东西。
 
[[PolicyKit]] 相关文档。当你不使用登录管理器时,系统不会自动载入任何东西。
 
有些情况下,使用 '''{{Ic|exec ck-launch-session awesome}}''' 能帮你解决问题。
 
有些情况下,使用 '''{{Ic|exec ck-launch-session awesome}}''' 能帮你解决问题。
为了确保这个命令正常知心,请安装 {{Pkg|consolekit}} 软件包,
+
为了确保这个命令正常执行,请安装 {{Pkg|consolekit}} 软件包,
 
否则, '''ck-launch-session''' 将不能正常识别。请查看 [[ConsoleKit]] 。
 
否则, '''ck-launch-session''' 将不能正常识别。请查看 [[ConsoleKit]] 。
  
使用登录管理器启动Awesome的办法可以参考[[Display Manager|登录管理器]].  
+
你也可以甚至不用登陆直接使用预置用户启动Awesome,请参考[[Start X at boot]]
 +
=== 使用登陆管理器 ===
 +
要想用登陆管理器启动awesome,看[[Display Manager (简体中文)|这里]].  
  
 
"[[SLIM]]" 是一个流行的轻量级登录管理器,十分受推崇。要使用SLIM登录Awesome,你可以这么做:
 
"[[SLIM]]" 是一个流行的轻量级登录管理器,十分受推崇。要使用SLIM登录Awesome,你可以这么做:
  
1) 编辑 /etc/slim.conf 把Awesome加进去. <br>例如:
+
编辑{{ic|/etc/slim.conf}}把Awesome加进去。例如:
 
  sessions            awesome,wmii,xmonad
 
  sessions            awesome,wmii,xmonad
 
你可以可以不使用登录管理器进入Awesome。可以参考[[Start X at boot]].
 
 
一种简单的办法是把"{{ic|exec awesome}}"加入你的启动脚本(比如 ~/.xinitrc)中。
 
  
 
编辑 ~/.xinitrc file  
 
编辑 ~/.xinitrc file  
 
  DEFAULT_SESSION=awesome
 
  DEFAULT_SESSION=awesome
 
  case $1 in
 
  case $1 in
   awesome) exec awesome ;;
+
   awesome|wmii|xmonad) exec $1 ;;
  wmii) exec wmii ;;
 
  xmonad) exec xmonad ;;
 
 
   *) exec $DEFAULT_SESSION ;;
 
   *) exec $DEFAULT_SESSION ;;
 
  esac
 
  esac
  
当然,你也能不用登录管理器来启动 awesome。通过编辑 ~/.xinitrc 和 /etc/inittab ,
+
==配置==
甚至可以做到不用登录即可启动 awesome。阅读文章 [[Start X at boot]]。
+
Awesome默认的配置已经很不错了,不过你迟早会想要做一些修改的。配置文件是一个lua脚本:{{ic|~/.config/awesome/rc.lua}}.
  
==设置==
+
===创建配置文件===
Awesome刚一装好带有一些很不错的默认设置,不过你迟早会想要做一些修改的。配置文件是一个lua脚本:{{ic|~/.config/awesome/rc.lua}}.
+
创建配置文件所在的文件夹
 
 
===创建设置文件===
 
创建设置文件所在的文件夹
 
 
   $ mkdir -p ~/.config/awesome/
 
   $ mkdir -p ~/.config/awesome/
  
Awesome会自动使用~/.config/awesome/rc.lua里的所有配置。这个文件并不会自动创建,所以我们先要从样本复制一个过来:
+
Awesome会自动使用~/.config/awesome/rc.lua里的所有配置。这个文件并不会自动创建,所以我们先要从模板复制一个过来:
 
  $ cp /etc/xdg/awesome/rc.lua ~/.config/awesome
 
  $ cp /etc/xdg/awesome/rc.lua ~/.config/awesome
  
Line 80: Line 73:
 
要获得关于配置Awesome的更多信息,请看[http://awesome.naquadah.org/wiki/Awesome_3_configuration Awesome wiki的配置部分]
 
要获得关于配置Awesome的更多信息,请看[http://awesome.naquadah.org/wiki/Awesome_3_configuration Awesome wiki的配置部分]
  
===更多资源===
+
===更多的配置资源===
 
{{注意|Awesome配置文件语法有时会变化,所以你可能得动手修改下载的配置文件。}}
 
{{注意|Awesome配置文件语法有时会变化,所以你可能得动手修改下载的配置文件。}}
  
一些不错的rc.lua可以在下面这些站点找到:
+
一些不错的rc.lua的例子可以在下面这些站点找到:
  
 
* http://git.sysphere.org/awesome-configs/tree/ - Adrian C 的 Awesome 3.4 配置文件。 (anrxc)
 
* http://git.sysphere.org/awesome-configs/tree/ - Adrian C 的 Awesome 3.4 配置文件。 (anrxc)
Line 97: Line 90:
 
===用 Xephyr 测试 rc.lua===
 
===用 Xephyr 测试 rc.lua===
  
用这种方式可以在不改变现有桌面的情况下对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
+
用这种方式可以在不破坏现有桌面的情况下对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
  
 
  $ Xephyr -ac -br -noreset -screen 1152x720 :1 &
 
  $ Xephyr -ac -br -noreset -screen 1152x720 :1 &
Line 103: Line 96:
  
 
这种方式的巨大优势在于如果你弄坏了rc.lua.new,你不至于把现有的Awesome桌面弄得一团糟(并且很可能还会把XWindow弄崩溃了,没保存的工作全部丢失………)。一旦你觉得新的配置文件不错,就用rc.lua.new代替rc.lua,然后重启Awesome。
 
这种方式的巨大优势在于如果你弄坏了rc.lua.new,你不至于把现有的Awesome桌面弄得一团糟(并且很可能还会把XWindow弄崩溃了,没保存的工作全部丢失………)。一旦你觉得新的配置文件不错,就用rc.lua.new代替rc.lua,然后重启Awesome。
 +
 +
目前(2011.07),还有一个工具{{aur|awmtt}}可以提供上述功能。
  
 
==主题==
 
==主题==
  
Beautiful可以让你动态地改变背景图片和颜色主题,而不需要改变rc.lua文件。
+
[http://awesome.naquadah.org/wiki/Beautiful Beautiful]可以让你动态地改变背景图片和颜色主题,而不需要改变rc.lua文件。
  
 
默认的主题文件是 /usr/share/awesome/themes/default。把它复制到 ~/.config/awesome/themes/default 然后修改一下 rc.lua中的theme_path。  
 
默认的主题文件是 /usr/share/awesome/themes/default。把它复制到 ~/.config/awesome/themes/default 然后修改一下 rc.lua中的theme_path。  
 +
beautiful.init(awful.util.getdir("config") .. "/themes/default/theme.lua")
  
 
更多细节参考[http://awesome.naquadah.org/wiki/Beautiful 这里]
 
更多细节参考[http://awesome.naquadah.org/wiki/Beautiful 这里]
  
一个[http://awesome.naquadah.org/wiki/Beautiful_themes 主题样本]
+
一些样例:[http://awesome.naquadah.org/wiki/Beautiful_themes themes]
  
 
===设置墙纸===
 
===设置墙纸===
Line 134: Line 130:
 
}}
 
}}
  
==Tips & Tricks==
+
==小技巧==
Feel free to add any tips or tricks that you would like to pass on to other awesome users.
+
如果你有自己的小技巧想与大家分享,请随意添加。
 
 
===Use awesome as GNOME's window manager===
 
GNOME has the advantage of being very "ready to use" and integrating. You can set up GNOME to use awesome as the visual interface, but have GNOME work in the background for your pleasure. If you are using GNOME 3, you can simply install the [https://aur.archlinux.org/packages.php?ID=53096 awesome-gnome] package, then when logging in with GDM, choose the session type "Awesome GNOME". See the [https://awesome.naquadah.org/wiki/Quickly_Setting_up_Awesome_with_Gnome awesome wiki] for details.
 
  
===Expose effect like compiz===
+
===使用awesome作为GNOME的窗口管理器===
 +
GNOME有“开包即用”的优势,你可以在使用GNOME的同时改用awesome作为窗口管理器。如果你在用GNOME 3的话,你可以安装[https://aur.archlinux.org/packages.php?ID=53096 awesome-gnome]包,然后在用GDM登陆的时候选择"Awesome GNOME"。更多详细内容请参考[http://awesome.naquadah.org/wiki/Quickly_Setting_up_Awesome_with_Gnome awesome wiki]。
  
Revelation brings up a view of all your open clients; left-clicking a client pops to the first tag that client is visible on and raises/focuses the client. In addition, the Enter key pops to the currently focused client, and Escape aborts.
+
===像compiz那样的平铺桌面效果===
  
http://awesome.naquadah.org/wiki/Revelation
+
Revelation可以显示所有你开启的客户端;左键点击客户端会跳到该客户端所在的第一个标签并聚焦于该客户端。按下回车键会跳到当前聚焦的客户端,按下ESc键退出。更多内容请参考[http://awesome.naquadah.org/wiki/Revelation]。
  
===Hide / show wibox in awesome 3===
+
===在awesome 3中显示/隐藏wibox===
  
 
To map Modkey-b to hide/show default statusbar on active screen (as default in awesome 2.3), add to your ''globalkeys'' in rc.lua:
 
To map Modkey-b to hide/show default statusbar on active screen (as default in awesome 2.3), add to your ''globalkeys'' in rc.lua:
Line 201: Line 195:
 
See [http://awesome.naquadah.org/wiki/Naughty the awesome wiki page on naughty].
 
See [http://awesome.naquadah.org/wiki/Naughty the awesome wiki page on naughty].
  
===弹出式菜单===
+
===Popup Menus===
 +
There's a simple menu by default in awesome3, and customed menus seem very easy now. However, if you're using 2.x awesome, have a look at ''[http://awesome.naquadah.org/wiki/Awful.menu awful.menu]''.
  
awesome3 中自带一个很容易自定义的简单菜单。如果你在使用 2.x awesome,
+
If you want a freedesktop.org menu, you could take a look at ''[https://github.com/terceiro/awesome-freedesktop awesome-freedesktop]'' .
你需要阅读 ''[http://awesome.naquadah.org/wiki/Awful.menu awful.menu]''
 
  
awesome3 的一个范例:
+
An example for awesome3:
 
{{bc|1=
 
{{bc|1=
 
myawesomemenu = {
 
myawesomemenu = {
Line 234: Line 228:
 
}}
 
}}
  
===awesome 中的桌面插件===
+
===More Widgets in awesome===
 
+
''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].
awesome 中的桌面插件是可以放到任意一个 widget-box 中(状态栏和标题栏)。
 
它们可以通过窗口管理器提供或者设置系统的动态信息。
 
桌面插件使用简单,并提供一大堆可扩展的功能。
 
-- 来自 [http://awesome.naquadah.org/wiki/Widgets_in_awesome Awesome Wiki: Widgets]
 
  
有一个被广泛使用的库叫做 '''Wicked''' (适合 awesome '''< 3.4'''),
+
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].
能够提供例如 MPD 插件、CPU 使用情况、内存使用情况等等很多插件。
 
详细信息查阅 [http://awesome.naquadah.org/wiki/Wicked Wicked page]
 
  
awesome v3.4 中作为 Wicked 的替代品,请查阅
+
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].
'''[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 documentation]
 
  
 
===Transparency===
 
===Transparency===
Line 291: Line 274:
 
     [...]
 
     [...]
 
     awful.key({ modkey }, "Next", function (c)
 
     awful.key({ modkey }, "Next", function (c)
         exec("transset-df --actual --inc 0.1")
+
         awful.util.spawn("transset-df --actual --inc 0.1")
 
     end),
 
     end),
 
     awful.key({ modkey }, "Prior", function (c)
 
     awful.key({ modkey }, "Prior", function (c)
         exec("transset-df --actual --dec 0.1")
+
         awful.util.spawn("transset-df --actual --dec 0.1")
 
     end),
 
     end),
 
     -- Your other key bindings
 
     -- Your other key bindings
Line 308: Line 291:
 
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:
 
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:
  
  os.execute"dex -a"
+
  os.execute"dex -a -e Awesome"
  
 
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:
 
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:
Line 374: Line 357:
 
#Install {{Pkg|wmname}} from community
 
#Install {{Pkg|wmname}} from community
 
#Run the following command or add it to your {{ic|.xinitrc}}: {{bc|wmname LG3D}}
 
#Run the following command or add it to your {{ic|.xinitrc}}: {{bc|wmname LG3D}}
 +
 +
{{Note|
 +
If you use a non-reparenting window manager and Java 6, you should uncomment the corresponding line in {{Ic|/etc/profile.d/openjdk6.sh}}
 +
 +
If you use a non-reparenting window manager and Java 7, you should uncomment the corresponding line in
 +
{{Ic|/etc/profile.d/jre.sh}}
 +
}}
  
 
===Prevent Nautilus from displaying the desktop (Gnome3)===
 
===Prevent Nautilus from displaying the desktop (Gnome3)===
Run dconf-editor. Navigate to org->background and uncheck "draw-background" as well as "show-desktop-icons" for good measure. That's it!
+
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!
  
 
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.
 
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.
Line 395: Line 385:
 
  end
 
  end
 
  end
 
  end
 
+
 
  procs = {"gnome-settings-daemon", "nm-applet", "kupfer", "gnome-sound-applet", "gnome-power-manager"}
 
  procs = {"gnome-settings-daemon", "nm-applet", "kupfer", "gnome-sound-applet", "gnome-power-manager"}
 
  for k = 1, #procs do
 
  for k = 1, #procs do
Line 409: Line 399:
  
 
==Troubleshooting==
 
==Troubleshooting==
 +
 +
===LibreOffice===
 +
If you encounter UI problems with libreoffice install libreoffice-gnome.
  
 
===Mod4 key===
 
===Mod4 key===
Line 460: Line 453:
 
     { rule = { instance = "plugin-container" },
 
     { rule = { instance = "plugin-container" },
 
       properties = { floating = true } },
 
       properties = { floating = true } },
 +
 +
With Chromium add
 +
 +
    { rule = { instance = "exe" },
 +
      properties = { floating = true } },
 +
 +
===Starting console clients on specific tags===
 +
It does not work when the console application is invoked from a GTK terminal (e.g. LXTerminal). [[URxvt]] is known to work.
 +
 +
===Redirecting console output to a file===
 +
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].
 +
 +
As example, let's redirect [[Luakit]] output to a temporary file:
 +
 +
awful.key({ modkey, }, "w", function () awful.util.spawn_with_shell("luakit 2>>/tmp/luakit.log") end),
  
 
==External Links==
 
==External Links==

Revision as of 13:11, 3 October 2012

Tango-preferences-desktop-locale.png本页面需要更新翻译,内容可能已经与英文脱节。要贡献翻译,请访问简体中文翻译组Tango-preferences-desktop-locale.png

附注: please use the first argument of the template to provide more detailed indications.

Template:Article summary start Template:Article summary text Template:Article summary end

From the awesome website:

"awesome is a highly configurable, next generation framework window manager for X. It is very fast, extensible and licensed under the GNU GPLv2 license.

It is primarly targeted at power users, developers and any people dealing with every day computing tasks and who want to have fine-grained control on its graphical environment." 来自awesome网站:

Awesome 是 XWindows 下可高度定制的新一代窗口管理器。运行快捷、扩展性强,遵循GPLv2发布。

Awesome主要面向高级用户、开发者和那些希望完美控制自己电脑的图形界面的人。

安装

安装位于官方软件仓库的软件包 awesome

如果你对不稳定的预览版本有兴趣,可以安装 awesome-gitAUR。但是请注意,这是一个不稳定的开发版,配置文件会有语法差异。

使用Awesome

不使用登陆管理器

不使用登录管理器来运行 awesome,只要添加 exec awesome 到你的启动脚本(比如 ~/.xinitrc)。

如果你使用一些外设有问题(比如 usb 密钥,dvd),请阅读 HALPolicyKit 相关文档。当你不使用登录管理器时,系统不会自动载入任何东西。 有些情况下,使用 exec ck-launch-session awesome 能帮你解决问题。 为了确保这个命令正常执行,请安装 consolekit 软件包, 否则, ck-launch-session 将不能正常识别。请查看 ConsoleKit

你也可以甚至不用登陆直接使用预置用户启动Awesome,请参考Start X at boot

使用登陆管理器

要想用登陆管理器启动awesome,看这里.

"SLIM" 是一个流行的轻量级登录管理器,十分受推崇。要使用SLIM登录Awesome,你可以这么做:

编辑/etc/slim.conf把Awesome加进去。例如:

sessions             awesome,wmii,xmonad

编辑 ~/.xinitrc file

DEFAULT_SESSION=awesome
case $1 in
  awesome|wmii|xmonad) exec $1 ;;
  *) exec $DEFAULT_SESSION ;;
esac

配置

Awesome默认的配置已经很不错了,不过你迟早会想要做一些修改的。配置文件是一个lua脚本:~/.config/awesome/rc.lua.

创建配置文件

创建配置文件所在的文件夹

 $ mkdir -p ~/.config/awesome/

Awesome会自动使用~/.config/awesome/rc.lua里的所有配置。这个文件并不会自动创建,所以我们先要从模板复制一个过来:

$ cp /etc/xdg/awesome/rc.lua ~/.config/awesome

配置文件的语法会随着Awesome的版本升级而变化,所以当你升级了之后遇到问题时,重复上面的步骤,或者你得手动修改配置文件。

要获得关于配置Awesome的更多信息,请看Awesome wiki的配置部分

更多的配置资源

注意: Awesome配置文件语法有时会变化,所以你可能得动手修改下载的配置文件。

一些不错的rc.lua的例子可以在下面这些站点找到:

用 Xephyr 测试 rc.lua

用这种方式可以在不破坏现有桌面的情况下对rc.lua进行测试。首先把 rc.lua 复制到一个新文件rc.lua.new,接着进行修改。然后在Xephyr中运行新的rc.lua (Xephyr允许你在XWindow中植入一个新的XWindow - screenshot)。 你可以这样测试你的新rc.lua

$ Xephyr -ac -br -noreset -screen 1152x720 :1 &
$ DISPLAY=:1.0 awesome -c ~/.config/awesome/rc.lua.new

这种方式的巨大优势在于如果你弄坏了rc.lua.new,你不至于把现有的Awesome桌面弄得一团糟(并且很可能还会把XWindow弄崩溃了,没保存的工作全部丢失………)。一旦你觉得新的配置文件不错,就用rc.lua.new代替rc.lua,然后重启Awesome。

目前(2011.07),还有一个工具awmttAUR可以提供上述功能。

主题

Beautiful可以让你动态地改变背景图片和颜色主题,而不需要改变rc.lua文件。

默认的主题文件是 /usr/share/awesome/themes/default。把它复制到 ~/.config/awesome/themes/default 然后修改一下 rc.lua中的theme_path。

beautiful.init(awful.util.getdir("config") .. "/themes/default/theme.lua")

更多细节参考这里

一些样例:themes

设置墙纸

Beautiful 可以设置墙纸,所以你就不用在.xinitrc 或者 .xsession 中自己设置了。Beautiful 允许你给每个主题配一个墙纸。如果你看一看默认的主题文件,可以找到一个 wallpaper_cmd 值。当beautiful.init("path_to_theme_file")运行的时候,给定的命令就会运行。如果不想要 Beautiful 修改你的墙纸,你可以在这里自己定义一个命令,或者把这个值注释掉。

例如,如果你想用 awsetbg 设置墙纸,你可以这样写:

wallpaper_cmd = { "awsetbg -f .config/awesome/themes/awesome-wallpaper.png" }

注意: 要让Awsetbg工作,你需要有一个能设置背景图片的软件,比如"Feh"。

随机墙纸

想要随机切换墙纸,只需要注释掉 wallpaper_cmd 一行,然后使用下面的代码添加脚本到到你的 .xinitrc 文件中:

while true;
do
  awsetbg -r <path/to/the/directory/of/your/wallpapers>
  sleep 15m
done &

小技巧

如果你有自己的小技巧想与大家分享,请随意添加。

使用awesome作为GNOME的窗口管理器

GNOME有“开包即用”的优势,你可以在使用GNOME的同时改用awesome作为窗口管理器。如果你在用GNOME 3的话,你可以安装awesome-gnome包,然后在用GDM登陆的时候选择"Awesome GNOME"。更多详细内容请参考awesome wiki

像compiz那样的平铺桌面效果

Revelation可以显示所有你开启的客户端;左键点击客户端会跳到该客户端所在的第一个标签并聚焦于该客户端。按下回车键会跳到当前聚焦的客户端,按下ESc键退出。更多内容请参考[1]

在awesome 3中显示/隐藏wibox

To map Modkey-b to hide/show default statusbar on active screen (as default in awesome 2.3), add to your globalkeys in rc.lua:

awful.key({ modkey }, "b", function ()
    mywibox[mouse.screen].visible = not mywibox[mouse.screen].visible
end),

Enable printscreens

To enable printscreens in awesome through the PrtScr button you need to have a screen capturing program. Scrot is a easy to use utility for this purpose and is available in Arch repositories.

Just type:

# pacman -S scrot

and install optional dependencies if you feel that you need them.

Next of we need to get the key name for PrtScr, most often this is named "Print" but one can never be too sure.

Start up:

# xev

And press the PrtScr button, the output should be something like:

 KeyPress event ....
     root 0x25c, subw 0x0, ...
     state 0x0, keycode 107 (keysym 0xff61, Print), same_screen YES,
     ....

In my case as you see, the keyname is Print.

Now to the configuration of awesome!

Somewhere in your globalkeys array (doesn't matter where) type:

Lua code:

 awful.key({ }, "Print", function () awful.util.spawn("scrot -e 'mv $f ~/screenshots/ 2>/dev/null'") end),

Also, this function saves screenshots inside ~/screenshots/, edit this to fit your needs.

Dynamic tagging

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.

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!

Space Invaders

Space Invaders is a demo to show the possibilities of the Awesome Lua API.

Please note that it is no longer included in the Awesome package since the 3.4-rc1 release.

Naughty for popup notification

See the awesome wiki page on naughty.

Popup Menus

There's a simple menu by default in awesome3, and customed menus seem very easy now. However, if you're using 2.x awesome, have a look at awful.menu.

If you want a freedesktop.org menu, you could take a look at awesome-freedesktop .

An example for awesome3:

myawesomemenu = {
   { "lock", "xscreensaver-command -activate" },
   { "manual", terminal .. " -e man awesome" },
   { "edit config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua" },
   { "restart", awesome.restart },
   { "quit", awesome.quit }
}

mycommons = {
   { "pidgin", "pidgin" },
   { "OpenOffice", "soffice-dev" },
   { "Graphic", "gimp" }
}

mymainmenu = awful.menu.new({ items = { 
                                        { "terminal", terminal },
                                        { "icecat", "icecat" },
                                        { "Editor", "gvim" },
                                        { "File Manager", "pcmanfm" },
                                        { "VirtualBox", "VirtualBox" },
                                        { "Common App", mycommons, beautiful.awesome_icon },
                                        { "awesome", myawesomemenu, beautiful.awesome_icon }
                                       }
                             })

More Widgets in awesome

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 Awesome Wiki: Widgets.

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 Wicked page.

As a replacement for Wicked in awesome v3.4 check Vicious, Obvious and Bashets. If you pick vicious, you should also take a good look at vicious documentation.

Transparency

Awesome has support for true transparency through xcompmgr. Note that you'll probably want the git version of xcompmgr, which is available in AUR.

Add this to your ~/.xinitrc:

xcompmgr &

See man xcompmgr or xcompmgr for more options.

In awesome 3.4, window transparency can be set dynamically using signals. For example, your rc.lua could contain the following:

client.add_signal("focus", function(c)
                              c.border_color = beautiful.border_focus
                              c.opacity = 1
                           end)
client.add_signal("unfocus", function(c)
                                c.border_color = beautiful.border_normal
                                c.opacity = 0.7
                             end)

If you got error messages about add_signal, using connect_signal insteaded.

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:

own_window yes
own_window_transparent yes
own_window_type desktop

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.

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:

bg_normal = #000000AA

where "AA" is the transparency value.

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:

globalkeys = awful.util.table.join(
    -- your keybindings
    [...]
    awful.key({ modkey }, "Next", function (c)
        awful.util.spawn("transset-df --actual --inc 0.1")
    end),
    awful.key({ modkey }, "Prior", function (c)
        awful.util.spawn("transset-df --actual --dec 0.1")
    end),
    -- Your other key bindings
    [...]
)

ImageMagick

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).

Autorun programs

See also the Autostart page on the Awesome wiki.

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 os.execute). To run the same programs on startup as GNOME or KDE, you can install dex from the AUR and then run that in your rc.lua:

os.execute"dex -a -e Awesome"

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:

do
  local cmds = 
  { 
    "swiftfox",
    "mutt",
    "consonance",
    "linux-fetion",
    "weechat-curses",
    --and so on...
  }

  for _,i in pairs(cmds) do
    awful.util.spawn(i)
  end
end

(You could also run calls to os.execute with commands ending in '&', but it's probably a better idea to stick to the proper spawn function.)

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 pgrep doesn't find a running process with the same name:

function run_once(prg)
  awful.util.spawn_with_shell("pgrep -u $USER -x " .. prg .. " || (" .. prg .. ")")
end

So, for example, to run parcellite only if there is not a parcellite process already running:

run_once("parcellite")

Passing content to widgets with awesome-client

You can easily send text to an awesome widget. Just create a new widget:

 mywidget = widget({ type = "textbox", name = "mywidget" })
 mywidget.text = "initial text"

To update the text from an external source, use awesome-client:

 
 echo -e 'mywidget.text = "new text"' | awesome-client

Don't forget to add the widget to your wibox.

Using a different panel with awesome

If you like awesome's lightweightness and functionality but do not like the way its default panel looks, you can install a different panel. Just install xfce4-panel by issuing:

sudo pacman -S xfce4-panel

Of course any other panel will do as well. Then add it to autorun section of your rc.lua (how to do that is written elsewhere on this wiki). You can also comment out the section which creates wiboxes for each screen (starting from "mywibox[s] = awful.wibox({ position = "top", screen = s })" ) but it isn't necessary. Any way do not forget to check your rc.lua for errors by typing

awesome -k rc.lua

Also you should change your "modkey+R" keybinding, in order to start some other application launcher instead of built in awesome. Xfrun4, bashrun, etc. Check the Application launchers section of Openbox article for examples. Don't forget to add

      properties = { floating = true } },
    { rule = { instance = "$yourapplicationlauncher" },

to your rc.lua.

Fix Java (GUI appears gray only)

Guide taken from [2].

  1. Install wmname from community
  2. Run the following command or add it to your .xinitrc:
    wmname LG3D
Note:

If you use a non-reparenting window manager and Java 6, you should uncomment the corresponding line in /etc/profile.d/openjdk6.sh

If you use a non-reparenting window manager and Java 7, you should uncomment the corresponding line in /etc/profile.d/jre.sh

Prevent Nautilus from displaying the desktop (Gnome3)

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!

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.

#!/bin/sh
/usr/bin/nautilus-real --no-desktop $@

Transitioning away from Gnome3

Run 'gnome-session-properties' and remove programs that you won't be needing anymore (e.g Bluetooth Manager, Login Sounds, etc).

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 SLiM), but you can do things manually if you wish. That entails setting up your .xinitrc properly and installing something like devmon (AUR).

If you wan't to keep a few convenient systray applets and your GTK theme, append this to your rc.lua;

function start_daemon(dae)
	daeCheck = os.execute("ps -eF | grep -v grep | grep -w " .. dae)
	if (daeCheck ~= 0) then
		os.execute(dae .. " &")
	end
end

procs = {"gnome-settings-daemon", "nm-applet", "kupfer", "gnome-sound-applet", "gnome-power-manager"}
for k = 1, #procs do
	start_daemon(procs[k])
end

Prevent the mouse scroll wheel from changing tags

In your rc.lua, change the Mouse Bindings section to the following;

-- {{{ Mouse bindings
root.buttons(awful.util.table.join(
    awful.button({ }, 3, function () mymainmenu:toggle() end)))
-- }}}

Troubleshooting

LibreOffice

If you encounter UI problems with libreoffice install libreoffice-gnome.

Mod4 key

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

$ xev

It should be 115 for the left one. Then add this to your ~/.xinitrc

xmodmap -e "keycode 115 = Super_L" -e "add mod4 = Super_L"
exec awesome

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.

Mod4 key vs. IBM ThinkPad users

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:

modkey = "Mod4"

by:

modkey = "Mod1"

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.

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

clear lock 
add mod4 = Caps_Lock

and (re)load the file. 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.

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):

keysym Caps_Lock = Super_L Caps_Lock

Brasero

If Brasero doesn't detect your blank disks when started in Awesome, but works just fine when started in Gnome, try using

$ dbus-launch brasero

Eclipse: cannot resize/move main window

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.

Note: workbench.xml can be found in: <eclipse_workspace>/.metadata/.plugins/org.eclipse.ui.workbench/ and the line to edit is <window height="xx" maximized="true" width="xx" x="xx" y="xx">.

YouTube: fullscreen appears in background

[3] If YouTube videos appear underneath your web browser when in fullscreen mode, add this to your rc.lua

   { rule = { instance = "plugin-container" },
     properties = { floating = true } },

With Chromium add

   { rule = { instance = "exe" },
     properties = { floating = true } },

Starting console clients on specific tags

It does not work when the console application is invoked from a GTK terminal (e.g. LXTerminal). URxvt is known to work.

Redirecting console output to a file

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 awful.util.spawn function does not handle pipes and redirections very well as stated in the official FAQ.

As example, let's redirect Luakit output to a temporary file:

awful.key({ modkey, }, "w", function () awful.util.spawn_with_shell("luakit 2>>/tmp/luakit.log") end),

External Links