Page 5 of 7

Re: Sort and improve readability of init

Posted: Mon Mar 03, 2025 9:06 am
by Melber
Jerry3904 wrote: Sun Mar 02, 2025 5:46 pm Did some testing: works fine. Then looked more carefully at the MISC category, and moved items that I thought clearly belonged in a particular category (dashed line separates my additions). Also added a HELP at the top.
...
Not sure how those changes could be handled, maybe using a temporary alias?
This should produce an init matching your layout and sorting, including help line at top.

Code: Select all

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

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 = *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 = *toolbar* ]]; then
        toolbar_items+=($item)
    elif [[ $item = *systray* ]]; then
        toolbar_items+=($item)
    elif [[ $item = *time* ]]; then
        toolbar_items+=($item)
    elif [[ $item = *workspace* ]]; then
        workspace_items+=($item)
    elif [[ $item = *slit* ]]; then
        slit_items+=($item)
    elif [[ $item = *tab* ]]; then
        tab_items+=($item)
    elif [[ $item = *iconbar* ]]; 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: Mon Mar 03, 2025 10:18 am
by Jerry3904
Great, can test later today.

Re: Sort and improve readability of init

Posted: Mon Mar 03, 2025 6:26 pm
by Jerry3904
@Melber It works like a charm!

Now we have to figure out how to use it, exactly. And how it should be represented in the rootMenj.

More on this later...busy week for me.

Re: Sort and improve readability of init

Posted: Mon Mar 03, 2025 8:16 pm
by i_ri
Hello Jerry3904 and Melber
arrangewindows
arrangewindowshorizontal
arrangewindowsstackbottom
arrangewindowsstackleft
arrangewindowsstackright
arrangewindowsstacktop
arrangewindowsvertical
closeallwindows
nextwindow
prevwindow
windowmenu

Achilles says, the appearance of any of those commands containing the word window when used on the toolbar.tools,

A search for window prior to search for toolbar will place the toolbar.tools entry into the window category.

nextwindow and prevwindow are common on toolbar.tools.
NextWindow and PrevWindow can prevent this, but the lowercase by a user, accepted by fluxbox, cannot be prevented nor guaranteed uppercase.

Search for toolbar prior to search for window.

the toggledecor Uppercase
ToggleDecor
can put toolbar.tools on the window group,
so place Deco search after toolbar search.
Or alter the search to Deco: or defaultDeco or co:

Re: Sort and improve readability of init

Posted: Tue Mar 04, 2025 4:38 am
by Melber
@i_ri

Is this better for you?

Code: Select all

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

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 = *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 = *tab* ]]; then
        tab_items+=($item)
    elif [[ $item = *iconbar* ]]; 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: Tue Mar 04, 2025 6:10 am
by Jerry3904
Before my day starts, made a possible restructuring of the Settings submenu


Image

Re: Sort and improve readability of init

Posted: Tue Mar 04, 2025 9:35 am
by siamhie
Jerry3904 wrote: Tue Mar 04, 2025 6:10 am Before my day starts, made a possible restructuring of the Settings submenu (the "toolbar" entry is not there)
So Window has been renamed "Quick config"? and is under the Init submenu?

Re: Sort and improve readability of init

Posted: Tue Mar 04, 2025 10:31 am
by Jerry3904
Yup, along with the new "restore" entry. The combination of bringing it up a level, creating a name closer to the default Fluxbox one and locating it under "init" should IMO make it more visible and less obscure to the user.

True Confession: I did not fully appreciate the value of that entry in the past, so was grateful for the posts by you and @ceeslans about it.

Re: Sort and improve readability of init

Posted: Tue Mar 04, 2025 11:09 am
by siamhie
Jerry3904 wrote: Tue Mar 04, 2025 10:31 am Yup, along with the new "restore" entry. The combination of bringing it up a level, creating a name closer to the default Fluxbox one and locating it under "init" should IMO make it more visible and less obscure to the user.

True Confession: I did not fully appreciate the value of that entry in the past, so was grateful for the posts by you and @ceeslans about it.
OK. I'm only asking because I will have to undo 20 years of muscle memory of where everything is located to configure. I don't edit init by hand (all that much) and prefer to use the menus.
I actually added Workspaces back to my root menu (default setup) as that is what I remember seeing. I usually just middle click to bring up it's menu.

Re: Sort and improve readability of init

Posted: Tue Mar 04, 2025 11:16 am
by Jerry3904
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.