# Process command options
while getopts ":h" opt; do
case $opt in
h ) display_help
exit 0 ;;
\? ) display_help
exit 1 ;;
esac
done
shift $(($OPTIND - 1))
# Start execute the command
if [ $OSTYPE = 'linux-gnu' ]; then
tap1=`synclient -l | grep TapButton1 | cut -d '=' -f 2 | tr -d [:space:]`
tap2=`synclient -l | grep TapButton2 | cut -d '=' -f 2 | tr -d [:space:]`
tap3=`synclient -l | grep TapButton3 | cut -d '=' -f 2 | tr -d [:space:]`
if [ "$tap1" = "0" ] && [ "$tap2" = "0" ] && [ "$tap3" = "0" ]; then
enable_tapbutton.sh
else
disable_tapbutton.sh
fi
exit 0
fi
echo "$warning_prefix Operating system or host name is not supported!"
#!/bin/bash
script_name="enable_tapbutton.sh"
script_usage=$(cat <<EOF
$script_name
EOF
)
script_function=$(cat <<EOF
This script is used to enable the finger tap function of Synaptics touchpad.
EOF
)
script_doc=$(cat <<EOF
-h Display this help.
EOF
)
script_examples=$(cat <<EOF
EOF
)
state_prefix="==="
warning_prefix="***"
error_prefix="!!!"
function display_help() {
if [ -n "$script_usage" ]; then
echo -e "Usage: $script_usage"
fi
if [ -n "$script_function" ]; then
echo -e "$script_function"
fi
if [ -n "$script_doc" ] ; then
echo -e "\n$script_doc"
fi
if [ -n "$script_examples" ]; then
echo -e "\nExamples"
echo -e "$script_examples"
fi
}
# Process command options
while getopts ":h" opt; do
case $opt in
h ) display_help
exit 0 ;;
\? ) display_help
exit 1 ;;
esac
done
shift $(($OPTIND - 1))
# Start execute the command
if [ $OSTYPE = 'linux-gnu' ]; then
synclient TapButton1=3
synclient TapButton2=1
synclient TapButton3=2
echo "$state_prefix Finger tapping on touchpad has been enabled!"
exit 0
fi
echo "$warning_prefix Operating system or host name is not supported!"
6. 窗口与桌面操作函数与快捷键:其中一些功能是Sawfish自带的,直接在设置对话窗口中绑定即可。
•Win+e:显示当前窗口信息,包括名称、大小、位置、组编号
;; Display window position and dimension
(defun display-window-paras ()
"Display the position, dimension and group ID of the current window."
(interactive)
(let* ((cur-win (input-focus))
(win-width (car (window-dimensions cur-win)))
(win-height (cdr (window-dimensions cur-win)))
(win-x (car (window-position cur-win)))
(win-y (cdr (window-position cur-win))))
(display-message
(concat "Name: " (window-name cur-win) "\n"
"Dimension: " (number->string win-width) "x" (number->string win-height) "\n"
"Position: " (number->string win-x) "x" (number->string win-y) "\n"
"Group ID: " (number->string (window-actual-group-id cur-win)))
alert-msg-attrib)))
(bind-keys window-keymap
"Super-e" `(display-window-paras))
•Win+c:将窗口放置于屏幕(Screen)中心。其中调用了current-head-dimension与current-head-offset,所以可以支持多个显示器。
;; Center to screen
(defun center-to-screen (cur-win)
"Center the current window to the current screen"
(interactive "%f")
(let* ((screen-width (car (current-head-dimensions cur-win)))
(screen-height (cdr (current-head-dimensions cur-win)))
(screen-x (car (current-head-offset cur-win)))
(screen-y (cdr (current-head-offset cur-win)))
(win-width (car (window-dimensions cur-win)))
(win-height (cdr (window-dimensions cur-win)))
(win-x (car (window-position cur-win)))
(win-y (cdr (window-position cur-win))))
;; Adjust x position
(if (>= win-width screen-width)
(setq win-x screen-x)
(setq win-x (round (+ (/ (- screen-width win-width) 2) screen-x))))
;; Adjust y position
(if (>= win-height screen-height)
(setq win-y screen-y)
(setq win-y (round (+ (/ (- screen-height win-height) 2) screen-y))))
;; Modify window position
(move-window-to cur-win win-x win-y)))
•Win+f:显示与隐藏窗口边框。在一些电影上可以看到黑客用的电脑程序没有窗口边框。