Xfce Wiki

Sub domains
 

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
zh-cn:tips [2012/04/27 17:13] – [How to customize starting Xfce] haobugzh-cn:tips [2015/03/10 05:06] (current) – [Do maths with xfrun4/appfinder] yjwork
Line 126: 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 +
-# through the whole kernel event message to the program you've +
-# specified.+
    
-We need to react on "button power.*" and "button/power.*" because +你也可以用 %e 这个占位符来把整个内核事件消息传给你指定的程序。 
-of kernel changes.+ 
 +# 我们需要对 "button power.*" 和 "button/power.*" 都作出反应, 
 +因为内核做了改动。
  
 event=button[ /]power event=button[ /]power
Line 159: 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 176: 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 207: 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> 
 +#!/bin/sh 
 + 
 +test -z "$1" && echo missing panel id  && exit 1 
 +test ! -z "`echo $1 | sed s/[0-9]*//g`" && echo bad panel id  && exit 1 
 + 
 +CHANNEL=xfce4-panel 
 +PANELID=$1 
 +PROP=/panels/panel-$PANELID/autohide 
 + 
 +if `xfconf-query -c $CHANNEL -p $PROP >/dev/null 2>&1`; then 
 +    xfconf-query -c $CHANNEL -T -p $PROP 
 +else 
 +    xfconf-query -c $CHANNEL -n -p $PROP -t bool -s false 
 +fi 
 +</code>