diff --git a/atom/common/platform_util_linux.cc b/atom/common/platform_util_linux.cc index 923adbd882be..5c0eaecdd1c2 100644 --- a/atom/common/platform_util_linux.cc +++ b/atom/common/platform_util_linux.cc @@ -7,7 +7,9 @@ #include #include "base/cancelable_callback.h" +#include "base/environment.h" #include "base/files/file_util.h" +#include "base/nix/xdg_util.h" #include "base/process/kill.h" #include "base/process/launch.h" #include "url/gurl.h" @@ -100,7 +102,18 @@ bool MoveItemToTrash(const base::FilePath& full_path) { if (getenv(ELECTRON_TRASH) != NULL) { trash = getenv(ELECTRON_TRASH); } else { - trash = ELECTRON_DEFAULT_TRASH; + // Determine desktop environment and set accordingly. + std::unique_ptr env(base::Environment::Create()); + base::nix::DesktopEnvironment desktop_env( + base::nix::GetDesktopEnvironment(env.get())); + if (desktop_env == base::nix::DESKTOP_ENVIRONMENT_KDE4 || + desktop_env == base::nix::DESKTOP_ENVIRONMENT_KDE5) { + trash = "kioclient5"; + } else if (desktop_env == base::nix::DESKTOP_ENVIRONMENT_KDE3) { + trash = "kioclient"; + } else { + trash = ELECTRON_DEFAULT_TRASH; + } } std::vector argv;