Results 1 to 3 of 3

Thread: Detect Desktop Environment

  1. #1
    Join Date
    Jun 2008
    Location
    Kent, UK
    Posts
    5
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Detect Desktop Environment

    Hi,

    Is there an easy way to detect the desktop environment?

    I want to launch the default calculator and the default on screen keyboard but I do not know how to check if KDE, Gnome or something else is being used.

  2. #2
    Join Date
    Jan 2006
    Posts
    70
    Thanks
    13
    Thanked 5 Times in 5 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Detect Desktop Environment

    I don't know how much help this will be to you, but I always perform the following commands from a terminal.

    Qt Code:
    1. ps -ef | grep startkde
    2.  
    3. or
    4.  
    5. ps -ef | grep gnome-session
    To copy to clipboard, switch view to plain text mode 

    startkde (to run kde)
    gnome-session (to run Gnome)

    This will tell you whether kde or gnome is running. You could write code to perform this system call and then parse the return to determine the environment.

    Not pretty, but it just might work.

  3. The following user says thank you to bitChanger for this useful post:

    phannent (19th August 2008)

  4. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Detect Desktop Environment

    If you want to see how Qt does it, take a look at qt_init() in src/gui/kernel/qapplication_x11.cpp. Search for "X11->desktopEnvironment".
    J-P Nurmi

  5. The following user says thank you to jpn for this useful post:

    phannent (19th August 2008)

Similar Threads

  1. problem with indexes
    By MarkoSan in forum Qt Programming
    Replies: 5
    Last Post: 10th December 2007, 15:55

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.