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.

        printf "open window...
"

        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 "
"


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. :slight_smile: