美文网首页我用 LinuxLinux学习|Gentoo/Arch/FreeBSDLinux
Arch Linux触摸板手势设置libinput-gestur

Arch Linux触摸板手势设置libinput-gestur

作者: BigTaiYang大太阳 | 来源:发表于2020-04-24 16:13 被阅读0次

    现如今大部分笔记本触摸板都支持多指操作,手势操作。目前Windows和macOS都对触摸板手势有很好的支持,尤其是macOS的手势操作简直好用的不得了。但对于Linux,默认情况下可能只支持简单的几种操作(点击,双指滚动)。有没有可以让Linux也支持触摸板手势呢?最近在折腾Linux的过程中发现还是有办法实现一些手势功能的,虽然达不到macOS那么丰富,但是到Windows那种级别还是可以的。

    使用libinput-gestures

    archlinuxcn或者aur安装libinput-gestures

    yay -S libinput-gestures
    

    Libinput-gestures是一个实用程序,可从触摸板读取libinput手势并将其映射到在配置文件中配置的手势。可以将每个手势配置为激活一个Shell命令,该命令通常是xdotool命令,用于操作桌面/窗口/应用程序键盘组合和命令。默认已经支持了一些常用的手势比如左右滑动在浏览器前进/后退,上下滑动切换工作区,但由于Linux桌面的多样性,默认手势并不好用,我们可以自定义手势来实现一些常用操作。

    配置自定义手势

    首先拷贝默认配置/etc/libinput-gestures.conf~/.config/libinput-gestures.conf

    自定义手势支持,以及手指数量。比如swipe up就是上滑,swipe up 3就是三指上滑,后面再跟上我们要执行的命令即可。

    # Each gesture line has 3 [or 4] arguments separated by whitespace:
    #
    # action motion [finger_count] command
    #
    # where action and motion is either:
    #     swipe up
    #     swipe down
    #     swipe left
    #     swipe right
    #     swipe left_up
    #     swipe left_down
    #     swipe right_up
    #     swipe right_down
    #     pinch in
    #     pinch out
    #     pinch clockwise
    #     pinch anticlockwise
    

    我的配置

    下面是我在KDE Plasma桌面环境下,定义的一些常用手势,可供参考。

    # 三指上滑展示所有桌面
    gesture swipe up 3 xdotool key ctrl+F8
    # 三指下滑显示桌面
    gesture swipe down 3 xdotool key super+d
    # 三指左滑后退
    gesture swipe left 3 xdotool key alt+Right
    # 三只右滑前进
    gesture swipe right 3 xdotool key alt+Left
    # 四指上滑显示应用程序面板(自定义的快捷键)
    gesture swipe up 4 xdotool key ctrl+super+a
    # 四指下滑显示所有窗口
    gesture swipe down 4 xdotool key ctrl+F10
    # 四指左滑切换到右边桌面
    gesture swipe left 4 xdotool key ctrl+super+Right
    # 四指右滑切换左边桌面
    gesture swipe right 4 xdotool key ctrl+super+Left
    

    启动

    libinput-gestures-setup start|stop|restart|autostart|autostop|status
    

    参考

    Arch Wiki
    libinput-gestures GitHub详细介绍


    告别命令行/使用向导安装Arch Linux
    KDE Plasma桌面美化macOS like
    Arch Linux桌面环境(Xfce4)安装教程
    Xfce4桌面环境美化
    Arch Linux桌面特效(Xfce4)使用compiz
    Linux 如何利用多工作区来提升效率/Xfce4

    相关文章

      网友评论

        本文标题:Arch Linux触摸板手势设置libinput-gestur

        本文链接:https://www.haomeiwen.com/subject/mhbxwhtx.html