LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-08-2012, 04:43 AM   #1
Knightron
Senior Member
 
Registered: Jan 2011
Location: Australia
Distribution: OpenSUSE
Posts: 1,396
Blog Entries: 7

Rep: Reputation: 166Reputation: 166
How do i have a script automatically launched on startup


Hello, i've been trying to figure this out for about three hours now and just can't. I am running Debian Wheezy on my thinkpad. I am trying to configure the middle button to scroll with the trackpoint. I've been to the think wiki and have grabbed this script.
Code:
#!/bin/sh
xinput list | sed -ne 's/^[^ ][^V].*id=\([0-9]*\).*/\1/p' | while read id
do
        case `xinput list-props $id` in
        *"Middle Button Emulation"*)
                xinput set-int-prop $id "Evdev Wheel Emulation" 8 1
                xinput set-int-prop $id "Evdev Wheel Emulation Button" 8 2
                xinput set-int-prop $id "Evdev Wheel Emulation Timeout" 8 200
                xinput set-int-prop $id "Evdev Wheel Emulation Axes" 8 6 7 4 5
                xinput set-int-prop $id "Evdev Middle Button Emulation" 8 0
                ;;
        esac
done

# disable middle button 
xmodmap -e "pointer = 1 9 3 4 5 6 7 8 2"
If i put this in my .bashrc file it works but only when i launch the terminal. I would like it to run automatically. I'm under the impression that this is done with /etc/rc.local, but i've not much clue about rc.local. made the rc.local file executable but don't know what to put in there to have this bloody script launch. I think wheezy uses systemd? Here is the contents of my rc.local file at the moment.
Code:
#!/bin/sh -e
#
# rc.local
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

exit 0
Please help me get my script to launch automatically.

Last edited by Knightron; 07-08-2012 at 04:45 AM.
 
Old 07-08-2012, 04:59 AM   #2
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,254

Rep: Reputation: 314Reputation: 314Reputation: 314Reputation: 314
You can't use rc.local due using command "xinput" which need access to X server. You must add it to X session starting script. For example in "/etc/X11/Xsession.d" But it may depends on used desktop environment - KDE and as I think Gnome has appropriate configuration options for autostarting programs. So specify which one you use.
 
1 members found this post helpful.
Old 07-08-2012, 05:15 AM   #3
414N
Member
 
Registered: Sep 2011
Location: Italy
Distribution: Slackware
Posts: 635

Rep: Reputation: 186Reputation: 186
You should put those evdev options in a dedicated file inside /etc/X11/xorg.conf.d or inside a /etc/X11/xorg.conf file.
For the xmodmap command you may want to look at the ButtonMapping option for the evdev X input driver.
See man evdev for the syntax and other details.
 
1 members found this post helpful.
Old 07-08-2012, 08:16 PM   #4
Knightron
Senior Member
 
Registered: Jan 2011
Location: Australia
Distribution: OpenSUSE
Posts: 1,396
Blog Entries: 7

Original Poster
Rep: Reputation: 166Reputation: 166
Gday guys, thanks for your helpful suggestions. I took your advice and then cheated. I've found Opensuse to have the best hardware detection i've seen: it was like it had a profile for my laptop or something. Everything worked perfectly in Opensuse; so i did some experimenting with what you guys said in mind, and mounted my Opensuse partition and then copied the xord.d file over to my Debian partition and rebooted. My Debian partition now works as flawlessly as my Opensuse partition. Thanks guys.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to run 'script' automatically on Konsole/Yakuake startup/new tab? klearview Linux - Software 7 11-29-2011 08:10 PM
start own script during the startup automatically cccc SUSE / openSUSE 11 03-13-2006 04:40 PM
KsCD/Kaffeine are launched automatically when inserting CDs/DVDs dreamtheater Linux - Software 1 01-03-2006 08:23 AM
Script to automatically config eth0 at startup jhachey Linux - Networking 2 11-03-2003 03:06 AM
How can the linux OS run script automatically at startup? tommylkc Linux - Newbie 1 06-26-2002 04:09 AM


All times are GMT -5. The time now is 03:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration