Script for executing xrandr when Fn+F7 is pressed

Hi there,

i tried to modify the /usr/lib/acpid/thinkpad_handler script to execute “xrandr --auto” for autodetecting all display’s when pressing Fn+F7. Looking like this

#!/bin/bash

HOTKEY=$1
set $HOTKEY
EVENT=$1 # “ibm/hotkey”
ACPI=$2 # “HOTK”
WHAT=$3 # “00000080”
SERIAL=$4 # “0000100c” Fn+F12

bluetooth

if “$WHAT” = “00000080” -a “$SERIAL” = “00001005” ]; then
ACTION=“disable”
grep -q “disabled” “/proc/acpi/ibm/bluetooth” && ACTION=“enable”
echo $ACTION > “/proc/acpi/ibm/bluetooth”
fi

xrandr

if “$WHAT” = “00000080” -a “$SERIAL” = “00001007” ]; then
xrandr --auto
fi

The coloured lines were added by me. Unfortunately, nothing happens (my deactivated laptop-screen won’t get activated). I added a “echo “Test” > /txt” line to check, if the conditions are fulfilled. “/txt” is created - so keycodes seems to be right. I executed “xrandr --auto” in a “Konsole”-window and my deactivated laptop-screen gets activated. So what did I wrong ?

Regards, user2304.

Hi there,

spend some minutes (hours) on my problem and with the help of Script for Dynamic Display Management with fglrx - ThinkWiki it’s finally working now.

Added the part of determining the current X user in the moment FN+F7 is pressed and setting the right display. If someone is interrested in details, i would post the whole script.

Regards, user2304