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
Jerry3904
Administrator
Posts: 23271
Joined: Wed Jul 19, 2006 6:13 am

Re: Sort and improve readability of init

#21 Post by Jerry3904 »

It is easy, and will not go away.
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
Melber
Developer
Posts: 1329
Joined: Tue Mar 23, 2021 4:19 pm

Re: Sort and improve readability of init

#22 Post by Melber »

@Jerry3904
not particularly elegant, but this script should sort an existing unordered init file and create a copy of the unordered init as ~/.restore/fluxbox/init.bak

+++edit+++
broken script removed, see post 28
Last edited by Melber on Wed Feb 26, 2025 5:37 am, edited 2 times in total.

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

Re: Sort and improve readability of init

#23 Post by Jerry3904 »

Wow, great beans.! I will give it a spin, thanks.
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
ceeslans
Posts: 832
Joined: Sun Apr 14, 2019 3:48 am

Re: Sort and improve readability of init

#24 Post by ceeslans »

With all due respect (I really do value the work Melber put in this), but what is to be gained from this? Do we restore the backed-up version every time mx-tweak sets another style? Or when a different toolbar position or transparency-level is selected from fluxbox' own configuration menu?
There's nothing wrong with the init line-up that fluxbox creates, is there? Fwiw, whenever manual changes to some hidden setting in ~/fluxbox/init should be made, it's dead easy to open/search/edit in a texteditor...
Sony Vaio VPCF23P (2011), Intel Core i7-2670, 6gb RAM, 240gb SSD, MX-Linux 23 based Fluxbox v/1.3.7+
Lenovo Thinkpad L560 (2016), Intel Core i5-6200, 16gb RAM, 240gb SSD, Devuan Daedalus based Fluxbox v/1.3.7+

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

Re: Sort and improve readability of init

#25 Post by Melber »

ceeslans wrote: Tue Feb 25, 2025 9:09 am ...Do we restore the backed-up version every time mx-tweak sets another style? Or when a different toolbar position or transparency-level is selected from fluxbox' own configuration menu?
...
No, agree that would be overkill.
I understood it more as a "Sort init file" option buried somewhere in a fb-submenu, available for those so inclined but equally able to be ignored.

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

Re: Sort and improve readability of init

#26 Post by Jerry3904 »

@ceeslans We're exploring a possibility, so it's good that you lay out all the negative arguments.

FWIW: it's something that would be optional in my view. Even if a structured init were ever to become default, it would revert to the Fluxbox default line-up that you like with the first change using the init-shuffling method. Most users would probably never even see it.

I could imagine the possibility of adding a menu entry like this at the bottom of the Window/Config submenu that causes the shuffling;

Code: Select all

[separator]
[exec] (Use structured init) {config_init_restore}
Name may not be ideal...
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: 1106
Joined: Tue Jun 30, 2015 12:26 am

Re: Sort and improve readability of init

#27 Post by i_ri »

Hello Jerry3904
"whether init will actually ignore empty lines" did You mean blank lines or empty values for a listed Resource?
Undefined Value, for a listed Resource, when the value type is boolean or numerical or text or workspacename or command table exists finite fallback. When the missing value is a path, stylepath, font, pixmapimage, icon, there is dual fallbacks for empty and for incorrect, unresolved entries; time period and outcome can vary when this type of value is missing[empty] in a listed Resource.

Yes sometimes the /init list is in a different order than the last time I saw it. Wish /init list was in an order matching the order of the listing in fluxbox man Resources.
fluxbox reads /init more often than I read /init.
I am content to let fluxbox be the boss of how /init is written.
Thanks Jerry3904, again, your attention to detail keeps mxfluxbox with the best of fluxbox.

Melber. sortinit.
The total count of your Resources is 89.
sleekmason list count is 109 at https://www.linux.com/training-tutorial ... init-file/
My mxfluxbox has Resources count 91 [, without buttons]; System has an alternate /init for comparison of fluxbox defaults, it has Resource count of 19 lines.
Jerry3904's list count is 89, while the toolbar list includes one "button" that has not on the list a corresponding button.name label or commands [91.]
The man has a Resources count of 73. hmmmmmm? Two of those are the button label and button commands which can be of unknown quantity.
tint2 introduces /init .tools toggle off systemtray.
Maybe start script with fluxbox reconfigure, restart or otherwise trigger whatever is found that can change /init? Benefit write this during startup?
tab near window(?) iconbar near toolbar(?)
some misc. could qualify go into tab or window(?)

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

Re: Sort and improve readability of init

#28 Post by Melber »

@i_ri
Thanks for having a closer look.
You're right, the default generated init has 91 entries. I had just oriented myself on Jerry's list, where these two are missing

Code: Select all

session.screen0.systray.pinLeft:	
session.screen0.systray.pinRight:

