Sawfish
Sawfish 是一款高度可自定义的窗口管理器。它曾经是 GNOME 桌面的标准窗口管理器,但由于维护者变更,情况已不再如此。本文将向您展示如何安装和配置它以独立使用(不使用 GNOME)。
安装
启动
使用 xinit 启动 sawfish
。
自定义
开箱即用的 Sawfish 提供了一个菜单,可以通过在根窗口上单击鼠标中键(Mouse-2)来访问。从那里,您可以启动自定义应用程序。
如果您更改任何设置,它们将存储在 ~/.sawfish/custom
中。
主题
您可以从自定义应用程序中选择窗口主题。这里有一个小 bug:如果主题是可参数化的,则其配置窗口仅在您重启自定义应用程序后才会出现。
添加新的
创建目录 ~/.sawfish/themes/
并在其中放入任何主题文件。您无需解压缩它们。在 Sawfish 网站上有 500 多个主题可供选择。
菜单
Arch 没有为 Sawfish 提供自动菜单生成器,但您可以使用 XFCE4 的菜单生成菜单。以下是必要的步骤
创建目录 ~/.sawfish/lisp/
。这是存储自定义 Sawfish 脚本的地方;菜单将是其中之一。安装 libxslt,复制 xslt 样式表示例,并将其粘贴到名为 xfce4-menu-to-sawfish.xslt
的文件中。现在您需要一个 XFCE4 菜单。您可能已经有一个,或者您可以使用 menumaker 或 xdg_menu 生成一个。
- 如果您想使用 menumaker
$ mmaker -c xfce4 | xsltproc xfce4-menu-to-sawfish.xslt - > ~/.sawfish/lisp/arch-menu.jl
- 如果您想使用 archlinux-xdg-menu
$ xdg_menu --format xfce4 --root-menu /etc/xdg/menus/arch-applications.menu | xsltproc xfce4-menu-to-sawfish.xslt - > ~/.sawfish/lisp/arch-menu.jl
现在您有了一个脚本 ~/.sawfish/lisp/arch-menu.jl
,它定义了一个变量 arch-menu,其中包含您的应用程序列表。您需要从根菜单链接到它。您需要在 ~/.sawfishrc
中编写代码来实现这一点。因此,启动您最喜欢的编辑器,创建 ~/.sawfishrc
,然后输入
;;; sawfish configuration file ; 1. Load defaults (require 'sawfish-defaults) ; 2. Load autogenerated arch-menu (require 'arch-menu) ; 3. Replace Sawfish's apps-menu with ours (setq apps-menu arch-menu)
重启 Sawfish 以使更改生效。
菜单示例
xfce4-menu-to-sawfish.xslt
<?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text"/> <xsl:strip-space elements="*"/> <xsl:param name="terminal">urxvt</xsl:param> <xsl:template name="indent"> <xsl:text> </xsl:text> <xsl:for-each select="ancestor-or-self::*"> <xsl:text> </xsl:text> </xsl:for-each> </xsl:template> <xsl:template match="/"> <xsl:text>;;; Arch applications menu for Sawfish, generated from xfce4 menu (defvar arch-menu nil) (setq arch-menu '(</xsl:text> <xsl:apply-templates/> <xsl:text>)) </xsl:text> </xsl:template> <xsl:template match="menu[.//app]"> <xsl:call-template name="indent"/> <xsl:text>("</xsl:text> <xsl:value-of select="@name"/> <xsl:text>"</xsl:text> <xsl:apply-templates/> <xsl:text>)</xsl:text> </xsl:template> <xsl:template match="app"> <xsl:call-template name="indent"/> <xsl:text>("</xsl:text> <xsl:value-of select="@name"/> <xsl:text>" (system "</xsl:text> <xsl:if test="@term='true'"> <xsl:copy-of select="$terminal"/> <xsl:text> -e </xsl:text> </xsl:if> <xsl:value-of select="@cmd"/> <xsl:text> &"))</xsl:text> </xsl:template> </xsl:stylesheet>
附加资源
- Sawfish Wiki - 官方网站