Home > System Tutorial > LINUX > Linux left and right mouse button swap implementation code

Linux left and right mouse button swap implementation code

WBOY
Release: 2024-01-07 19:02:18
forward
759 people have browsed it

linux鼠标左右键互换脚本,作者今天, 使用 GNOME, 发现 Linux 也需要这些工具之一, 所以有了这个脚本。非常简单好用。

lr="l"
for id in `xinput list | grep "pointer" | sed -r 's/.*id=([0-9]+).*/\1/'`;
do
	if [[ $lr == "r" ]]
	then
		xinput --set-button-map $id 1 2 3 2>/dev/null
	else
		xinput --set-button-map $id 3 2 1 2>/dev/null
	fi
done
filepath=$0
if [[ $lr == "r" ]]
then
	echo "now is right hand."
	sed -i '1s/lr="r"/lr="l"/' $filepath
else
	echo "now is left hand."
	sed -i '1s/lr="l"/lr="r"/' $filepath
fi
Copy after login

ubuntu命令切换鼠标左右键

话不多说,让我们开始切换:
首先让我们把鼠标切换到反手(这里之所以用反手一词,是因为有人可能是左撇子,有人是右撇子「还有右撇子?」):

xmodmap -e 'pointer = 3 2 1'

请拿出你的小鼠标摇一摇点一点,
是不是已经切换到反手了捏?!
好的,那让我们再切换回来:

xmodmap -e 'pointer = 1 2 3'

请再次猛烈的点击一次!
是不是又肥来了?!

不过每次切换都要输入29个字符,雅蠛蝶!
那就给他们起个小昵称嘛!

# filename .bashrc
alias mr="xmodmap -e 'pointer = 3 2 1'"
alias ml="xmodmap -e 'pointer = 1 2 3'"

好了,这篇文章就介绍到这了,希望大家以后多多支持本站。

The above is the detailed content of Linux left and right mouse button swap implementation code. For more information, please follow other related articles on the PHP Chinese website!

source:jb51.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template