Forum › Forums › antiX-development › Development › antiX-23 – based on Debian 12 Bookworm – ideas
- This topic has 110 replies, 25 voices, and was last updated Jan 24-9:23 pm by Xunzi_23.
-
AuthorPosts
-
January 24, 2023 at 3:03 pm #98167Member
PPC
::@anticapitalista :
Sucess in having a context menu entry that only shows up if the user is in the Trash folder, that allows to restore the file to it’s original folder.
In case a file already exists with the same name, a number will be appended to the end of the restored file (yes, changing it’s extension! ex: .docx -> .docx~1~)Please adapt this, to your zzzfm config file and test (you’ll have to edit the cstm_0783b17b-next=~field. Also the “label” is “Restore file” and it ideally be localized. Also, a nice icon (something like an arrow leaving the Trash Can would be nice)…
cstm_0783b17b-label=Restore cstm_0783b17b-next=cstm_25a291d5 cstm_0783b17b-cxt=0%%%%%2%%%%%2%%%%%3%%%%%.local/share/Trash/files cstm_0783b17b-prev=edit_delete cstm_0783b17b-line=selection0=%f\nselection=$(basename $selection0)\nextension=".trashinfo"\norigin_of_selected_file0=$HOME/.local/share/Trash/files/$selection\ndata_about_selected_file0=$HOME/.local/share/Trash/info/$selection$extension\noriginal_path_of_file=$(cat $data_about_selected_file0 | grep "Path=" |cut -c6-)\nmv --backup=numbered $selection0 $original_path_of_file\nrm $data_about_selected_file0\n cstm_0783b17b-task=1 cstm_0783b17b-task_err=1 cstm_0783b17b-task_out=1 cstm_0783b17b-keep=1
Edit:
In case you want to try to manually add this entry:
– Open zzzfm and navigate to any folder with files (ex: ~)
– Right click a file, to access the contextual menu
– Right click over the “Delete” menu entry and select “+ New” > “Command”
– Name the entry something like “Restore file”/”Undelete file”/etc
– On the Command tab enter this code:selection0=%f selection=$(basename $selection0) extension=".trashinfo" origin_of_selected_file0=$HOME/.local/share/Trash/files/$selection data_about_selected_file0=$HOME/.local/share/Trash/info/$selection$extension original_path_of_file=$(cat $data_about_selected_file0 | grep "Path=" |cut -c6-) mv --backup=numbered $selection0 $original_path_of_file rm $data_about_selected_file0
-On the Context tab select this (sorry, if not accurate, I’m using zzzfm in pt) (also note: this is part is not very intuitive, but make sure that you end up with this result):
“Show” item if context “does not match any of the following rules”
“Folder/Directory” “does not contain” “.local/share/Trash/files”
-Click “Ok” on the bottom right
-Now the “Restore” contextual menu should only come up if you are in the Trash folder. It allows you the restore the selected file, or the first of several selected files
NOTE: this only works to restore 1 file at a time!!!! It would be more complex, making it work with several selected files – anyone better than me at bash scripting, please, take a stab at it!
Edit: in a following post is the “script” that allows users to restore several files at once.P.
- This reply was modified 4 days, 5 hours ago by PPC.
- This reply was modified 4 days, 4 hours ago by PPC.
- This reply was modified 4 days, 3 hours ago by PPC.
January 24, 2023 at 4:07 pm #98171Forum Adminanticapitalista
::@PPC – I did the manual way and it worked. Great!
However, I noticed that the bookmarks folders only work on live since it expects to see a demo user.
Philosophers have interpreted the world in many ways; the point is to change it.
antiX with runit - leaner and meaner.
January 24, 2023 at 4:18 pm #98172MemberPPC
::@anticapitalista:
To solve the problem with the bookmarks only working in “demo” user, try this:
– make sure zzzfm is closed
– edit it’s session file, replacing all instances of “/home/demo” with “~” this *should* workNew version of the mini script to restore files from zzzfm’s contextual menu, that allows to select and restore as many files as the user wants:
for file in %F; do selection0=$file selection=$(basename "$selection0") extension=".trashinfo" origin_of_selected_file0=$HOME/.local/share/Trash/files/$selection data_about_selected_file0=$HOME/.local/share/Trash/info/$selection$extension original_path_of_file=$(cat "$data_about_selected_file0" | grep "Path=" |cut -c6-) mv --backup=numbered "$selection0" "$original_path_of_file" rm "$data_about_selected_file0" done
I tested this “script” many times in many ways. The only “bug” is that if the original file has spaces in it’s name, they are replaced with strange characters (like it happened in the recent files list, in icewm’s menu). In time, I’ll try to find a way around that. Other than this problem, I think the script is perfect- it restores files, it works with several files, it (kinda) works with files with spaces, the entry only shows up when it’s expected…
ZZZfm is very powerful, it’s a shame it’s so hard to configure! But once configured, it’s very nearly the perfect File Manager.
Edit:
1- I just tested the solution to the user problem and it seems to work – if using ~ in the config file, zzzfm respects it and goes to the user’s home.
2- I took a look – the problem restoring files with spaces in their names is due to the way trash-cli stores the data about the original name and place of the file (that uses %xx to replace spaces or special characters). with time, I can adjust the “restore files” script to use the same solution I suggested for the “recent files” script – but I’m can’t do it right now…P.
- This reply was modified 4 days, 4 hours ago by PPC.
January 24, 2023 at 4:53 pm #98176MemberPPC
::@anticapitalista – I just realized that a new “command” can be used to “manually” mount listed partitions, on zzzfm, by right clicking a partition and adding a new command called something like “Mount external partition”, with this contents:
gksu "mount %v /mnt"
Obviously, a similar entry to “Unmount external partition” can be added:
gksu "umount %v" zzzfm /mnt
But this does go against the safe guard of now allowing to use a GUI to mount external partitions…
P.
- This reply was modified 4 days, 3 hours ago by PPC.
January 24, 2023 at 5:58 pm #98180MemberPPC
::@anticapitalista – brain hurts, please send aspirin…
Solution to the problem of restoring files with spaces or special characters, using a zzzfm contextual menu:
for file in %F; do file_name=$(basename "$file") extension=".trashinfo" data_about_selected_file=$HOME/.local/share/Trash/info/$file_name$extension original_path_of_file=$(cat "$data_about_selected_file" | grep "Path=" |cut -c6-) original_file_path=$(dirname "$original_path_of_file") mv --backup=numbered "$file" "$original_file_path/$file_name" rm "$data_about_selected_file" done
Please test, should work fine…
Edit: Also, I think I understood how “mv –backup” works wrong. I tested: if there is a file with the same name of the file being moved to the folder, the older file, existing on that folder will be backed up and renamed, appending ~1~ to it’s end.
Edit2: I replaced the code above with a simpler, and more human readable one. I hope that can help possible future “plugins” for zzzfm (like converting image files, etc).P.
- This reply was modified 4 days, 2 hours ago by PPC.
- This reply was modified 4 days, 2 hours ago by PPC.
- This reply was modified 4 days, 2 hours ago by PPC.
January 24, 2023 at 9:23 pm #98200MemberXunzi_23
::Two small suggestions.
A small gui application to set default papersize in /etc and preferably also create a
papersize file in home or prompt user to copy the newly created file in to his home
directory. Unfortunately not all applications look in /etc.Getting a4 or other than us size set up without help is a huge obstacle for a new user.
In live remaster set Personal as default, new user is losing changes and wondering
why for distribution is standard.
I ran in to same problem a few times too before becoming more careful.Change is easily made, done for personal and friends use already.
-
AuthorPosts
- You must be logged in to reply to this topic.