Use GetDesktopEnvironment to determien desktop env
Which can get a much more precise result for us.
This commit is contained in:
parent
f9dbdf4522
commit
6db827cc9a
1 changed files with 11 additions and 6 deletions
|
@ -7,7 +7,9 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#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"
|
||||
|
@ -101,10 +103,13 @@ bool MoveItemToTrash(const base::FilePath& full_path) {
|
|||
trash = getenv(ELECTRON_TRASH);
|
||||
} else {
|
||||
// Determine desktop environment and set accordingly.
|
||||
std::string desktopEnv = getenv(DESKTOP_SESSION);
|
||||
if (desktopEnv.find("plasma") != std::string::npos) {
|
||||
std::unique_ptr<base::Environment> 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 (desktopEnv.find("kde") != std::string::npos) {
|
||||
} else if (desktop_env == base::nix::DESKTOP_ENVIRONMENT_KDE3) {
|
||||
trash = "kioclient";
|
||||
} else {
|
||||
trash = ELECTRON_DEFAULT_TRASH;
|
||||
|
|
Loading…
Reference in a new issue