Page 6 of 7

Re: Sort and improve readability of init

Posted: Tue Mar 04, 2025 4:38 pm
by siamhie
Jerry3904 wrote: Tue Mar 04, 2025 11:16 am You can keep your menu as it is, right? Any change here will only affect new users. When we go to Trixie, you would just save your existing menu, then after installation paste it back in.
I backup my HOME directory to another drive every 6 months or so. I add/remove a lot of styles/backgrounds/fonts/icons/etc. and like to keep the most recent version available at all times for new installs.

Re: Sort and improve readability of init

Posted: Tue Mar 04, 2025 8:24 pm
by i_ri
search iconbar before search workspace

Make it known to avoid using the case sensitive search keyword sequences in comments, toolbar.button names and labels, workspace names.

Melber Your script is fantastic. You have remained on track to provide Jerry3904's model.
I selfishly have shared my own model ideas both here and in another topic.
If You have Your own model we will like to see it.

Re: Sort and improve readability of init

Posted: Wed Mar 05, 2025 1:28 am
by i_ri
Hello Jerry3904
Got one into a category:

elif [[ $item = *tooltipDelay:* ]]; then
iconbar_items+=($item)

Re: Sort and improve readability of init

Posted: Wed Mar 05, 2025 6:06 am
by Jerry3904
Thanks.

Re: Sort and improve readability of init

Posted: Wed Mar 05, 2025 10:34 pm
by i_ri
Hello Jerry3904 and Melber
session.screen0.tabs.intitlebar:
Reason to search tab before search titlebar?

Re: Sort and improve readability of init

Posted: Thu Mar 06, 2025 10:30 am
by i_ri
Hello Jerry3904 and Everyone
Another category has evidenced itself.
The "do not edit" Category.

Observing two lines that report a value not for editing.
session.configVersion:
session.screen0.slit.direction:

Re: Sort and improve readability of init

Posted: Thu Mar 06, 2025 10:45 am
by Jerry3904
I appreciate your ongoing attention here, but I'm done with structure and am now trying to finish out implementation.

BTW: I'm sorry but I don't understand the point of your question about sort order--maybe @Melber does. And I'm not interested in a category with only 2 entries.

Re: Sort and improve readability of init

Posted: Thu Mar 06, 2025 11:12 am
by Melber
i_ri wrote: Wed Mar 05, 2025 10:34 pm Hello Jerry3904 and Melber
session.screen0.tabs.intitlebar:
Reason to search tab before search titlebar?
Jerry3904 wrote: Thu Mar 06, 2025 10:45 am BTW: I'm sorry but I don't understand the point of your question about sort order--maybe @Melber does.
i_ri means that session.screen0.tabs.intitlebar gets sorted into the titlebar category rather than the tabs category.

This version searches for "tab" before "titlebar", so that line gets sorted into "tabs".
It also sorts session.screen0.tooltipDelay into the iconbar category as per i_ri's Post #53.

Code: Select all

#!/bin/bash
#script to sort fluxbox init file
#version 2503-3

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 = *workspace* ]]; then
        workspace_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 = *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 "\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

exit 0

Re: Sort and improve readability of init

Posted: Thu Mar 06, 2025 11:18 am
by Jerry3904
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)?

Re: Sort and improve readability of init

Posted: Thu Mar 06, 2025 11:22 am
by i_ri
showing Reason to search iconbar before search workspace.
session.screen0.iconbar.mode: {static groups} (workspace)