Results 1 to 3 of 3

Thread: Detecting gnome and kde desktop - bash

  1. #1

    Default Detecting gnome and kde desktop - bash

    Can someone to examine this code and tell me if you see any problems? This code is tested for a KDE desktop. This seems to be most reliable method I've found through searching.

    Code:
            printf "open window...\n"
    
            if [[ $(wmctrl -m | grep KWin) ]]; then     
                 kdesu dolphin /var/log/VirusVault/  >/dev/null 2>&1 &
            fi
    
            if [[ $(wmctrl -m | grep GNOME) ]]; then     
                 gnome-open /var/log/VirusVault/  >/dev/null 2>&1 &
            fi
            
            #xdg-open /var/log/VirusVault >/dev/null 2>&1 &
            printf "\n"

  2. #2
    Join Date
    Jun 2008
    Location
    Auckland, NZ
    Posts
    21,924
    Blog Entries
    1

    Default Re: Detecting gnome and kde desktop - bash

    A reasonable approach IMO. Another might be using $XDG_CURRENT_DESKTOP
    openSUSE Leap 15.2; KDE Plasma 5

  3. #3

    Default Re: Detecting gnome and kde desktop - bash

    Quote Originally Posted by deano_ferrari View Post
    A reasonable approach IMO. Another might be using $XDG_CURRENT_DESKTOP
    I've read about that one. I'll use this method for now.

    Thanks.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •