spacefm trash plugin confirmation dialog, custom sort change menu item.

Here is where you can post tips and tricks to share with other users of MX. Do not ask for help in this Forum.
Post Reply
Message
Author
ctt
Posts: 9
Joined: Sun Jan 20, 2019 10:27 am

spacefm trash plugin confirmation dialog, custom sort change menu item.

#1 Post by ctt »

add dialog before delete for jpfleury/corbeille-spacefm, trash plugin.
Select Plugins > Trash > Move to Trash, F3 or right click to edit menu Properties.
And uncheck Popup Output in Options tab.
root edit '/usr/share/spacefm/plugins/Corbeille-en-source/cstm_07e29d93/exec.sh'

Code: Select all

## my edit - confirm dialog
eval "`spacefm -g --label "Are you sure?" --button no --button yes`"
   if [[ "$dialog_pressed" == "button2" ]]; then
##
for file in "${fm_files[@]}"; do

...

	else
		moveToTrash
	fi
done
fi ## end if here
wait
exit $?

Add new command under toolbar view menu item. By default press Insert or right-click > new > command. I name it TrashSo_rt.
In menu item properties. Under Command tab, check Command Line. Using the following code

Code: Select all

normalSort() {
	if spacefm -s get sort_ascend|grep -q 0;then 
		spacefm -s set sort_ascend 1;
		spacefm -s set sort_by name;
	fi	
}
modFirst() {
	spacefm -s set --tab "$fm_tab" sort_ascend 0;
	spacefm -s set --tab "$fm_tab" sort_by modified;
}
if [ "%a" -eq 1 ];then modFirst;else normalSort;fi;wait;exit $?
Under Options, uncheck run as task in Run Option and select checkbox for Style.
When checkmark is on, the sort mode is decending in modified order. Basicly latest changed first. Otherwise, sort mode is ascending in name order.
((Failed to make it automatically change sorting base on directory. No luck with spacefm -s replace-event evt_tab_chdir ... and such))

Prevent xfce go to suspend when monitor/screen is off.

Code: Select all

xfce4-power-manager -q #quit
xfce4-power-manager --restart #restart

Post Reply

Return to “Tips & Tricks by users”