Clipman 手册

Mike Massonnet

此手册介绍 Clipman ,版本 1.1.0。

在自由软件基金会发布的 GNU 自由文档许可协议版本 1.3 或以后版本的条款约束下允许复制,分发和/或修改本文档,不要求保留特定内容、封面文本或者封底文本。许可协议全文可以通过以下链接找到: Free Software Foundation

April, July 2009


目录

简介
剪贴板的分析
开始使用
弹出命令
设置
常规
动作
动作对话框
Xfconf
支持
关于 Clipman

简介

Clipman is a clipboard manager for Xfce. It keeps the clipboard contents around while it is usually lost when you close an application. It is able to handle text and images, and has a feature to execute actions on specific text by matching them against regular expressions.

剪贴板的分析

在 X11 (所有的 Unix 平台) 中,默认有两个剪贴板用以交换各窗口间的数据。其中的一个剪贴板(我们称之为预设剪贴板)用以手动复制(例如您选择一个文件之后点击复制按钮),而另一个(我们称之为主剪贴板)用以选中复制(例如您选中在文本框中的文本)。

Clipman handles only the default clipboard, but optionnaly it can also notice the selections. When it is handling the selections, the default clipboard will always be synced with it and contain the same data. By this meaning you can paste with the keyboard what you select on screen.

开始使用

Clipman is used to keep in history a list of clipboard contents and to restore them. The history is displayed in a menu by clicking on the main icon. Within the menu it is possible to restore a text and to clear the history.

图 1. 剪贴板菜单

用以显示历史的菜单

There are two ways to run Clipman. You can select Clipman in the applications menu under the category Utility or type xfce4-clipman on the command-line, or you can add it into your panel. To add a new item in the panel right click the panel and select “Add new item…”.

弹出命令

Clipman 提供一个命令行工具 xfce4-popup-clipman。当它被执行时将弹出主菜单。使用在 Xfce 菜单+设置+键盘 中的 应用程序快捷方式 启动该程序将会十分方便。

设置

通过右键点击主图标,并选择菜单中的“属性”项可以打开设置对话框。它允许您调节剪贴板历史的相关属性或者编辑动作。

常规

以下是可用选项的列表:

表 1. 设置对话框中的常规选项

选项描述
Sync selections同步主剪贴板的内容到预设剪贴板中以粘贴选中的内容
从历史中排除不将主剪贴板中的内容加入到历史中
保存并退出在每次新会话中恢复历史
保存一幅图像允许在历史中保存一幅图像
历史大小设置保留在历史中的条目数量

图 2. 剪贴板设置

带有一般标签的设置对话框

动作

一个动作由一个“动作名称 - 正则表达式”对构成。每一个动作可以执行一个或一个以上的命令。对动作的支持是程序的可选项,您能够通过“允许动作”选项启用或禁用该支持。

要添加一个动作,请点击添加图标;要编辑一个动作,请选择该动作并点击编辑图标或者直接双击该动作;要删除一个动作,请选择该动作并点击删除图标。选择添加或者编译一个动作,一个新对话框将会被打开。

To learn more about actions go to “动作对话框”一节.

图 3. 剪贴板设置

带有动作标签的设置对话框

动作对话框

An action has a human readable name that describes the pattern it is going to match. An action must have at least one command which also has a human readable name. The matched text can be reused in the command.

The actions are always matched against text selections unless specified otherwise. When the box “Activate only on manual copy” is checked, the action will be matched from the default clipboard (e.g. with Ctrl+C).

图 4. 动作对话框

动作编辑对话框

正则表达式

基本特殊字符: ".?+*(|)[]\"。

  • .”: 代表任意单个字符。
  • ?+*”: 分别代表零或一个字符,一个或一个以上字符,以及任意多个(包括0个)字符。
  • (|)”: 在分组和替换中,竖线(|)用以表示 “或” 。
  • [^]”: 在一系列字符或特殊字符中匹配一个字符时,“^” 符号在开头使用表示否定。
  • \”: 将特殊字符作为普通字符进行匹配。

基本的字母和数字字符类: "A-Za-z0-9"。 字符类用于方括号中表示一系列的字符。

例子
  • "bug ?#?[0-9]+": 文本 "bug",零或一个空格,零或一个 “#” 字符,后面是一个或多个数字。
  • "(http|ftp).+\.(jpg|png|gif)": 文本 "http" 或 "ftp",一或多个字符,一个点,后面是文本 "jpg","png" 或 "gif"。
  • http://.{120}[^ ]+”: 文本“http://”,120 个字符,后面加一个或一个以上非空格的字符。

命令

一个命令可以再次使用一个或多个正则表达式匹配到的内容。所匹配的内容可以使用 ”\<数字>” 表示。<数字> 表示匹配到的第几个内容或者用 0 表示全部匹配到的文本。

例如,下面一个简单的匹配模式 ”bug #(123)”,可以使用 ”\0” 表示文本 “bug #123” 或者 ”\1” 表示文本 “123”。对于命令 ”exo-open http://host/\1”,实际执行的命令将会是 ”exo-open http://host/123”。

Xfconf

Clipman uses Xfconf to store its settings. That allows you to change the settings with the tool xfconf-query or xfce4-settings-editor. The channel is xfce4-panel and the base property is /plugins/clipman. The following table lists all the properties with their possible values:

表 2. Xfconf 属性

属性类型默认
/settings/add-primary-clipboard布尔值设置为真将同步主剪贴板中的内容到预设剪贴板中
/settings/enable-actions布尔值设置为真将允许动作
/settings/history-ignore-primary-clipboard布尔值设置为真将从历史中排除主剪贴板的内容
/settings/max-images-in-historyuint00-5 个图像内容在历史中
/settings/max-texts-in-historyuint105-100 个文本内容在历史中
/settings/save-on-quit布尔值设置为真将在每次新会话中恢复历史

To change a setting from a terminal type the command-line:

xfconf-query -c xfce4-panel -p /plugins/clipman/<property> -s <value>

支持

报告错误或者希望添加新的功能,请使用在 http://bugzilla.xfce.org/ 上的 bug 追踪系统。如果您在此软件的使用上有任何疑问,请在邮件列表 Xfce mailing list 上发问,或者使用 IRC 客户端连接至 irc.freenode.net,加入频道 #xfce 寻求帮助。

关于 Clipman

Clipman 最初由 Eduard Roccatello 所编写,而后由 Nick Schermer 维护。现在的编写者是 Mike Massonnet ()。更多信息,请查看 Clipman 网站

这份文档由 Mike Massonnet () 撰写。请将您对这份文档的意见或建议发送到

此软件在自由软件基金会发布的 GNU 通用公共许可协议 条款约束下发布;协议的第二版或者(您可以选择)更新的版本。

您应该能够随此软件获得一份 GNU 通用公共许可协议的副本;如果没有,请致信自由软件基金会: Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA.