Results 1 to 4 of 4

Thread: Determine Linux desktop version

  1. #1
    Join Date
    Nov 2008
    Posts
    183
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Determine Linux desktop version

    All,

    Before I go dumpster diving through a lot of VLC source to figure out how they do it, is there a Qt way to find out the desktop and version? How you turn off the lock screen and power save is different depending on desktop and version.

    FDO_SS, /**< KDE >= 4 and GNOME >= 3.10 */
    FDO_PM, /**< KDE and GNOME <= 2.26 */
    MATE, /**< >= 1.0 */
    GNOME, /**< GNOME 2.26..3.4 */

    Not seeing anything off top of head so thought I would ask. There "should" be something somewhere, but too many classes to guess the name. Didn't see it in sysinfo.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Determine Linux desktop version

    You can start with getenv("XDG_CURRENT_DESKTOP") and build from there (e.g. getenv("KDE_SESSION_VERSION")).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


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

    RolandHughes (23rd June 2015)

  4. #3
    Join Date
    Nov 2008
    Posts
    183
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Determine Linux desktop version

    Quote Originally Posted by wysota View Post
    You can start with getenv("XDG_CURRENT_DESKTOP") and build from there (e.g. getenv("KDE_SESSION_VERSION")).
    Thanks,

    I knew there had to be something simple.

    Actually, I don't know if I need to know it now. I "think" I can just send a QDBusMessage to each of the APIs. They will either exist or not. The routine is a one-shot deal to kill off the screen locker and power dimmer. I know, killing a mosquito with a shotgun blast, but sometimes it is just faster.

  5. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Determine Linux desktop version

    Most reasonably modern (<= 10 years) desktops will have those exposed as D-Bus interfaces.

    As the snippet you posted indicates, the service names are likely org.freedesktop.ScreenSaver and org.freedesktop.PowerManagement (easily verfiyable using qdbusviewer or similar tools).

    Cheers,
    _

Similar Threads

  1. Replies: 0
    Last Post: 22nd May 2015, 04:43
  2. How to determine QWebKit version ?
    By dkj5 in forum Newbie
    Replies: 2
    Last Post: 26th March 2013, 05:57
  3. Replies: 3
    Last Post: 13th July 2012, 13:09
  4. can i develope commercial desktop app with qt4.5 lgpl version?
    By newtowindows in forum General Discussion
    Replies: 3
    Last Post: 17th October 2009, 10:06
  5. How to determine the compiler-version (GCC) ?
    By Comer352l in forum Qt Programming
    Replies: 1
    Last Post: 2nd January 2009, 19:55

Tags for this Thread

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.