Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

get_x_user

Help
jmfv
2006-06-16
2013-04-08
  • jmfv
    jmfv
    2006-06-16

    Hello

    My computer is an ASUS A3500N laptop, running Debian Sarge Testing, and I'm trying to implement some missing hotkeys support, such as volume up/down and the Web Browser, Mail Client, etc. 

    I've looked into the /usr/share/doc/powersave/contrib files and found very nice looking examples 'acpi_hotkeys_ASUS_M6842NW' and
    'acpi_hotkeys_ASUS_L2400D'. It was fairly easy to implement support for volume up/down/mute hotkey by putting a script in /usr/lib/powersave/scripts that tests the hotkey code and runs a command accordingly.

    The only thing that is failing now is the Web Browser and Mail Client like keys, where I have to launch an X application, something like

    if [ $hotkey = 00000050 ];
    then
    run_on_xserver "/usr/bin/thunderbird"
    fi

    where run_on_xserver is defined as

    run_on_xserver() {
      get_x_user
      su $X_USER -c "DISPLAY=$DISP $1"
    }

    Unfortunately, the get_x_user always detects that the "x_user" username is "root", although I'm logged in KDE as "debian_user". That is why the run_on_xserver fails. If I change

      su $X_USER -c "DISPLAY=$DISP $1"

    to

      su debian_user -c "DISPLAY=$DISP $1"

    the run_on_xserver works. But leaving the hotkey_handler script this way isn't very elegant, is it? :D

    Help appreciated! Thank you!

     
    • Holger Macht
      Holger Macht
      2006-06-16

      Hi,

      a call like "su debian_user -c "DISPLAY=$DISP $1" " is of course fine for you because it works. The disadvantage is that it really only works on your system. The mechanism to get the real logged in user failes somehow on debian. Can you please post the output of '/usr/lib/powersave/wttyhx -v' (as root), because that's the way get_x_user tries to determine the running X sessions.

      Additionally, we currently try to create a general hotkey script which works on every ASUS laptop. If you want to have a look:
        https://bugzilla.novell.com/show_bug.cgi?id=182234

      Thanks for reporting,
        Holger

       
    • jmfv
      jmfv
      2006-06-16

      Hello

      Thanks for your reply. The output of

      /usr/lib/powersave/wttyhx -v

      is (as expected:))

      7 root :0 4

      Now, is there a nice way to figure out which user is using X-windows? Maybe by testing a ownership of a file in the /tmp dir?

      The hotkey script you're creating is very nice, thanks for the link! I'll try to provide some suggestions as an ASUS laptop user.

      Thanks for your help.
      jmfv

       
    • jmfv
      jmfv
      2006-06-23

      Hi

      The Debian updates fixed the wttyhx problem. So the hotkeys script works now fine. I've made a complete how-to configure an ASUS laptop with Debian. If you're interested, please be welcome at

      http://mega.ist.utl.pt/~jmfv/ASUS_A3500N.html

      Cheers!
      jmfv