7

I am trying to run some bash commands in my .xinitrc script, but the window manager starts without these commands running properly.

I run Arch Linux with the window manager is called "awesome", and I start it with startx. This is the entirety of my ~/.xinitrc file:

#!/bin/sh
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)

if [ -d /etc/X11/xinit/xinitrc.d ]; then
  for f in /etc/X11/xinit/xinitrc.d/*; do
    [ -x "$f" ] && . "$f"
  done
  unset f
fi

xinput set-int-prop "TPPS/2 IBM Trackpoint" "Evdev Wheel Emulation" 8 1
xinput set-int-prop "TPPS/2 IBM Trackpoint" "Evdev Wheel Emulation Button" 8 2
xinput set-int-prop "TPPS/2 IBM Trackpoint" "Evdev Wheel Emulation Timeout" 8 200
xinput set-int-prop "TPPS/2 IBM Trackpoint" "Evdev Wheel Emulation Axes" 8 6 7 4 5

rfkill block bluetooth

# exec gnome-session
# exec startkde
# exec startxfce4
# ...or the Window Manager of your choice
exec awesome

As you may have noticed, I'm trying to shut down my Bluetooth and activate trackpoint scrolling on my laptop. Each of those xinput and rfkill commands work when entered manually, but nothing happens when I run startx.

What on earth is the problem here? :(

Joshua
  • 341
  • 2
  • 3
  • 6
  • At least `rfkill` needs root privileges, if I'm not mistaken. Are you sure `rfkill block bluetooth` works on your system with user rights? – Marco Dec 10 '12 at 21:47
  • Are these commands producing any errors? Could it be that they're working, but something later in your session startup overrides these settings? Try launching just an xterm instead of a window manager, while you're testing that. – Gilles 'SO- stop being evil' Dec 10 '12 at 23:23
  • @Gilles I tried starting only xterm (I replaced `exec awesome` with `exec xterm`) but I am presented with a completely blank terminal with no errors... – Joshua Dec 10 '12 at 23:40
  • @Marco `rfkill` does indeed require root privileges, but I assumed that `.xinitrc` was run as root. If I can't `rfkill` in `.xinitrc`, where should I run it? – Joshua Dec 10 '12 at 23:42
  • @Joshua You should be able to type commands in this terminal. The `.xinitrc` is your session initialization file, it most assuredly is not executed as root. If you want something to be executed as root, it should be in the system startup, not in your session's startup. – Gilles 'SO- stop being evil' Dec 10 '12 at 23:45
  • @Gilles I see...Well, I'm using `systemd` which seems to deal with services rather than startup scripts, so any ideas where I can put it? I don't want to manually enter `rfkill` every time I reboot... – Joshua Dec 10 '12 at 23:48
  • @Joshua I'm not familiar with Arch; there may well already be a configuration file under `/etc` where you can specify default Bluetooth settings. I recommend posting this as a separate question. If all else fails, you can put this command in [`/etc/rc.local`](https://wiki.archlinux.org/index.php/Initscripts#.2Fetc.2Frc.local). – Gilles 'SO- stop being evil' Dec 10 '12 at 23:51

2 Answers2

1

Urgh...the underlying problem was really trivial.

rfkill requires root privileges, so it wouldn't run properly.

The reason my xinput commands didn't work was because of a typo in the device name. It should be "TrackPoint" not "Trackpoint". xinput just silently failed.

Damn it, that took way longer than I'm proud of.

Joshua
  • 341
  • 2
  • 3
  • 6
0

Look at ~/.xsession-errors. The output of .xinitrc is redirected there, so any errors that are encountered should show up there and will help you debugging your script.