mxfb-sortinit sounds fine to me. Will upload later.Jerry3904 wrote: Thu Mar 06, 2025 11:18 am Are you ready to upload it to mxfb-accessories? And if yes, how do you want to name it (I have a provisional mxfb-sortinit)?
Sort and improve readability of init
Re: Sort and improve readability of init
Re: Sort and improve readability of init
Do we need a little yad of explanation at the beginning? For instance:
This will save your current init file to ~/.restore/fluxbox, sort it into categories and paste it back into ~/.fluxbox.
Ok to proceed?
Production: 5.10, MX-23 Xfce, AMD FX-4130 Quad-Core, GeForce GT 630/PCIe/SSE2, 16 GB, SSD 120 GB, Data 1TB
Personal: Lenovo X1 Carbon with MX-23 Fluxbox
Other: Raspberry Pi 5 with MX-23 Xfce Raspberry Pi Respin
Personal: Lenovo X1 Carbon with MX-23 Fluxbox
Other: Raspberry Pi 5 with MX-23 Xfce Raspberry Pi Respin
Re: Sort and improve readability of init
Code: Select all
rofi -e " fluxbox /init Saved and prepared for viewing"
maybe the command ends with xdg-open /init and the message is
/init backup copy Saved.
it really does not prepare init for viewing later, init might change. it is optimized for viewing Now, so does it get opened Now?
open init from inside the script?
open init additional; mxfb-sortinit && xdg-open /init
?
So your yad might state that a backup Will be created,
and the question is did you wish to open the file.
save without sorting.
sort without saving.
sort and save.
Open file yes or no.
Want choices?
(save meaning backup to .restore)
Re: Sort and improve readability of init
Seems a bit OTT to me.Jerry3904 wrote: Thu Mar 06, 2025 12:02 pm Do we need a little yad of explanation at the beginning? For instance:This will save your current init file to ~/.restore/fluxbox, sort it into categories and paste it back into ~/.fluxbox.
Ok to proceed?
I edited the script to add the following after the ### Help ### line at the top of the sorted init file instead
Code: Select all
### A backup copy of the current init file has been saved in $backup_location/init.bak ###
You're right, the script is really only useful if the init file is opened directly after running it.i_ri wrote: Thu Mar 06, 2025 12:35 pm ...it really does not prepare init for viewing later, init might change. it is optimized for viewing Now, so does it get opened Now?
open init from inside the script?
I added the exo-open command at the end of the script, so the init file is opened directly after sorting.
-----
Rather than creating a new submenu item for sortinit, it makes more sense to me to change the current menu>settings>configure>init from
Code: Select all
[exec] (Init) {exo-open ~/.fluxbox/init}
Code: Select all
[exec] (Init) {mxfb-sortinit}
Last version with above changes before I upload to github
Code: Select all
#!/bin/bash
#mxfb-sortinit - script to sort fluxbox init file by Melber and i_ri
#version 2503-4
init_location=$HOME/.fluxbox/init
backup_location=$HOME/.restore/fluxbox
target_location=$HOME/.fluxbox/init
OLDIFS=$IFS
IFS="|"
while read -r item; do
if [[ $item = *toolbar* ]]; then
toolbar_items+=($item)
elif [[ $item = *systray* ]]; then
toolbar_items+=($item)
elif [[ $item = *time* ]]; then
toolbar_items+=($item)
elif [[ $item = *tab* ]]; then
tab_items+=($item)
elif [[ $item = *window* ]]; then
window_items+=($item)
elif [[ $item = *NewWindows* ]]; then
window_items+=($item)
elif [[ $item = *Maximization* ]]; then
window_items+=($item)
elif [[ $item = *Deco* ]]; then
window_items+=($item)
elif [[ $item = *titlebar* ]]; then
window_items+=($item)
elif [[ $item = *slit* ]]; then
slit_items+=($item)
elif [[ $item = *iconbar* ]]; then
iconbar_items+=($item)
elif [[ $item = *tooltipDelay* ]]; then
iconbar_items+=($item)
elif [[ $item = *workspace* ]]; then
workspace_items+=($item)
elif [[ $item = *menu* ]]; then
menu_items+=($item)
elif [[ $item = *Menu* ]]; then
menu_items+=($item)
elif [[ $item = *File* ]]; then
config_items+=($item)
elif [[ $item = *Overlay* ]]; then
config_items+=($item)
elif [[ $item = *Raise* ]]; then
window_items+=($item)
elif [[ $item = *##* ]]; then
trash_items+=($item)
else
misc_items+=($item)
fi
done < $init_location
#####
if [ ! -d $backup_location ]; then
mkdir -p $backup_location
fi
cp $init_location $backup_location/init.bak
#####
printf '### HELP: https://fluxboxwiki.github.io/category/howtos/en/Editing_the_init_file.html ###\n' > $target_location
printf "### A backup copy of the current init file has been saved in $backup_location/init.bak ###\n" >> $target_location
printf "\n### WINDOW ###\n" >> $target_location
printf '%s\n' "${window_items[@]}" >> $target_location
printf "\n### WORKSPACE ###\n" >> $target_location
printf '%s\n' "${workspace_items[@]}" >> $target_location
printf "\n### TOOLBAR ###\n" >> $target_location
printf '%s\n' "${toolbar_items[@]}" >> $target_location
printf "\n### SLIT ###\n" >> $target_location
printf '%s\n' "${slit_items[@]}" >> $target_location
printf "\n### TABS ###\n" >> $target_location
printf '%s\n' "${tab_items[@]}" >> $target_location
printf "\n### ICONBAR ###\n" >> $target_location
printf '%s\n' "${iconbar_items[@]}" >> $target_location
printf "\n### MENU ###\n" >> $target_location
printf '%s\n' "${menu_items[@]}" >> $target_location
printf "\n### CONFIG FILES ###\n" >> $target_location
printf '%s\n' "${config_items[@]}" >> $target_location
printf "\n### MISCELLANEOUS ###\n" >> $target_location
printf '%s\n' "${misc_items[@]}" >> $target_location
IFS=$OLDIFS
exo-open $target_location
exit 0
Re: Sort and improve readability of init
Hello
Melber wrote it. I did testing. I did not write any bit of it.
The Open file being the messenger is a good thought Melber.
Sorted file looks different when alphabetized (<sort>) before sortinit.
(different is bad choice of word. It looks more the same every time when alphabetized before sortinit.)
Melber wrote it. I did testing. I did not write any bit of it.
The Open file being the messenger is a good thought Melber.
Sorted file looks different when alphabetized (<sort>) before sortinit.
(different is bad choice of word. It looks more the same every time when alphabetized before sortinit.)
Re: Sort and improve readability of init
@Melber Looks good. I like launching the file at the end b/c now the help and info are immediately visible.
Up it goes!
Up it goes!
Production: 5.10, MX-23 Xfce, AMD FX-4130 Quad-Core, GeForce GT 630/PCIe/SSE2, 16 GB, SSD 120 GB, Data 1TB
Personal: Lenovo X1 Carbon with MX-23 Fluxbox
Other: Raspberry Pi 5 with MX-23 Xfce Raspberry Pi Respin
Personal: Lenovo X1 Carbon with MX-23 Fluxbox
Other: Raspberry Pi 5 with MX-23 Xfce Raspberry Pi Respin
Re: Sort and improve readability of init
Hello Jerry3904 and Melber
You together have finished many great features.
Over time, Melber007 fits in there somewhere.
This one is Melbersortinit007
congratulations.
You together have finished many great features.
Over time, Melber007 fits in there somewhere.
This one is Melbersortinit007
congratulations.
Re: Sort and improve readability of init
PR made to MX-Linux/mxfb-accessories
Re: Sort and improve readability of init
toggletint2 interacts with /.restore
BACKDIR="$HOME/.restore/fluxbox"
INITBAK="$BACKDIR/init.$(date +%Y%m%d_%H%M%S).bak"
STRTBAK="$BACKDIR/startup.$(date +%Y%m%d_%H%M%S).bak"
Does sortinit want to have the same naming sequence? based on date +%Y%m%d_%H%M%S
/init.$(date +%Y%m%d_%H%M%S).bak
(?)
I do like the /init.bak simplicity there now; fitting into existing is a ponder.
BACKDIR="$HOME/.restore/fluxbox"
INITBAK="$BACKDIR/init.$(date +%Y%m%d_%H%M%S).bak"
STRTBAK="$BACKDIR/startup.$(date +%Y%m%d_%H%M%S).bak"
Does sortinit want to have the same naming sequence? based on date +%Y%m%d_%H%M%S
/init.$(date +%Y%m%d_%H%M%S).bak
(?)
I do like the /init.bak simplicity there now; fitting into existing is a ponder.
Re: Sort and improve readability of init
This development is ended for now, thanks
@Melber I'm on the road, will merge next week. Thanks for the good work.
@Melber I'm on the road, will merge next week. Thanks for the good work.
Production: 5.10, MX-23 Xfce, AMD FX-4130 Quad-Core, GeForce GT 630/PCIe/SSE2, 16 GB, SSD 120 GB, Data 1TB
Personal: Lenovo X1 Carbon with MX-23 Fluxbox
Other: Raspberry Pi 5 with MX-23 Xfce Raspberry Pi Respin
Personal: Lenovo X1 Carbon with MX-23 Fluxbox
Other: Raspberry Pi 5 with MX-23 Xfce Raspberry Pi Respin