diff options
Diffstat (limited to 'home-manager/config/lf')
-rwxr-xr-x | home-manager/config/lf/cmds/trash | 33 | ||||
-rw-r--r-- | home-manager/config/lf/default.nix | 3 |
2 files changed, 18 insertions, 18 deletions
diff --git a/home-manager/config/lf/cmds/trash b/home-manager/config/lf/cmds/trash index cbe6ab63..78018721 100755 --- a/home-manager/config/lf/cmds/trash +++ b/home-manager/config/lf/cmds/trash @@ -4,22 +4,19 @@ # . ~/.local/lib/shell/lib . %SHELL_LIBRARY_PATH -#files=$(printf "$fx" | tr '\n' ';') -# -#while [ "$files" ]; do -# # extract the substring from start of string up to delimiter. -# # this is the first "element" of the string. -# file=${files%%;*} -# -# trash-put "$(basename "$file")" -# # if there's only one element left, set `files` to an empty string. -# # this causes us to exit this `while` loop. -# # else, we delete the first "element" of the string from files, and move onto the next. -# if [ "$files" = "$file" ]; then -# files='' -# else -# files="${files#*;}" -# fi -#done -trash put "$fx"; +trash_output=$(mktmp); +expected_error_output=$(mktmp); + +# try trashy first +nix run nixpkgs#trashy -- put "$fx" 2> $trash_output; + +cat << EOF > $expected_error_output; +error: Error during a \`trash\` operation: Unknown { description: "Path: '\"/.Trash-1000\"'. Message: Permission denied (os error 13)" } +EOF + +if [ "$(cat $expected_error_output)" = "$(cat $trash_output)" ];then + warning "Deleting with trash-cli to the /.Trash folder"; + # this file could not be trashed because it is on the tempfs volume, trash-cli can do this this + printf "%s" "$fx" | tr '\n' ' ' | xargs trash-put; +fi # vim: ft=sh diff --git a/home-manager/config/lf/default.nix b/home-manager/config/lf/default.nix index 6d5095e1..d0f6ba40 100644 --- a/home-manager/config/lf/default.nix +++ b/home-manager/config/lf/default.nix @@ -55,6 +55,8 @@ in { xdg.configFile."lf/icons".source = ./icons; xdg.configFile."lf/colors".source = ./colors; +# TODO add the systemd tempfile option here + programs.lf = { enable = true; @@ -89,6 +91,7 @@ in { (pkgs) fzf trashy + trash-cli ; }; }; |