Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| zh-cn:tips [2012/04/28 16:39] – [Handle acpi event for power button, show Xfce logout options] haobug | zh-cn:tips [2015/03/10 05:06] (current) – [Do maths with xfrun4/appfinder] yjwork | ||
|---|---|---|---|
| Line 138: | Line 138: | ||
| 如果你想在你按下电源按钮时显示注销菜单,并且你的机器支持 ACPI,那就按下面的步骤做吧: | 如果你想在你按下电源按钮时显示注销菜单,并且你的机器支持 ACPI,那就按下面的步骤做吧: | ||
| - | ==== Solution | + | |
| + | ==== 解决方案 | ||
| * ''/ | * ''/ | ||
| - | < | + | < |
| # / | # / | ||
| - | # This is called when the user presses the power button and calls | + | # 当用户按下电源按钮时这文件会被调用并且调用 |
| - | # / | + | # / |
| - | + | ||
| - | # Optionally you can specify the placeholder %e. It will pass | + | |
| - | # through the whole kernel event message to the program you' | + | |
| - | # specified. | + | |
| - | # We need to react on " | + | # 你也可以用 %e 这个占位符来把整个内核事件消息传给你指定的程序。 |
| - | # of kernel changes. | + | |
| + | # 我们需要对 | ||
| + | # 因为内核做了改动。 | ||
| event=button[ /]power | event=button[ /]power | ||
| Line 157: | Line 156: | ||
| * ''/ | * ''/ | ||
| - | < | + | < |
| # | # | ||
| # xfce4-shutdown-as-user.sh | # xfce4-shutdown-as-user.sh | ||
| # | # | ||
| - | # Check how many users are currently logged into X. | + | # 检查当前有多少用户登录了 |
| - | # If only one user is logged in, run a script which sets | + | # 就执行脚本设置环境来调用 |
| - | # up the environment to call xfce4-session-logout. | + | |
| LOGGED_IN_USER=`ls -trl / | LOGGED_IN_USER=`ls -trl / | ||
| Line 174: | Line 172: | ||
| * ''/ | * ''/ | ||
| - | < | + | < |
| #!/bin/sh | #!/bin/sh | ||
| # xfce4-user-session-shutdown.sh | # xfce4-user-session-shutdown.sh | ||
| # | # | ||
| - | # Set up the environment so that DISPLAY | + | # 设置环境变量,使 |
| - | # SESSION_MANAGER are valid, and xfce4-session-logout | + | # 并且可以执行 |
| HOST=`hostname` | HOST=`hostname` | ||
| SESSION_ID=`ls -t / | SESSION_ID=`ls -t / | ||
| - | # Note that distros use different syntax for the SESSION_MANAGER | + | # 注意,发行版们的 |
| - | # If this does not work, then try something like SESSION_MANAGER=" | + | # 如果这个不能用,请试着修改为类似于 |
| - | # instead. You can always find the correct format for your distribution by looking at the | + | # SESSION_MANAGER=" |
| - | # value of SESSION_MANAGER in a X session. | + | # 通过在 X 会话中查看 SESSION_MANAGER 的值,你总可以找到你的发行版的正确的格式 |
| DISPLAY=:0 SESSION_MANAGER=" | DISPLAY=:0 SESSION_MANAGER=" | ||
| </ | </ | ||
| - | | + | |
| - | < | + | < |
| chmod +x / | chmod +x / | ||
| </ | </ | ||
| - | ==== Solution | + | ==== 解决方案 |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| < | < | ||
| event=button/ | event=button/ | ||
| Line 211: | Line 210: | ||
| 使用 '#' | 使用 '#' | ||
| + | |||
| + | ===== 使用 xfrun4/ | ||
| + | * 能干嘛: 在xfrun4/ | ||
| + | * 需要有此命令: | ||
| + | * 在您的家目录, | ||
| + | |||
| + | #!/bin/sh | ||
| + | | ||
| + | precision=2 | ||
| + | notify_time=20000 | ||
| + | | ||
| + | res=`echo " | ||
| + | notify-send -t $notify_time " | ||
| + | |||
| + | *在应用程序查找器添加自定义动作 : | ||
| + | * 类型 : 正则表达式 | ||
| + | * 类型 : ^([0-9]|\(|\.).* | ||
| + | * 命令 : /bin/sh ~/bcme.sh \0 | ||
| + | * (勾选) 在命令历史中保存匹配的 | ||
| + | |||
| + | |||
| + | ====== Xfconf ===== | ||
| + | |||
| + | ===== Toggle panel autohide ===== | ||
| + | |||
| + | Short Bash script to toggle the autohide property of a panel, so you can bind for example a keyboard shortcut to quickly show and hide a panel. | ||
| + | |||
| + | <code bash> | ||
| + | #!/bin/sh | ||
| + | |||
| + | test -z " | ||
| + | test ! -z "`echo $1 | sed s/ | ||
| + | |||
| + | CHANNEL=xfce4-panel | ||
| + | PANELID=$1 | ||
| + | PROP=/ | ||
| + | |||
| + | if `xfconf-query -c $CHANNEL -p $PROP >/ | ||
| + | xfconf-query -c $CHANNEL -T -p $PROP | ||
| + | else | ||
| + | xfconf-query -c $CHANNEL -n -p $PROP -t bool -s false | ||
| + | fi | ||
| + | </ | ||