mic*_*huk 10 gnome xorg input-devices thinkpad xinput
在我的 Thinkpad 上,我需要在终端中执行这样的操作:
xinput set-int-prop "TPPS/2 IBM TrackPoint" "Evdev Middle Button Emulation" 8 1
Run Code Online (Sandbox Code Playgroud)
以便我的触摸板上的 2 个按钮模拟鼠标中键单击。现在我需要在每次启动 GNOME 或 X 或其他任何东西时执行这一行,以便它“正常工作”。
我试过 ~/.xsession 或 ~/.bashrc 但无济于事。我应该把它放在 GNOME 启动脚本中还是 /etc/X 中的某个地方?
我正在使用 Ubuntu 11.10。
我正在使用 Enlightenment DM,但这与其他 DM/桌面相关。我使用 xsession 开始我的会话,所以我最初将 xinput 命令放在 ~/.xsession 中,它没有更改我想要更改的所有设置。只有其中一些。我期待所有更改或不更改,因此我以 1 秒的间隔向我的 .xsession 添加了 10 次交互循环,每次运行 xinput 命令并检查是否应用了设置。令我惊讶的是,所有设置都在第一次迭代后应用。
这意味着是您的 DM 执行某些操作来覆盖您的 xinput 设置,并且由于启动您的 DM(在我的情况下为 E17)的命令是您的 .xsession 文件中的最后一个,因此该文件不适用于此。
我在 ~/.profile 中添加了以下几行,这解决了问题:
# don't run unless we're being invoked from an xwindows session
if [[ -n ${DISPLAY} ]]; then
# set your devices names here
pointer1="IBM TrackPoint"
pointer2="Lite-On Technology Corp. ThinkPad USB Keyboard with TrackPoint"
pointer3="Logitech USB Trackball"
id1=$(xinput | awk -F= "/$pointer1.*pointer/ {print \$2}" | cut -f1)
id2=$(xinput | awk -F= "/$pointer2.*pointer/ {print \$2}" | cut -f1)
id3=$(xinput | awk -F= "/$pointer3.*pointer/ {print \$2}" | cut -f1)
if [[ -n "${id1}" ]]; then
xinput --set-button-map "${id1}" 1 2 3 4 5 6 7
xinput set-prop "${id1}" "Evdev Wheel Emulation Axes" 6 7 4 5
xinput set-prop "${id1}" "Evdev Wheel Emulation" 1
xinput set-prop "${id1}" "Evdev Wheel Emulation Button" 2
xinput set-prop "${id1}" "Evdev Middle Button Emulation" 0
fi
if [[ -n "${id2}" ]]; then
xinput --set-button-map "${id2}" 1 2 3 4 5 6 7
xinput set-prop "${id2}" "Evdev Wheel Emulation Axes" 6 7 4 5
xinput set-prop "${id2}" "Evdev Wheel Emulation" 1
xinput set-prop "${id2}" "Evdev Wheel Emulation Button" 2
xinput set-prop "${id2}" "Evdev Middle Button Emulation" 0
fi
if [[ -n "${id3}" ]]; then
xinput --set-button-map "${id3}" 1 2 3 4 5 6 7 8 9
xinput set-prop "${id3}" "Evdev Wheel Emulation Axes" 6 7 4 5
xinput set-prop "${id3}" "Evdev Wheel Emulation" 1
xinput set-prop "${id3}" "Evdev Wheel Emulation Button" 8
xinput set-prop "${id3}" "Evdev Middle Button Emulation" 1
fi
fi
Run Code Online (Sandbox Code Playgroud)
附注。set-int-prop 已被弃用,取而代之的是 set-prop (man xinput)。
希望这有助于某人。
/etc/X11/Xsession.d/为其创建一个文件。
| 归档时间: |
|
| 查看次数: |
9550 次 |
| 最近记录: |