diff --git a/src/nnn.c b/src/nnn.c index 416e0ca8..8191e456 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -550,6 +550,7 @@ static runstate g_state; #define UTIL_GIO_TRASH 19 #define UTIL_RM_RF 20 #define UTIL_ARCHMNT 21 +#define UTIL_TRASH 22 /* Utilities to open files, run actions */ static char * const utils[] = { @@ -591,6 +592,7 @@ static char * const utils[] = { "gio trash", "rm -rf --", "archivemount", + "trash", }; /* Common strings */ @@ -2577,9 +2579,23 @@ static bool xrm(char * const fpath, bool use_trash) rm_opts[1] = r; spawn("rm", rm_opts, "--", fpath, F_NORMAL | F_CHKRTN); - } else - spawn(utils[(g_state.trash == 1) ? UTIL_TRASH_CLI : UTIL_GIO_TRASH], + } else { + uint trash_util_idx; + switch(g_state.trash) { + case 1: + trash_util_idx = UTIL_TRASH_CLI; + break; + case 2: + trash_util_idx = UTIL_GIO_TRASH; + break; + case 3: + default: + trash_util_idx = UTIL_TRASH; + break; + } + spawn(utils[trash_util_idx], fpath, NULL, NULL, F_NORMAL | F_MULTI); + } return (access(fpath, F_OK) == -1); /* File is removed */ } @@ -8937,7 +8953,7 @@ int main(int argc, char *argv[]) /* Configure trash preference */ opt = xgetenv_val(env_cfg[NNN_TRASH]); - if (opt && opt <= 2) + if (opt && opt <= 3) g_state.trash = opt; /* Ignore/handle certain signals */