Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| zh-cn:howto:xfwm4_theme [2012/04/29 08:59] – [窗口侧边和底部] haobug | zh-cn:howto:xfwm4_theme [2026/11/06 04:13] (current) – removed kevinbowen | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Xfwm4 主题 how-to ====== | ||
| - | |||
| - | ===== 介绍 ===== | ||
| - | |||
| - | Xfwm4,Xfce4 的原生的窗口管理器,使用一种简单而灵活基于像素图的主题引擎,它用 .xpm 格式的图像。Xfwm4 还使用一个文本文件,配置其他选项(见 themerc 节)。此外,你还可以选用 gtk 主题颜色,这将文档在 gtk 颜色一节提到。 | ||
| - | |||
| - | {{ howto: | ||
| - | |||
| - | ===== 主题的存放位置 ===== | ||
| - | |||
| - | 在 Xfwm4 4.0 版本中,主题搜索在下列目录: | ||
| - | |||
| - | * 用户主目录/ | ||
| - | * 系统共享数据目录/ | ||
| - | |||
| - | 在 Xfwm 4.2 版本中,主题的存放位置是符合标准的,在下列目录搜索: | ||
| - | * 用户主目录/ | ||
| - | * 系统共享数据目录/ | ||
| - | |||
| - | |||
| - | ===== 标题栏装饰 ===== | ||
| - | |||
| - | 因为窗口可以处于激活的((获得焦点))或者非激活((失去焦点))两种状态。所以 xfwm4 使用相应命名的像素图,例如,title-1-active.xpm 或者 title-1-inactive.xpm。 | ||
| - | |||
| - | 对于标题栏的装饰,xfwm4 使用5张名为 title-1-active.xpm 到 title-5-active.xpm 的像素图以及 top-left-active.xpm 和 top-right-active.xpm 组成两端的角如下图所示。 | ||
| - | |||
| - | {{ howto: | ||
| - | |||
| - | 非激活 xfwm4 窗口像素图使用一样的命名约定,只是词换为 inactive;例如,title-1-inactive.xpm。 | ||
| - | |||
| - | 标题文字的颜色和阴影选项,对齐方式等在 themerc 文件中设置(在themerc节详述)。 | ||
| - | |||
| - | ===== 窗口侧边和底部 ===== | ||
| - | |||
| - | 每一个窗口的侧边由两个像素图构成。左侧边的像素图叫 left-active.xpm 和 bottom-left-active.xpm 。右侧边(当然)也就是由 | ||
| - | |||
| - | 窗口底部的控制条由 bottom-active.xpm 和 bottom-inactive.xpm 构成;当改变窗口大小时它们会被重复来填充窗口。 | ||
| - | |||
| - | N.B 这些像素图也构成鼠标控制柄,当你考虑它们需要多少像素宽度时,请记得这点(特别是左下和右下像素图,它们构成窗口主要的缩放控制柄)。 | ||
| - | |||
| - | **Xfwm4 按钮** | ||
| - | |||
| - | xfwm4可以使用最多6个动作按钮 - 粘附(粘滞窗口),菜单,折叠,隐藏,最大化和关闭。 | ||
| - | |||
| - | 按钮有激活的((获得焦点))或者非激活((失去焦点))和按下三种状态。如下图所示: | ||
| - | |||
| - | ^ 图 3 - Xfwm4 按钮状态 ^ | ||
| - | | {{howto: | ||
| - | |||
| - | Xfwm4 也使用“切换”按钮,来指示按钮是否被切换 —— 见图4 | ||
| - | |||
| - | ^ 图 4 - 带额外切换按钮的粘附按钮 ^^ | ||
| - | | | ||
| - | |||
| - | ===== Themerc file ===== | ||
| - | |||
| - | To set features such as title text colors, " | ||
| - | |||
| - | ==== Button layout ==== | ||
| - | It is also possible to " | ||
| - | |||
| - | # button_layout : | ||
| - | # O = Option menu | ||
| - | # T = Stick | ||
| - | # H = hide | ||
| - | # S = shade | ||
| - | # M = maximize | ||
| - | # C = close | ||
| - | # | = title | ||
| - | button_layout=OTS|HMC | ||
| - | |||
| - | A working example of this is the " | ||
| - | |||
| - | |||
| - | ==== Title width ==== | ||
| - | Another setting that needs to be set from the " | ||
| - | |||
| - | When set to " | ||
| - | |||
| - | {{ howto: | ||
| - | |||
| - | When set to " | ||
| - | |||
| - | {{ howto: | ||
| - | |||
| - | ==== Text shadow ==== | ||
| - | A shadow can be added to the title text by setting the boolean value " | ||
| - | |||
| - | Possible values are " | ||
| - | |||
| - | ==== Title offset ==== | ||
| - | The title text position can be adjusted to fit the theme design by using the offset values. The horizontal and vertical values can be adjusted by using the following settings: | ||
| - | |||
| - | * title_horizontal_offset | ||
| - | * title_vertical_offset_active | ||
| - | * title_vertical_offset_inactive | ||
| - | |||
| - | ==== Button offset and spacing ==== | ||
| - | Simlilarily, | ||
| - | |||
| - | The " | ||
| - | |||
| - | ===== Gtk Color pickup ==== | ||
| - | As you have no doubt noticed when using Xfwm4' | ||
| - | |||
| - | The color symbols are as follow : | ||
| - | ^ Name ^ Description ^ | ||
| - | | active_text_color | Text color on title for active window | | ||
| - | | inactive_text_color | Text color on title for inactive window | | ||
| - | | active_border_color | Very rarely used usually set to black | | ||
| - | | inactive_border_color | Idem | | ||
| - | | active_color_1 | Background color for active title | | ||
| - | | active_color_2 | Background color for active window | | ||
| - | | active_hilight_1 | Lighter color for active title for 3D look | | ||
| - | | active_hilight_2 | Lighter color for active window | | ||
| - | | active_mid_1 | Slightly darker color for active title | | ||
| - | | active_mid_2 | Slightly darker color for active window | | ||
| - | | active_shadow_1 | Darker color for active title for 3D look | | ||
| - | | active_shadow_2 | Darker color for active window | | ||
| - | | inactive_color_1 | Background color for inactive title | | ||
| - | | inactive_color_2 | Background color for inactive window | | ||
| - | | inactive_hilight_1 | Lighter color for inactive title for 3D look | | ||
| - | | inactive_hilight_2 | Lighter color for inactive window | | ||
| - | | inactive_mid_1 | Slightly darker color for inactive title | | ||
| - | | inactive_mid_2 | Slightly darker color for inactive window | | ||
| - | | inactive_shadow_1 | Darker color for inactive title for 3D look | | ||
| - | | inactive_shadow_2 | Darker color for inactive window | | ||
| - | |||
| - | The symbols get replaced by the actual color values at runtime so that the window borders inherits GTK theme colors automatically. | ||
| - | Xpm file format used natively by xfwm4 is no more than a plain text file that can be edited with your favorite text editor. | ||
| - | |||
| - | ===== From Wikipedia, the free encyclopedia. ===== | ||
| - | XPM (X PixMap) is an ASCII image format used by the X Window System. It was created in 1989 by Daniel Dardailler and Colas Nahaboo working in Inria Laboratories, | ||
| - | |||
| - | Therefore, if you open an xpm file with your favorite text editor, you'll see something like this: | ||
| - | |||
| - | /* XPM */ | ||
| - | static char * title_2_active_xpm[] = { | ||
| - | "5 21 10 1", | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | "# | ||
| - | " | ||
| - | " | ||
| - | "& | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | |||
| - | Not going too deep into the details of the XPM format, an XPM image is made of different sections, the values that describe the format of the image, the colors that compose the image, the pixels (and there is also the extensions, but it's safe to ignore them for now) | ||
| - | |||
| - | A character is assigned to each color of the image (if the image has more colors than available charaters, then more than a single character can be assiged to a colors). | ||
| - | |||
| - | To get the gtk colors applied to your theme, you need to edit the XPM files and add the proper color symbols to the color definition table. | ||
| - | |||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | "# | ||
| - | " | ||
| - | " | ||
| - | "& | ||
| - | " | ||
| - | " | ||
| - | |||
| - | must be changed to | ||
| - | |||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | "# | ||
| - | " | ||
| - | " | ||
| - | "& | ||
| - | " | ||
| - | " | ||
| - | |||
| - | As a matter of fact, " | ||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | ===== Xfwm 4.2 new functionality ===== | ||
| - | As simple as it is, the color symbol replacement table of the XPM format is not powerfull enough to achive the nice color gradients seen in most recent themes. | ||
| - | |||
| - | Xfwm 4.2 includes yet another functionality that gives real nice result while being still compatible with the previous theme format: It composes the final image from the XPM file and it colors replacement table, and another PNG file with transparency, | ||
| - | |||
| - | {{ howto: | ||
| - | |||
| - | The names of the PNG files are identical to the names of the corresponding XPM files, with the " | ||
| - | |||
| - | This technique has several advantages: | ||
| - | |||
| - | * It's fairly simple from a theme designer point of view, most people are working with similar techniques when composing themes with tools such as [[http:// | ||
| - | * It's backward compatible with xfwm4 from Xfce 4.0, the PNG files are just ignored by xfwm4 4.0. | ||
| - | |||
| - | |||
| - | |||
| - | ===== Conclusion ===== | ||
| - | I hope this small " | ||
| - | |||
| - | you can also find xfce theme at [[http:// | ||
| - | |||
| - | ===== List of frame and button part names ===== | ||
| - | |||
| - | This is a list of all possible part names in a decoration, so you can easily copy and paste them. (Tip: if using Firefox hold Ctrl while dragging, to select cells instead of lines. ;-)) | ||
| - | |||
| - | ^ Active | ||
| - | | menu-active | ||
| - | | shade-active | ||
| - | | stick-active | ||
| - | | hide-active | ||
| - | | maximize-active | ||
| - | | close-active | ||
| - | | top-left-active | ||
| - | | title-1-active | ||
| - | | title-2-active | ||
| - | | title-3-active | ||
| - | | title-4-active | ||
| - | | title-5-active | ||
| - | | top-right-active | ||
| - | | right-active | ||
| - | | bottom-right-active | bottom-right-inactive | | | ||
| - | | bottom-active | ||
| - | | bottom-left-active | ||
| - | | left-active | ||
| - | |||
| - | ===== Credits ===== | ||
| - | This how-to has been started by Drewbian (drewbian at tsn dot cc) and later modifed by Olivier Fourdan (fourdan at xfce dot org). | ||