Xfce Wiki

Sub domains


This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
zh-cn:tips [2012/04/21 08:36]
haobug [Background Color]
zh-cn:tips [2015/03/10 05:06] (current)
yjwork [Do maths with xfrun4/appfinder]
Line 31: Line 31:
 另外一个选择,对一些软件可能有用,那就是查看你用来远程连接的程序的设置选项,如果有”去掉墙纸“或者”不显示墙纸“的选项,那就打开这个选项。我用的是 TightVNCviewer,它没有”去掉墙纸“的选项,所以修改背景颜色是我的唯一的解决办法。 另外一个选择,对一些软件可能有用,那就是查看你用来远程连接的程序的设置选项,如果有”去掉墙纸“或者”不显示墙纸“的选项,那就打开这个选项。我用的是 TightVNCviewer,它没有”去掉墙纸“的选项,所以修改背景颜色是我的唯一的解决办法。
-===== How to use the alternative GNOME-menu =====+===== 如何使用 GNOME 菜单 =====
-If you want to use the new menu from GNOME, with quick starters for favorites applications and such, you can use the [[http://goodies.xfce.org/projects/panel-plugins/xfce4-xfapplet-plugin|xfapplet panel plugin]] with the GNOME main menu applet.  The menu should be installed with your package system, look for **gnome-main-menu**.  [[http://wirelessimage4.pbwiki.com/f/Screenshot.png|Xfce screenshot]][[http://www.novell.com/video/desktop/|video]].+如果你想使用 GNOME 的新菜单, 比如用快速启动的喜欢的应用之类的话,你可以使用的 [[http://goodies.xfce.org/projects/panel-plugins/xfce4-xfapplet-plugin|xfapplet 面板插件]] 添加 GNOME 主菜单小程序。这个菜单您可以用你的包管理系统安装,查找 **gnome-main-menu**。 [[http://wirelessimage4.pbwiki.com/f/Screenshot.png|Xfce的截图]][[http://www.novell.com/video/desktop/|视频]]
-Add a new xfapplet item inside your panel, and open its properties dialog to add the GNOME menu applet.+在您的面板上添加一个新 xfapplet 项,并打开其属性对话框添加GNOME 菜单的小程序。
-If you don't like GNOME main menu, try Ubuntu System Panel, available in several distributions.+如果你不喜欢GNOME主菜单,可以试一下Ubuntu系统面板,在几种发行上找得到。
-See also: [[/howto/customize-menu|How to customize the Xfce 4.5+ menu]]+另见:[[/zh-cn:howto:customize-menu|如何自定义 Xfce 4.5 +菜单]]
-===== Gtkrc files ===== 
-  * A tutorial about the Gtkrc format can be found [[http://live.gnome.org/GnomeArt/Tutorials/GtkThemes|here]].  
-  * Xfce has also a couple of custom gtkrc settings for some of the applications: [[http://svn.xfce.org/svn/xfce/xfdesktop/branches/xfce_4_4/README|xfdesktop]] and [[http://thunar.xfce.org/pwiki/documentation/advanced_settings|Thunar]] (see also [[http://thunar.xfce.org/pwiki/documentation/faq#how_do_i_assign_different_keyboard_shortcuts|editable shortcuts]]).+===== gtkrc 文件 =====
-  * You can not define a custom background for Thunar icon/ list views due to a [[http://bugzilla.gnome.org/show_bug.cgi?id=71926|bug in Gtk+]] itself.+  * [[http://live.gnome.org/GnomeArt/Tutorials/GtkThemes|这里]]有一个 gtkrc 文件格式的教程。
-  * You can define a custom panel background with something like this:+  * Xfce也有一些应用有自定义的 gtkrc 设置:[[http://svn.xfce.org/svn/xfce/xfdesktop/branches/xfce_4_4/README|xfdesktop]] 和 [[http://thunar.xfce.org/pwiki/documentation/advanced_settings|Thunar]] (参看: [[http://thunar.xfce.org/pwiki/documentation/faq#how_do_i_assign_different_keyboard_shortcuts|可编辑的快捷键]]). 
 +  * 你不能定义 Thunar 图标/列表视图模式下的自定义背景,这是因为 GTK+ 本身的缺陷。 
 +  * 你可以像这样定义自定义的面板背景:
   # ~/.gtkrc-2.0   # ~/.gtkrc-2.0
Line 74: Line 76:
   class "*tray*" style "panel-color"   class "*tray*" style "panel-color"
-   See also those threads in the forum : http://forum.xfce.org/viewtopic.php?id=6169 and http://forum.xfce.org/viewtopic.php?id=6196+   参考下论坛的这些贴子: http://forum.xfce.org/viewtopic.php?id=6169 和 http://forum.xfce.org/viewtopic.php?id=6196 
 +===== 如何删除和添加系统菜单中应用程序 =====
-===== How to add or remove applications in the system menu =====+=== 添加应用程序 ===
-=== Add an application === +你必须为你想要添加的应用程序创建一个 .desktop 文件(通常创建在下列位置中, ''/usr/share/applications'' 对整个系统有效, ''~/.local/share/applications'' 对你自己有效)。 
-You have to create a .desktop file (usually in ''/usr/share/applications'' for system wide or ''~/.local/share/applications'' for your user) for the application you want to add. +  
- +在下面的例子中,我们在 “多媒体” 菜单中创建了一个名为 “foo” 的子菜单:
-In the following example, we create an entry in the menu with the name "foo" in the submenu "Multimedia":+
   [Desktop Entry]   [Desktop Entry]
Line 94: Line 96:
   Categories=Multimedia;   Categories=Multimedia;
-You can read more about .desktop files [[http://standards.freedesktop.org/desktop-entry-spec/latest/|here]].+你可以在 [[http://standards.freedesktop.org/desktop-entry-spec/latest/|这里]]阅读更多的关于 .desktop 文件的内容。
-The libexo provides several utils amongst one to handle desktop entry files in a GUI fashion: **exo-desktop-item-edit**.  With it you can create a new .desktop file, by running the command ''<nowiki>exo-desktop-item-edit --create-new</nowiki>'' ;-)+libexo 提供了好几个实用工具,其中有一个可以以图形方式处理 desktop 文件: **exo-desktop-item-edit**。 你可以用它创建一个新的 .desktop 文件,用命令 ''<nowiki>exo-desktop-item-edit --create-new</nowiki>'' ;-)
-=== Remove an application from the menu === +=== 删除应用程序 === 
-You can do this in two ways: +你有两种方法: 
-  * First way, and the easier one is to simply remove the .desktop file in the ''/usr/share/applications/'' folder, but you will lose mime data (file associations). +  * 第一种,并且也是更简单的一种就是直接删除 ''/usr/share/applications/'' 文件夹中的.desktop 文件,但这样你们丢失 mime 数据(文件关联)。 
-  * The second way is to add this line to the .desktop file:+  * 第二种,添加这一行到 .desktop 文件中:
   NoDisplay=true   NoDisplay=true
-=====How to customize starting Xfce=====+=====怎样自定义 Xfce 启动=====
-Like most UNIX terminal sessions, Xfce runs through user-customizable startup file when it starts up. You can edit this init file to run your own scripts, send environment variables to the GUI, etc.+像大多数 UNIX 终端会话一样,Xfce 在启动时会执行用户自定义的启动文件。你可以通过修改这个初始化文件来执行你自己的脚本,给 GUI 发送界面环境变量等。
-To add your own startup code, edit the xinitrc file like this:+请像这样编辑 xinitrc 文件,添加你自己的启动代码:
-  * Copy the file /etc/xdg/xfce4/xinitrc to ~/.config/xfce4/ +  * 复制 /etc/xdg/xfce4/xinitrc 到 ~/.config/xfce4/ 
-  * Add your own code to the file. For example, you could start the rxvt-unicode server:+  * 添加你自己的代码到这个文件。例如,你可以启动 rxvt-unicode 服务器:
     * source $HOME/.bashrc     * source $HOME/.bashrc
     * # start rxvt-unicode server     * # start rxvt-unicode server
     * urxvtd -q -o -f     * urxvtd -q -o -f
-You can read more about xinitrc at [[http://www.google.com.au/search?q=xinitrc&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:en-US:unofficial&client=firefox-a | various locations online]].+你可以从这了解更多关于 xinitrc 的内容 [[http://www.google.com.au/search?q=xinitrc&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:en-US:unofficial&client=firefox-a | 很多不同的网站]]
 ==== Starting with showing the Root Window ==== ==== Starting with showing the Root Window ====
Line 124: Line 126:
-===== Use the desktop margin =====+===== 使用桌面空白边 =====
-To set the desktop margins, use the Settings Manager (**Settings Manager Workspaces & Margins Margins**).+用“设置管理器”(**设置管理器 工作区和空白边 空白边**)设置桌面空白边。
-The desktop margins are used to limit the size of maximized windows. This may be useful to avoid switching workspaces by accidentally mousing off the side of the screen.+桌面空白边用来限制最大化的窗口的大小。这有助于避免鼠标移动到屏幕边上时意外地切换工作区。
-The margins are also useful if you have only one Xfce panel: the margin area leaves a clear space to pull up application or workspace menus. By default, right click on the desktop (the margin) to show the Xfce menu, or middle (left+right) click to show the workspace menu.+如果你只有一个 Xfce 面板,空白边也有很有用: 空白边区域留出一个清晰的空白,用于调出“应用程序”菜单或者“工作区”菜单。默认的,在桌面(空白边)上右击显示 Xfce 菜单,中键(或者左键+右键)点击显示工作区菜单。
-The size of the margins is in pixels, so, with a reasonably modern monitor, at a resolution of, say 1680 x 1050, a setting of '10' will give a margin of about 1/8 of an inch. Note that nothing will change on any open window until you minimize and re-maximize it again. Also note that these margins only apply to maximized windows -- you can manually resize any window right to the edge of the screen if you want to.+空白边的大小以像素为单位,所以在比较新近的显示器上,以分辨率1680 x 1050为例10’ 会留出大约 1/8 英寸(0.3175厘米)的空白。注意,已经打开的窗口在最小化再还原后才会生效。另外还要注意,这只应用于最大化的窗口 —— 你可以手工地改变窗口的大小到屏幕边缘。 
 +===== 处理 ACPI 电源按钮事件,显示 Xfce 注销选项 =====
-===== Handle acpi event for power button, show Xfce logout options =====+如果你想在你按下电源按钮时显示注销菜单,并且你的机器支持 ACPI,那就按下面的步骤做吧:
-If you would like the xfce logout menu to show up when you press your power button, and your machine has acpi support, then do the following: +==== 解决方案 1 ====
- +
-==== Solution 1 ====+
    * ''/etc/acpi/events/powerbtn''    * ''/etc/acpi/events/powerbtn''
-<file>+<file bash>
 # /etc/acpi/events/powerbtn # /etc/acpi/events/powerbtn
-This is called when the user presses the power button and calls +当用户按下电源按钮时这文件会被调用并且调用 
-# /etc/acpi/powerbtn.sh for further processing.+# /etc/acpi/powerbtn.sh 作进一步处理。
-Optionally you can specify the placeholder %e. It will pass +你也可以用 %e 这个占位符来把整个内核事件消息传给你指定的程序。 
-# through the whole kernel event message to the program you've + 
-specified. +我们需要对 "button power.*" 和 "button/power.*" 都作出反应, 
-  +因为内核做了改动。
-# We need to react on "button power.*" and "button/power.*" because +
-of kernel changes.+
 event=button[ /]power event=button[ /]power
Line 157: Line 156:
   * ''/usr/local/sbin/xfce4-shutdown-as-user.sh''   * ''/usr/local/sbin/xfce4-shutdown-as-user.sh''
-<file>+<file bash>
 #!/bin/sh  #!/bin/sh 
 # xfce4-shutdown-as-user.sh # xfce4-shutdown-as-user.sh
 # #
-Check how many users are currently logged into X. +检查当前有多少用户登录了 X。如果只有一个用户登录, 
-If only one user is logged in, run a script which sets +就执行脚本设置环境来调用 xfce4-session-logout
-# up the environment to call xfce4-session-logout.+
 LOGGED_IN_USER=`ls -trl /tmp/.ICE-unix/ | tail -n -1 | cut -d' ' -f3` LOGGED_IN_USER=`ls -trl /tmp/.ICE-unix/ | tail -n -1 | cut -d' ' -f3`
Line 174: Line 172:
   * ''/usr/local/sbin/xfce4-user-session-shutdown.sh''   * ''/usr/local/sbin/xfce4-user-session-shutdown.sh''
-  <file>+  <file bash>
 #!/bin/sh #!/bin/sh
 # xfce4-user-session-shutdown.sh # xfce4-user-session-shutdown.sh
 # #
-Set up the environment so that DISPLAY and +设置环境变量,使 DISPLAY 和 SESSION_MANAGER 为有效的, 
-SESSION_MANAGER are valid, and xfce4-session-logout can run+并且可以执行 xfce4-session-logout 
 HOST=`hostname` HOST=`hostname`
 SESSION_ID=`ls -t /tmp/.ICE-unix/ | head -n1` SESSION_ID=`ls -t /tmp/.ICE-unix/ | head -n1`
-Note that distros use different syntax for the SESSION_MANAGER variable (this script has Debian's format). +注意,发行版们的 SESSION_MANAGER 变量使用不同的语法(这时用的是 Debian 格式) 
-If this does not work, then try something like SESSION_MANAGER="local/$HOST:@/tmp/.ICE-unix/$SESSION_ID" +# 如果这个不能用,请试着修改为类似于  
-instead. You can always find the correct format for your distribution by looking at the +# SESSION_MANAGER="local/$HOST:@/tmp/.ICE-unix/$SESSION_ID" 这样的。 
-# value of SESSION_MANAGER in a X session.+通过在 X 会话中查看 SESSION_MANAGER 的值,你总可以找到你的发行版的正确的格式 
 DISPLAY=:0 SESSION_MANAGER="local/$HOST:/tmp/.ICE-unix/$SESSION_ID" /usr/bin/xfce4-session-logout DISPLAY=:0 SESSION_MANAGER="local/$HOST:/tmp/.ICE-unix/$SESSION_ID" /usr/bin/xfce4-session-logout
   </file>   </file>
-   Make those scripts executable +   让这些脚本可执行 
-<code>+<code bash>
 chmod +x /usr/local/sbin/xfce4-user-session-shutdown.sh /usr/local/sbin/xfce4-shutdown-as-user.sh chmod +x /usr/local/sbin/xfce4-user-session-shutdown.sh /usr/local/sbin/xfce4-shutdown-as-user.sh
 </code> </code>
-==== Solution 2 ==== +==== 解决方案 2 ==== 
-   Open Settings Manager (or by command : xfce4-settings-manager ) +   打开“设置管理器”(或者用命令:xfce4-settings-manager 
-   Open Power Manager settings +   打开“电源管理器” 
-   In General : set //When power button is pressed// to //Ask// +   一般设置:设置//按下电源按钮时////询问// 
-   Close Power Manager settings +   关闭“电源管理器” 
-   In the file **/etc/acpi/events/power_button** , change the //action// field to ///bin/true// :+   如果您安装有 ACPI 脚本,从 **/etc/acpi/events/** 停用或更新电源按钮脚本修改  //action// 字段的值为 ///bin/true//:
 <file> <file>
 event=button/power.* event=button/power.*
Line 205: Line 204:
 action=/bin/true action=/bin/true
 </file> </file>
-===== Use mnemonics to create Thunar Custom Actions =====+===== 使用助记符创建 Thunar 自定义动作 =====
-When you create a [[http://thunar.xfce.org/pwiki/documentation/custom_actions|Thunar Custom Action]] you can set the name with an underscore "_" before a letter to use it as mnemonic.  When you right click in a Thunar view, you can type the letter to access your custom action.+当你创建一个 [[http://thunar.xfce.org/pwiki/documentation/custom_actions|自定义动作]] 时,你可以设置一个字母前面带 “_”(下划线)的名字,这个字母作为助记符。当你在 Thunar 中点击右键时你可以按这个字母来访问你的自定义动作。 
 +=====通过 xfrun4 打开用户手册页=====
-===== Accessing man pages through xfrun4 ===== +使用 '#' 作为在 xfrun4 中打开一个用户手册页的快捷方式。例如,#man 
-Use '#' as a shortcut to open man pages using xfrun4. e.g. #man+ 
 +===== 使用 xfrun4/应用程序查找器 做数学运算 ===== 
 +  * 能干嘛: 在xfrun4/应用程序查找器 中,输入简单的数学运算式子,比如  5+5 或 (5+5)/3 或 .5*10, 运算结果将显示在桌面通知中. 
 +  * 需要有此命令: notify-send 
 +  * 在您的家目录,保存此脚本为 bcme.sh : 
 +  #!/bin/sh 
 +  precision=2        # number of digit for floating value 
 +  notify_time=20000  # number of milisecond the notification show 
 +  res=`echo "scale=$precision;$@" | bc`   
 +  notify-send -t $notify_time "$res" "=$@" 
 +  *在应用程序查找器添加自定义动作 : 
 +    * 类型 : 正则表达式 
 +    * 类型 : ^([0-9]|\(|\.).* 
 +    * 命令 : /bin/sh ~/bcme.sh \0 
 +    *  (勾选) 在命令历史中保存匹配的 
 +====== Xfconf ===== 
 +===== Toggle panel autohide ===== 
 +Short Bash script to toggle the autohide property of panel, so you can bind for example a keyboard shortcut to quickly show and hide a panel. 
 +<code bash> 
 +test -z "$1" && echo missing panel id  && exit 1 
 +test ! -z "`echo $1 | sed s/[0-9]*//g`" && echo bad panel id  && exit 1 
 +if `xfconf-query -c $CHANNEL -p $PROP >/dev/null 2>&1`; then 
 +    xfconf-query -c $CHANNEL -T -p $PROP 
 +    xfconf-query -c $CHANNEL -n -p $PROP -t bool -s false