前言

前几天,使用的windows系统出现了问题,因此,索性讲系统换成了Linux的国内发新版Deepin,在使用了一段时间后发现,Deepin的触摸板手势不是很好用(准确的来说应该是垃圾),因此,在查阅了资料后尝试自己来定义这些触摸板手势。

自定义触摸板手势

根据查找的资料,Deepin将触摸板的手势配置存放在了/usr/share/dde-daemon/gesture.json文件中,进入到文件中,发现格式比较好懂,那就自己魔改。
根据阅读Deepin的文档,我们知道目前触摸板手势支持一下几条指令(不得不说,有点少):

ShowWorkspace
ToggleMaximize
Minimize
ShowWindow
ShowAllWindow
SwitchApplication
ReverseSwitchApplication
SwitchWorkspace
ReverseSwitchWorkspace
SplitWindowLeft
SplitWindowRight
MoveWindow

我们将gesture.json文件备份后,直接动手修改,将文件修改为一下内容:

[
    {
        "Event": {
            "Name": "swipe",
            "Direction": "left",
            "Fingers": 3
        },
        "Action": {
            "Type": "built-in",
            "Action": "SwitchApplication"
        }
    },
    {
        "Event": {
            "Name": "swipe",
            "Direction": "right",
            "Fingers": 3
        },
        "Action": {
            "Type": "built-in",
            "Action": "SwitchApplication"
        }
    },
    {
        "Event": {
            "Name": "swipe",
            "Direction": "up",
            "Fingers": 3
        },
        "Action": {
            "Type": "built-in",
            "Action": "Handle4Or5FingersSwipeUp"
        }
    },
    {
        "Event": {
            "Name": "swipe",
            "Direction": "down",
            "Fingers": 3
        },
        "Action": {
            "Type": "built-in",
            "Action": "Handle4Or5FingersSwipeDown"
        }
    },{
        "Event": {
            "Name": "swipe",
            "Direction": "left",
            "Fingers": 4
        },
        "Action": {
            "Type": "built-in",
            "Action": "SwitchWorkspace"
        }
    },
    {
        "Event": {
            "Name": "swipe",
            "Direction": "right",
            "Fingers": 4
        },
        "Action": {
            "Type": "built-in",
            "Action": "ReverseSwitchWorkspace"
        }
    }
]

这样,我们就实现了三指切换应用、显示桌面,四指切换桌面的功能。