script to open terminal w/command?

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
ratchet85
Level 1
Level 1
Posts: 2
Joined: Sun May 13, 2012 12:32 am

script to open terminal w/command?

Post by ratchet85 »

Hey guys,

I'm having issues with my logitech g300 mouse. It works fine w/ windows but it's acting all weird when u left/right click. I've found this code and it solved my problem. However, I need to open up terminal and paste that everytime I reboot mint. It's annoying especially when your mouse isn't working right.

Code: Select all

#!/bin/sh
DEVICE_ID=`xinput list |  grep "Logitech Gaming Mouse G300" | grep keyboard | sed 's/.*id=\([0-9]*\).*/\1/'`

if xinput -list-props $DEVICE_ID | grep "Device Enabled" | grep "1$" > /dev/null
then
   xinput set-int-prop $DEVICE_ID "Device Enabled" 8 0
fi
The guides also says that you can add the code to xinitrc.d to have it loaded automatically. Guide can be found at https://wiki.archlinux.org/index.php/Logitech_G300

Can someone help me edit the xinitrc file or create a simple script w/ that code?

Thank you!
User avatar
Danko8321
Level 4
Level 4
Posts: 206
Joined: Thu Sep 22, 2011 2:03 pm
Location: Colombia

Re: script to open terminal w/command?

Post by Danko8321 »

ratchet85 wrote:Hey guys,

I'm having issues with my logitech g300 mouse. It works fine w/ windows but it's acting all weird when u left/right click. I've found this code and it solved my problem. However, I need to open up terminal and paste that everytime I reboot mint. It's annoying especially when your mouse isn't working right.

Code: Select all

#!/bin/sh
DEVICE_ID=`xinput list |  grep "Logitech Gaming Mouse G300" | grep keyboard | sed 's/.*id=\([0-9]*\).*/\1/'`

if xinput -list-props $DEVICE_ID | grep "Device Enabled" | grep "1$" > /dev/null
then
   xinput set-int-prop $DEVICE_ID "Device Enabled" 8 0
fi
The guides also says that you can add the code to xinitrc.d to have it loaded automatically. Guide can be found at https://wiki.archlinux.org/index.php/Logitech_G300

Can someone help me edit the xinitrc file or create a simple script w/ that code?

Thank you!
You see, that thing you have right there is already a script. I'm gonna tell you what to do in order to make it start manually. First, you open "Gedit" and paste that command in it. You save the file as ".keyboard.sh" in your Home Folder (that is a dot before the name and it is importat you use that name so that you can run the command I'm gonna put below). then, you open a terminal and type

Code: Select all

chmod u+x .keyboard.sh
In order to make it executable. Later on, you open "Startup Aplications" and add a new app to sartup. You can name it whatever you want, but remember to put .keyboard.sh in the part that says command. Log out and log back in order to test it.

Let me know if it works and if you have any doubts. Cheers. Danko.
Cheer up! Things are getting worse at a slower rate.
ratchet85
Level 1
Level 1
Posts: 2
Joined: Sun May 13, 2012 12:32 am

Re: script to open terminal w/command?

Post by ratchet85 »

Hey Danko,

Thanks to you I got the issue solved but with a different way than you said. I didn't know which "home" you are talking about so I pasted it in all of the following: root, file system, file system/bin, home, home/user and followed all of your other steps to the letter but it didn't work. Since you said that the code was alread a script, I just pasted it in gedit, saved a copy and right clicked it to run as an executable.
Then, I went to startup apps and added it like you said before and its working great now :) I wouldn't have done it without your help. Thanks man!
Post Reply

Return to “Newbie Questions”