How to make my mouse.conf run automatically at system start?

Hi everyone. I need to slow down my mouse cursor beyond the lowest setting. I learned from reading around how to write the mouse.conf file and it works when I run it from the desktop manually, after my computer has started.

So far I have tried several methods with no success.

  • I tried to move the file into the “etc/init” folder but was denied access.
  • I’ve also tried to add the mouse.conf file to “preference/personal/startup applications” but it doesn’t run. I still need to run it manually every time I start the system.

I am very new to Ubuntu (from Windows 7) but I am eager to learn. Can someone tell me how to run my mouse.conf file automatically at start-up? I say “simple terms” so that you don’t assume any technical knowledge on my site, because there is so far none, I’m just starting.

Thanks for reading my request.

Can you post the content of the mouse conf file you are using here please

Also, as an aside, the reason you were unable to paste the “mouse.conf” file into the “etc/init” folder is because you need to be using Caja as root. To open Caja as root, type the following into a terminal:

sudo caja

Once opened, navigate to the “etc/init” folder and then leave this window open on the desktop. Then open up a new Caja window in the normal way and navigate to where you currently have your “mouse.conf” file stored. Then drag and drop (or copy and paste) the “mouse.conf” file from that window to the other, root Caja window, that is open at “etc/init”.

Hi stevecook, thanks for your quick reply.

I managed to move the mouse.conf into the etc/init folder. However it does not run at startup. I still need to run it manually. Here is the content of the file:

xinput --set-prop “USB Optical Mouse” “Device Accel Constant Deceleration” 4
xinput --set-prop “SynPS/2 Synaptics TouchPad” “Device Accel Constant Deceleration” 6

This will slow down the cursor of the touch pad and the mouse. I’ve changed the last number in the command line till I found the right cursor speed. Is there maybe another command I need to add for it to run automatically at start-up?

Ok, then if it were me, I would do the following:

  1. Open a blank Pluma document (you can find Pluma in the "applications/accessories" menu)

Paste the following into it:

sleep 5
xinput --set-prop "USB Optical Mouse" "Device Accel Constant Deceleration" 4
xinput --set-prop "SynPS/2 Synaptics TouchPad" "Device Accel Constant Deceleration" 6

Save the document somewhere in your home folder as "mouse-set.sh"

  1. Open Caja and navigate to where you have the "mouse-set.sh" file stored and right-click it and select "properties" and then go to the "permissions" tab and check the "allow executing file as program" check-box . See below:

Then close the "properties" dialog box (congratulations, you have just written your first bash script.... :slight_smile: )

  1. Go to "system/preferences/personal/startup applications" and click on the "add" button.

Put anything you want in the "name" field

Put anything you want on the "comment" field

For the "command" field, use the "browse" button to navigate to where you have stored your "mouse-set.sh" file and select it. When you have done all of that, it will look something like this:

Then click the "add" button to confirm. Then close the "startup applications" dialog.

  1. Log out and then back in.

That's it. You should now find that your mouse works as required automatically at login.

1 Like

Also, given the “mouse.conf” file you pasted into etc/init is not working, I would probably delete it from there so that it is as it was prior to your pasting it in there.

P.S…Just one caveat to the above, though; when you pasted it in there, you didn’t overwrite an existing one did you?

Hi @pet2000, Your question got me off my duff and add my permanent/system-wide solution to an old mouse post. In case you're interested:

I think we agree mice are way too wild these days and the GUI has NO WAY to set basic mouse sensitivity at all.

1 Like

I had deleted the old file already, no I didn’t over-ride anything. I’ve done as you said and it’s working perfect. I noticed when I saved the file in Pluma that the commands turned red colour, which I hadn’t seen before. Just wondering what the “sleep 5” is for?

Thank you very much for your help.

The “sleep” command is there to avoid something called a “race condition”. A lot of system processes are being executed in the first second or two when a user logs in. This means the system can sometimes miss an extra command put there by the user as it prioritizes more fundamental system process. By putting in the “sleep” command, it delays the execution of the other commands in the script just long enough so as to minimize the risk of a “race condition” occurring.

1 Like