private static LinuxDesktop detectDesktopSession(){
  ArrayList<String> command=new ArrayList<String>();
  command.add("sh");
  command.add("-c");
  command.add("echo \"$DESKTOP_SESSION\"");
  Map<String,Object> desktops=new HashMap<String,Object>();
  desktops.put("kde",LinuxDesktop.desktopKde);
  desktops.put("gnome",LinuxDesktop.desktopGnome);
  desktops.put("cinnamon",LinuxDesktop.desktopCinnamon);
  desktops.put("xfce",LinuxDesktop.desktopXfce);
  String desktop=isExpectedCommandOutput(command,desktops,true);
  if (desktop != null && !desktop.isEmpty()) {
    return (LinuxDesktop)desktops.get(desktop);
  }
  return LinuxDesktop.desktopUnknown;
}

private static LinuxDesktop detectDesktopSession ( ) { ArrayList < String > command = new ArrayList < String > ( ) ; command . add ( "sh" ) ; command . add ( "-c" ) ; command . add ( "echo \"$DESKTOP_SESSION\"" ) ; Map < String , Object > desktops = new HashMap < String , Object > ( ) ; desktops . put ( "kde" , LinuxDesktop . desktopKde ) ; desktops . put ( "gnome" , LinuxDesktop . desktopGnome ) ; desktops . put ( "cinnamon" , LinuxDesktop . desktopCinnamon ) ; desktops . put ( "xfce" , LinuxDesktop . desktopXfce ) ; String desktop = isExpectedCommandOutput ( command , desktops , true ) ; if ( desktop != null && ! desktop . isEmpty ( ) ) { return ( LinuxDesktop ) desktops . get ( desktop ) ; } return LinuxDesktop . desktopUnknown ; }
detects desktop from $ desktop_session