I added them to the script and also fixed some fat finger boo-boos which were resulting in missing or multiple entries.
Test at your own risk

Code: Select all

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

init_location=$HOME/.fluxbox/init
backup_location=$HOME/.restore/fluxbox

window_item_1=$(grep 'window.focus.alpha' $init_location)
window_item_2=$(grep 'window.unfocus.alpha' $init_location)
window_item_3=$(grep 'focusNewWindows' $init_location)
window_item_4=$(grep 'windowMenu' $init_location)
window_item_5=$(grep 'titlebar.left' $init_location)
window_item_6=$(grep 'titlebar.right' $init_location)
window_item_7=$(grep 'showwindowposition' $init_location)
window_item_8=$(grep 'windowPlacement' $init_location)

toolbar_item_1=$(grep 'toolbar.tools' $init_location)
toolbar_item_2=$(grep 'toolbar.layer' $init_location)
toolbar_item_3=$(grep 'toolbar.alpha' $init_location)
toolbar_item_4=$(grep 'toolbar.onhead' $init_location)
toolbar_item_5=$(grep 'toolbar.autoRaise' $init_location)
toolbar_item_6=$(grep 'toolbar.visible' $init_location)
toolbar_item_7=$(grep 'toolbar.height' $init_location)
toolbar_item_8=$(grep 'toolbar.placement' $init_location)
toolbar_item_9=$(grep 'toolbar.widthPercent' $init_location)
toolbar_item_10=$(grep 'toolbar.maxOver' $init_location)
toolbar_item_11=$(grep 'toolbar.autoHide' $init_location)
toolbar_item_12=$(grep 'strftimeFormat' $init_location | sed -e 's/%/\%/g')

slit_item_1=$(grep 'slit.acceptKdeDockapps' $init_location)
slit_item_2=$(grep 'slit.layer' $init_location)
slit_item_3=$(grep 'slit.placement' $init_location)
slit_item_4=$(grep 'slit.maxOver' $init_location)
slit_item_5=$(grep 'slit.onhead' $init_location)
slit_item_6=$(grep 'slit.autoRaise' $init_location)
slit_item_7=$(grep 'slit.autoHide' $init_location)
slit_item_8=$(grep 'slit.alpha' $init_location)
slit_item_9=$(grep 'slitlistFile' $init_location)

tab_item_1=$(grep 'tab.placement' $init_location)
tab_item_2=$(grep 'tab.width' $init_location)
tab_item_3=$(grep 'struts:' $init_location)
tab_item_3a=$(grep 'struts.1' $init_location)
tab_item_4=$(grep 'tabs.usePixmap' $init_location)
tab_item_5=$(grep 'tabs.maxOver' $init_location)
tab_item_6=$(grep 'tabs.intitlebar' $init_location)

iconbar_item_1=$(grep 'iconbar.alignment' $init_location)
iconbar_item_2=$(grep 'iconbar.mode' $init_location)
iconbar_item_3=$(grep 'iconbar.usePixmap' $init_location)
iconbar_item_4=$(grep 'iconbar.iconWidth' $init_location)
iconbar_item_5=$(grep 'iconbar.iconifiedPattern' $init_location)
iconbar_item_6=$(grep 'iconbar.iconTextPadding' $init_location)

workspace_item_1=$(grep 'workspaces' $init_location)
workspace_item_2=$(grep 'workspaceNames' $init_location)
workspace_item_3=$(grep 'workspacewarping:' $init_location)
workspace_item_4=$(grep 'workspacewarpinghorizontal:' $init_location)
workspace_item_5=$(grep 'workspacewarpinghorizontaloffset' $init_location)
workspace_item_6=$(grep 'workspacewarpingvertical:' $init_location)
workspace_item_7=$(grep 'workspacewarpingverticaloffset' $init_location)

menu_item_1=$(grep 'clientMenu.usePixmap' $init_location)
menu_item_2=$(grep 'menu.alpha' $init_location)
menu_item_3=$(grep 'menuDelay' $init_location)
menu_item_4=$(grep 'menuFile' $init_location)
menu_item_5=$(grep 'menuSearch' $init_location)

config_item_1=$(grep 'keyFile' $init_location)
config_item_2=$(grep 'appsFile' $init_location)
config_item_3=$(grep 'styleFile' $init_location)
config_item_4=$(grep 'styleOverlay' $init_location)

