Xfce에서 터치패드를 켜거나 끄는 명령

Xfce에서 터치패드를 켜거나 끄는 명령

비슷한 질문을 찾았습니다.

켜거나 끄는 키보드 단축키(예: 트랙패드)를 어떻게 설정합니까?

그리고

Linux(True 또는 False) bash 명령에서 스위치를 설정하는 방법은 무엇입니까?

그러나 이들은 gnome 기반이며 해당 솔루션은 gsettingsXfce에서 작동하지 않는 명령(예 org.gnome.settings-daemon.peripherals.touchpad touchpad-enabled: )을 사용합니다.

Xfce에서 내가 사용하는 명령은 synclient touchpadoff=1및 입니다 synclient touchpadoff=0.

켜기/끄기 토글처럼 작동하는 명령 내에서 이를 어떻게 조정합니까?

답변1

원천:https://www.commandlinefu.com/commands/view/19659/toggle-the-touchpad-on-or-off

다음 명령을 스크립트에 넣으세요.

#!/bin/bash

tp=$(synclient -l | grep TouchpadOff | awk '{ print $3 }') && tp=$((tp==0)) && synclient TouchpadOff=$tp

사용할 수 있는 또 다른 명령은 다음과 같습니다.

synclient TouchpadOff=$(synclient -l | grep -q 'TouchpadOff.*1'; echo $?)

스크립트를 실행 가능하게 만듭니다. 스크립트를 실행하기 위한 바로가기를 만듭니다.


업데이트: 이 synclient방법은 최신 시스템에서는 작동하지 않을 수 있습니다.

#!/bin/sh
# This shell script is PUBLIC DOMAIN. You may do whatever you want with it.

TOGGLE=$HOME/.toggle_touchpad

if [ ! -e $TOGGLE ]; then
    touch $TOGGLE
    xinput disable 14
    notify-send -u low -i mouse --icon=/usr/share/icons/HighContrast/256x256/status/touchpad-disabled.png "Trackpad disabled"
else
    rm $TOGGLE
    xinput enable 14
    notify-send -u low -i mouse --icon=/usr/share/icons/HighContrast/256x256/devices/input-touchpad.png "Trackpad enabled"
fi

위 명령에는 14식별할 변수가 있습니다.xinput list

~$ xinput list
⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ Sony Vaio Jogdial                         id=8    [slave  pointer  (2)]
⎜   ↳ BM30X mouse                               id=12   [slave  pointer  (2)]
⎜   ↳ AlpsPS/2 ALPS GlidePoint                  id=14   [slave  pointer  (2)]
⎣ Virtual core keyboard                     id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Video Bus                                 id=6    [slave  keyboard (3)]
    ↳ Sony Vaio Keys                            id=7    [slave  keyboard (3)]
    ↳ Video Bus                                 id=9    [slave  keyboard (3)]
    ↳ Power Button                              id=10   [slave  keyboard (3)]
    ↳ USB 2.0 Camera: USB Camera                id=11   [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=13   [slave  keyboard (3)]

이 목록에서 장치 이름을 확인하려면 마우스 및 터치패드 설정을 확인하세요.

여기에 이미지 설명을 입력하세요.

스크립트는 메시지와 함께 아이콘이 포함된 알림도 표시합니다.

원천여기,여기, 반품여기.

답변2

저는 Xubuntu 21.10(xfce)을 실행하고 있습니다. synclient/synaptics가 동기화되지 않고 계속 실행 중이기 때문에 xinput 메서드가 작동하지 않습니다.

(나중에 작동하지 않을 수 있는) 동기화 솔루션을 시도하는 대신 벨트와 슬링을 사용했습니다.

#!/bin/sh
# This shell script is PUBLIC DOMAIN. You may do whatever you want with it.

TOGGLE=$HOME/.toggle_touchpad

if [ ! -e $TOGGLE ]; then
    touch $TOGGLE
    synclient touchpadoff=1
    xinput disable 13
    notify-send -u low -i mouse --icon=/usr/share/icons/HighContrast/256x256/status/touchpad-disabled.png "Trackpad disabled"
else
    rm $TOGGLE
    xinput enable 13
    synclient touchpadoff=0
    notify-send -u low -i mouse --icon=/usr/share/icons/HighContrast/256x256/devices/input-touchpad.png "Trackpad enabled"
fi

관련 정보