| Launch program via DBus |
|
|
|
| Written by Andreas Böhler |
| Monday, 22 March 2010 15:22 |
|
My brand new Tablet-PC features a sensor that detects in which position the screen is and triggers an acpi event upon swivel-up and swivel-down. I found quite some scripts to automatically rotate the screen and adjust the tablet according to the rotation, but most of them failed either immediately or stopped working after the upgrade to xf86-input-wacom. Here is a simple yet effective way to overcome this limitation. I use the DBus system to send a message to a daemon running with user privileges that then executes the program. This way everything runs as the user it is intended for, including all environment variables. xrandr and xsetwacom are working quite well!
I launch dbus-exec-server.py via my session manager (XFCE) and then execute dbus-exec.py as the root user with the program to run as parameter. Rotating the screen would become: dbus-exec.py xrandr -o normal With the included dbus-exe.conf (which needs to be copied to /etc/dbus-1/system.d) only the root user can send messages to dbus-exec!
|
| Last Updated on Monday, 22 March 2010 15:31 |