Hi all,
I have a netbook (Acer Aspire One) I'm running Slackware 13. and usually, I prefer to connect an external monitor. When I switch my machine on with the monitor connected, the display is duplicated on both screens and since I just want the netbook's screen to be off and only see the display on the external monitor, I can do
xrandr --output LVDS --off
Great! However, it's a hassle to do this every time I log in and I'd like to automate the process if possible. I did some googling and I found that if you want to automate xrandr commands, you can put a script in /etc/X11/Xsession.d/ (see
this). I wrote the following script to automate my xrandr commands and since the Xsession.d directory didn't exist, I tried creating it. The script was called 45custom-xrandr_settings, as the one on the RandR wiki is called the same.
Code:
#!/bin/bash
# Check whether the external monitor is connected
xrandr | grep VGA | grep " connected "
# 0 is returned on success
if [ $? -eq 0 ]; then
xrandr --output LVDS --off
fi
However, when I start my machine with the monitor attached, the script does not seem to be executed (and yes, execute permissions were set!). The script itself works fine, which I know since I executed it manually. I've also tried putting the commands in ~/.xinitrc and /etc/X11/xinit/xinitrc.kde, but they're all ignored.
So, what is the correct way to automate xrandr commands under Slack?