misc_item_1=$(grep 'colPlacementDirection' $init_location)
misc_item_2=$(grep 'opaqueMove' $init_location)
misc_item_3=$(grep 'allowRemoteActions' $init_location)
misc_item_4=$(grep 'fullMaximization' $init_location)
misc_item_5=$(grep 'noFocusWhileTypingDelay' $init_location)
misc_item_6=$(grep 'opaqueResize:' $init_location)
misc_item_7=$(grep 'edgeResizeSnapThreshold' $init_location)
misc_item_8=$(grep 'maxDisableMove' $init_location)
misc_item_9=$(grep 'opaqueResizeDelay' $init_location)
misc_item_10=$(grep 'focusSameHead' $init_location)
misc_item_11=$(grep 'tabFocusModel' $init_location)
misc_item_12=$(grep 'rootCommand' $init_location)
misc_item_13=$(grep 'defaultDeco' $init_location)
misc_item_14=$(grep 'tooltipDelay' $init_location)
misc_item_15=$(grep 'edgeSnapThreshold' $init_location)
misc_item_16=$(grep 'maxIgnoreIncrement' $init_location)
misc_item_17=$(grep 'maxDisableResize' $init_location)
misc_item_18=$(grep 'session.screen0.autoRaise' $init_location)
misc_item_19=$(grep 'focusModel' $init_location)
misc_item_20=$(grep 'rowPlacementDirection' $init_location)
misc_item_21=$(grep 'clickRaises' $init_location)
misc_item_22=$(grep 'forcePseudoTransparency' $init_location)
misc_item_23=$(grep 'doubleClickInterval' $init_location)
misc_item_24=$(grep 'ignoreBorder' $init_location)
misc_item_25=$(grep 'tabsAttachArea' $init_location)
misc_item_26=$(grep 'autoRaiseDelay' $init_location)
misc_item_27=$(grep 'cacheLife' $init_location)
misc_item_28=$(grep 'tabPadding' $init_location)
misc_item_29=$(grep 'colorsPerChannel' $init_location)
misc_item_30=$(grep 'cacheMax' $init_location)
misc_item_31=$(grep 'configVersion' $init_location)
misc_item_32=$(grep 'systray.pinLeft' $init_location)
misc_item_33=$(grep 'systray.pinRight' $init_location)

#####

if [ ! -d $backup_location ]; then
    mkdir -p $backup_location
fi

cp $init_location $backup_location/init.bak


#####

echo "
##### MX-Fluxbox sorted init #####

#####WINDOW#####
$window_item_1
$window_item_2
$window_item_3
$window_item_4
$window_item_5
$window_item_6
$window_item_7
$window_item_8

#####TOOLBAR#####
$toolbar_item_1
$toolbar_item_2
$toolbar_item_3
$toolbar_item_4
$toolbar_item_5
$toolbar_item_6
$toolbar_item_7
$toolbar_item_8
$toolbar_item_9
$toolbar_item_10
$toolbar_item_11
$toolbar_item_12

#####SLIT#####
$slit_item_1
$slit_item_2
$slit_item_3
$slit_item_4
$slit_item_5
$slit_item_6
$slit_item_7
$slit_item_8
$slit_item_9

#####TABS#####
$tab_item_1
$tab_item_2
$tab_item_3
$tab_item_3a
$tab_item_4
$tab_item_5
$tab_item_6

#####ICONBAR#####
$iconbar_item_1
$iconbar_item_2
$iconbar_item_3
$iconbar_item_4
$iconbar_item_5
$iconbar_item_6

#####WORKSPACE#####
$workspace_item_1
$workspace_item_2
$workspace_item_3
$workspace_item_4
$workspace_item_5
$workspace_item_6
$workspace_item_7

#####MENUS#####
$menu_item_1
$menu_item_2
$menu_item_3
$menu_item_4
$menu_item_5

#####CONFIG FILES#####
$config_item_1
$config_item_2
$config_item_3
$config_item_4

#####MISC#####
$misc_item_1
$misc_item_2
$misc_item_3
$misc_item_4
$misc_item_5
$misc_item_6
$misc_item_7
$misc_item_8
$misc_item_9
$misc_item_10
$misc_item_11
$misc_item_12
$misc_item_13
$misc_item_14
$misc_item_15
$misc_item_16
$misc_item_17
$misc_item_18
$misc_item_19
$misc_item_20
$misc_item_21
$misc_item_22
$misc_item_23
$misc_item_24
$misc_item_25
$misc_item_26
$misc_item_27
$misc_item_28
$misc_item_29
$misc_item_30
$misc_item_31
$misc_item_32
$misc_item_33
" > $init_location

exit 0

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

Re: Sort and improve readability of init

#29 Post by siamhie »

Any changes made from the root menu > settings > configure menu will have the init file rewritten by fluxbox.

Image


I saved Jerry's layout as init2 and restarted fluxbox as so

Code: Select all

fluxbox -rc init2
When I made just one change within that area, Jerry's layout changed back to fluxbox's layout.
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
Melber
Developer
Posts: 1329
Joined: Tue Mar 23, 2021 4:19 pm

Re: Sort and improve readability of init

#30 Post by Melber »

yep
Melber wrote: Sun Feb 23, 2025 3:04 pm seems like rootMenu --> Settings --> Configure --> anything results in an init rewrite

Post Reply

Return to “MX Fluxbox Official Release”