Hello guys,
Recently i found a script for disabling mouse acceleration in linux via google.It had following text
#wait for the desktop to settle
sleep 5
#gets the hardware id's of all mice plugged into the system
hardwareIds=$(xinput | grep -i mouse | awk '{print substr($(NF-3),4)}')
#turn off mouse acceleration
for i in $hardwareIds
do
xinput set-prop ${i} 'Device Accel Profile' -1
xinput set-prop ${i} 'Device Accel Velocity Scaling' 1
i want to know how to execute this script .in windows we had .bat file just double click its does every thing ...but in linux how to do it?
other methods/working scripts for disabling acceleration is appreciated
Thanks:)
How To Make/Create a Script and Run it ?
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Topics in this forum are automatically closed 6 months after creation.
How To Make/Create a Script and Run it ?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: How To Make/Create a Script and Run it ?
oh btw i found this script on https://www.henrypoon.com/blog/2015/01/ ... in-ubuntu/
Re: How To Make/Create a Script and Run it ?
It's an incomplete script. It looks like to be missing at least the first line (should be something like "#!/usr/bin/env bash") and last line (should be "done"). As you've quoted it here, this will not work. Looking at your link that would also not work as it's missing the first line.
Just like on Windows you can execute script files on Linux by just double-clicking them in your file manager. There are three differences with Windows:
All that said, the better way to disable mouse acceleration is to configure X. To do that run this command (assuming you're on Cinnamon):
And put the following text in it:
Save and close the file. Reboot to activate it. Note that this disables mouse acceleration for all users. If you want to disable mouse acceleration only for you then try adding the following command to Startup Applications:
You can also run the command "xset m 0 0" yourself on the terminal to immediately disable mouse acceleration to see how that would be before implementing it.
Just like on Windows you can execute script files on Linux by just double-clicking them in your file manager. There are three differences with Windows:
- Linux doesn't care about file extensions. You can name your script whatever you want. Some folks use the extensions .sh to indicate the file is a shell script.
- Linux does require you to mark the script file as being executable. You do that in the file properties (from right-click menu in the file manager), on the permissions tab.
- There are many languages you can use to write scripts: shell, Python, JavaScript, and many more.
All that said, the better way to disable mouse acceleration is to configure X. To do that run this command (assuming you're on Cinnamon):
Code: Select all
gksudo gedit /etc/X11/xorg.conf.d/50-mouse-acceleration.conf
Code: Select all
Section "InputClass"
Identifier "My Mouse"
MatchIsPointer "yes"
Option "AccelerationProfile" "-1"
Option "AccelerationScheme" "none"
Option "AccelSpeed" "-1"
EndSection
Code: Select all
sh -c 'xset m 0 0'
Re: How To Make/Create a Script and Run it ?
thanks can u make that script complete with that syntax that u mentioned earlier ? i read somewhere that xset has some problem
Re: How To Make/Create a Script and Run it ?
xenopeek wrote:It's an incomplete script. It looks like to be missing at least the first line (should be something like "#!/usr/bin/env bash") and last line (should be "done"). As you've quoted it here, this will not work. Looking at your link that would also not work as it's missing the first line.
Just like on Windows you can execute script files on Linux by just double-clicking them in your file manager. There are three differences with Windows:The part you quoted is a shell script, using commands available also on the terminal. The default shell on Linux Mint is called bash. A good introduction to become more familiar with the shell and also touching on shell scripts is: http://en.flossmanuals.net/command-line/.
- Linux doesn't care about file extensions. You can name your script whatever you want. Some folks use the extensions .sh to indicate the file is a shell script.
- Linux does require you to mark the script file as being executable. You do that in the file properties (from right-click menu in the file manager), on the permissions tab.
- There are many languages you can use to write scripts: shell, Python, JavaScript, and many more.
All that said, the better way to disable mouse acceleration is to configure X. To do that run this command (assuming you're on Cinnamon):And put the following text in it:Code: Select all
gksudo gedit /etc/X11/xorg.conf.d/50-mouse-acceleration.conf
Save and close the file. Reboot to activate it. Note that this disables mouse acceleration for all users. If you want to disable mouse acceleration only for you then try adding the following command to Startup Applications:Code: Select all
Section "InputClass" Identifier "My Mouse" MatchIsPointer "yes" Option "AccelerationProfile" "-1" Option "AccelerationScheme" "none" Option "AccelSpeed" "-1" EndSection
You can also run the command "xset m 0 0" yourself on the terminal to immediately disable mouse acceleration to see how that would be before implementing it.Code: Select all
sh -c 'xset m 0 0'
i get following error when i save
Could not find the file /etc/X11/xorg.conf.d/50-mouse-acceleration.conf.
Please check that you typed the location correctly and try again.