在Ubuntu 14.04這版本裡,預設的觸空板多指觸控手勢是固定住無法直接背更改,要設定觸控手勢不像以前直接安裝Touchégg 就可以設定,必須先將預設的手勢關閉才可以設定3.4指的手勢。
再GOOGLE後發現有兩個網頁有提到設定方式,可實現自訂手勢的功能。
OS X-like multitouch gestures for Macbook Pro running Ubuntu
以及
How can I disable arbitrary default multitouch gestures in Unity?
避免網頁失效,節錄網頁裡修改方式。
sudo apt-get build-dep unity
cd /tmp
mkdir unity
cd unity
apt-get source unity
再來編輯下列路徑檔案
/tmp/unity/unity-*/plugins/unityshell/src/unityshell.cpp
開啟後找到這段程式碼,再gestures_這一大段前後加上/*
void UnityScreen::InitGesturesSupport()
{
std::unique_ptr<nux::GestureBroker> gesture_broker(new UnityGestureBroker);
wt->GetWindowCompositor().SetGestureBroker(std::move(gesture_broker));
/*
gestures_sub_launcher_.reset(new nux::GesturesSubscription);
gestures_sub_launcher_->SetGestureClasses(nux::DRAG_GESTURE);
gestures_sub_launcher_->SetNumTouches(4);
gestures_sub_launcher_->SetWindowId(GDK_ROOT_WINDOW());
gestures_sub_launcher_->Activate();
gestures_sub_dash_.reset(new nux::GesturesSubscription);
gestures_sub_dash_->SetGestureClasses(nux::TAP_GESTURE);
gestures_sub_dash_->SetNumTouches(4);
gestures_sub_dash_->SetWindowId(GDK_ROOT_WINDOW());
gestures_sub_dash_->Activate();
gestures_sub_windows_.reset(new nux::GesturesSubscription);
gestures_sub_windows_->SetGestureClasses(nux::TOUCH_GESTURE
| nux::DRAG_GESTURE
| nux::PINCH_GESTURE);
gestures_sub_windows_->SetNumTouches(3);
gestures_sub_windows_->SetWindowId(GDK_ROOT_WINDOW());
gestures_sub_windows_->Activate();
*/
}
修改完成後重建Unity.deb 指令如下
cd /tmp/unity/unity-*
dpkg-buildpackage -us -uc -nc
cd ..
sudo dpkg -i *deb
sudo apt-get -f install
sudo apt-get autoremove
完成後登出再登入即可,最後再設定Touchegg,程式碼如下
<touchégg>
<settings>
<property name="composed_gestures_time">0</property>
</settings>
<application name="All">
<gesture type="DRAG" fingers="3" direction="RIGHT">
<action type="SEND_KEYS">Control+Alt+Left</action>
</gesture>
<gesture type="DRAG" fingers="3" direction="LEFT">
<action type="SEND_KEYS">Control+Alt+Right</action>
</gesture>
<gesture type="DRAG" fingers="4" direction="DOWN">
<action type="SEND_KEYS">Super+s</action>
</gesture>
<gesture type="DRAG" fingers="4" direction="UP">
<action type="SEND_KEYS">Super+w</action>
</gesture>
</application>
</touchégg>
設定開機自動啟動。
~/.config/autostart/touchegg.desktop 在此路徑下建立一空白檔案,內容如下。
[Desktop Entry]
Version=0.1
Name=Touchegg
GenericName=Touchégg
Comment=Touchégg Gestures Manager
Exec=/usr/bin/touchegg %u
Terminal=false
Type=Application
沒有留言:
張貼留言