4

I want these 2 commands to run on boot.

xinput --set-prop "Razer Razer DeathAdder" "Device Accel Constant Deceleration" 4
xinput --set-prop "Razer Razer DeathAdder" "Device Accel Velocity Scaling" 1

I tried putting these 2 commands /etc/rc.local, .zshrc, also in /etc/xdg/lxsession/Lubuntu/autostart, but nothing seems to happen. Any help please?

6
  • 1
    Try putting them in your .xinitrc. Oct 26, 2013 at 22:03
  • I dont have a .xinitrc
    – trttrt
    Oct 27, 2013 at 12:26
  • @SkippyleGrandGourou why would .xinitrc be read unless xinit is used to start X?
    – terdon
    Oct 27, 2013 at 15:17
  • @trttrt : yes, but you would create it. Anyway, terdon is probably right, try to follow his answer. Oct 27, 2013 at 16:42
  • @terdon : well, I do use it (through startx in my .bash_profile) so other people might as well… Besides, it has never been clear to me where to put such commands as well as it's different on almost every setup, hence the suggestion. Oct 27, 2013 at 16:47

3 Answers 3

4

As Skippy said, you should add them to the ~/.xinitrc file. This is because:

  • /etc/rc.local executes at boot time, before the Xserver is up
  • .zshrc gets loaded only when you start a zsh shell.
  • /etc/xdg/lxsession/Lubuntu/autostart needs an special name and format: they should be named <something>.conf and has proper exec= values and be stored in /etc/xdg/autostart/.

The above will not work

You only need to source the scripts lines in the ~/.xinitrc or in /etc/X11/xinit/xinitrc for system wide proposes.

This should work:

sudo sh -c "echo 'xinput --set-prop \"Razer Razer DeathAdder\" \"Device Accel Constant Deceleration\" 4' >> /etc/X11/xinit/xinitrc"
sudo sh -c "echo 'xinput --set-prop \"Razer Razer DeathAdder\" \"Device Accel Velocity Scaling\" 1' >> /etc/X11/xinit/xinitrc"

Of course, the said commands should work if you use the terminal, otherwise your are doing nothing. Then reboot your system and ta-da.

10
  • Sorry, but I put the commands (tried all the combinations) but still they will not run on boot. Do I need to make it executable? I did it, nothing
    – trttrt
    Oct 27, 2013 at 12:29
  • This is what I get: xinit is already the newest version.
    – trttrt
    Oct 27, 2013 at 12:41
  • I created ~/.xinitrc, put the commands in, didn't work. Then I deleted ~/.xinitrc (since it didn't work), and put my commands in /etc/X11/xinit/xinitrc, and nothing happened.
    – trttrt
    Oct 27, 2013 at 12:47
  • The commands work fine in the terminal.
    – trttrt
    Oct 27, 2013 at 12:47
  • With the new answer I am getting this: "Razer: 1: Razer: Syntax error: Unterminated quoted string"
    – trttrt
    Oct 27, 2013 at 12:51
3

I don't really see how .xinitrc is relevant here. That file is read by xinit, an old way of starting an X session and one you are almost certainly not using. In most modern Linux systems, the X session is started by a login manager service, for example lightdm or gdm2 or whatever and not by xinit.

Anyway, according to the LXDE wiki, you need to add these lines to $HOME/.config/lxsession/<profile>/autostart. Change <profile> to whatever you have in $HOME/config/lxsession. Just edit (or create of it does not exist) the file and add the relevant lines to it:

xinput --set-prop "Razer Razer DeathAdder" "Device Accel Constant Deceleration" 4                                 
xinput --set-prop "Razer Razer DeathAdder" "Device Accel Velocity Scaling" 1  
0

Putting xinput command into a shell script and adding that script to be executed via ~/.config/lxsession/LXDE/autostart worked for me.

Example:

$ cat ~/bin/set-touch
#!/bin/bash

xinput set-prop "ADS7846 Touchscreen" "Coordinate Transformation Matrix" 1.09588 0 -0.0565 0 -1.11 1.057 0 0 1
    
$ cat ~/.config/lxsession/LXDE/autostart 
@xset s off
@xset -dpms
@xset s noblank
@bin/set-touch
@midori -e Fullscreen -a https://start.duckduckgo.com/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .