Sort and improve readability of init

Help for MX Fluxbox
When asking for help, use Quick System Info from MX Tools. It will be properly formatted using the following steps.
1. Click on Quick System Info in MX Tools
2. Right click in your post and paste.
Message
Author
User avatar
Melber
Developer
Posts: 1194
Joined: Tue Mar 23, 2021 4:19 pm

Re: Sort and improve readability of init

#41 Post 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

User avatar
Jerry3904
Administrator
Posts: 23041
Joined: Wed Jul 19, 2006 6:13 am

Re: Sort and improve readability of init

#42 Post by Jerry3904 »

Great, can test later today.
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

User avatar
Jerry3904
Administrator
Posts: 23041
Joined: Wed Jul 19, 2006 6:13 am

Re: Sort and improve readability of init

#43 Post 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.
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

User avatar
i_ri
Posts: 1070
Joined: Tue Jun 30, 2015 12:26 am

Re: Sort and improve readability of init

#44 Post 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:

User avatar
Melber
Developer
Posts: 1194
Joined: Tue Mar 23, 2021 4:19 pm

Re: Sort and improve readability of init

#45 Post 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

User avatar
Jerry3904
Administrator
Posts: 23041
Joined: Wed Jul 19, 2006 6:13 am

Re: Sort and improve readability of init

#46 Post by Jerry3904 »

Before my day starts, made a possible restructuring of the Settings submenu


Image
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

User avatar
siamhie
Global Moderator
Posts: 3214
Joined: Fri Aug 20, 2021 5:45 pm

Re: Sort and improve readability of init

#47 Post 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?
This is my Fluxbox . There are many others like it, but this one is mine. My Fluxbox is my best friend. It is my life.
I must master it as I must master my life. Without me, my Fluxbox is useless. Without my Fluxbox, I am useless.

User avatar
Jerry3904
Administrator
Posts: 23041
Joined: Wed Jul 19, 2006 6:13 am

Re: Sort and improve readability of init

#48 Post 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.
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

User avatar
siamhie
Global Moderator
Posts: 3214
Joined: Fri Aug 20, 2021 5:45 pm

Re: Sort and improve readability of init

#49 Post 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.
This is my Fluxbox . There are many others like it, but this one is mine. My Fluxbox is my best friend. It is my life.
I must master it as I must master my life. Without me, my Fluxbox is useless. Without my Fluxbox, I am useless.

User avatar
Jerry3904
Administrator
Posts: 23041
Joined: Wed Jul 19, 2006 6:13 am

Re: Sort and improve readability of init

#50 Post 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.
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

Post Reply

Return to “MX Fluxbox Official Release”