I was wondering if a custom version of the file wouldn't get over written as opposed to the stock version but it seems like it does.
Sort and improve readability of init
Re: Sort and improve readability of init
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.
I must master it as I must master my life. Without me, my Fluxbox is useless. Without my Fluxbox, I am useless.
Re: Sort and improve readability of init
That's precisely why I suggested a restore script and Melber created 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
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
Your fluxbox menu item calling a script that structures /init into a custom format before viewing, is born. You did it.
Any thing short of that is chat. here is chat.
A sort command that mimics the mechanics where custom format takes the place of sort gives a sorted view that has been saved: short sort:
sort -o ~/.fluxbox/init ~/.fluxbox/init &&xdg-open ~/.fluxbox/init
shorter sort: from a file manager /.fluxbox/init Open With featherpad.
From featherpad menu bar
Edit >Select All
Edit >Sort Lines
gives a sorted view, same as above command, that has not yet been saved.
Half measures but pleasing. just chat. {config_init_restore} is beyond this chat. congratulations.
Your fluxbox menu item calling a script that structures /init into a custom format before viewing, is born. You did it.
Any thing short of that is chat. here is chat.
A sort command that mimics the mechanics where custom format takes the place of sort gives a sorted view that has been saved: short sort:
sort -o ~/.fluxbox/init ~/.fluxbox/init &&xdg-open ~/.fluxbox/init
shorter sort: from a file manager /.fluxbox/init Open With featherpad.
From featherpad menu bar
Edit >Select All
Edit >Sort Lines
gives a sorted view, same as above command, that has not yet been saved.
Half measures but pleasing. just chat. {config_init_restore} is beyond this chat. congratulations.
Re: Sort and improve readability of init
Melber. append lines from grep toolbar.button
?
toolbar.tools will grep more than one line when tint2 toggles off systemtray. ? can it grep toggle plus tools to differentiate lines? somehow you will solve duplicate lines.
?
toolbar.tools will grep more than one line when tint2 toggles off systemtray. ? can it grep toggle plus tools to differentiate lines? somehow you will solve duplicate lines.
Re: Sort and improve readability of init
Hello Melber
did an addition for toolbar buttons
to your post number 28 script.
toolbar_item_0=$(grep 'toolbar.button' $init_location)
and down in echo
$toolbar_item_0
it printed the four lines for two buttons.
"...#####TOOLBAR#####
session.screen0.toolbar.button.root.label: pop
session.screen0.toolbar.button.root.commands: :ToggleCmd {CustomMenu /home/demo/.fluxbox/submenus/menupop}{HideMenus}
session.screen0.toolbar.button.pad.label: FF
session.screen0.toolbar.button.pad.commands: Exec featherpad
session.screen0.toolbar.tools: button.root, button.pad, systemtray, workspacename, iconbar, clock... "
"...session.screen0.toolbar.button.pad.commands: Exec featherpad
#toggled-off#session.screen0.toolbar.tools: button.root, button.pad, systemtray, workspacename, iconbar, clock
session.screen0.toolbar.tools: button.root, button.pad, workspacename, iconbar, clock
session.screen0.toolbar.visible: false..."
toolbar.tools grep does the same, it prints both lines; regarding tint2. not a problem.
did an addition for toolbar buttons
to your post number 28 script.
toolbar_item_0=$(grep 'toolbar.button' $init_location)
and down in echo
$toolbar_item_0
it printed the four lines for two buttons.
"...#####TOOLBAR#####
session.screen0.toolbar.button.root.label: pop
session.screen0.toolbar.button.root.commands: :ToggleCmd {CustomMenu /home/demo/.fluxbox/submenus/menupop}{HideMenus}
session.screen0.toolbar.button.pad.label: FF
session.screen0.toolbar.button.pad.commands: Exec featherpad
session.screen0.toolbar.tools: button.root, button.pad, systemtray, workspacename, iconbar, clock... "
"...session.screen0.toolbar.button.pad.commands: Exec featherpad
#toggled-off#session.screen0.toolbar.tools: button.root, button.pad, systemtray, workspacename, iconbar, clock
session.screen0.toolbar.tools: button.root, button.pad, workspacename, iconbar, clock
session.screen0.toolbar.visible: false..."
toolbar.tools grep does the same, it prints both lines; regarding tint2. not a problem.
Last edited by i_ri on Wed Feb 26, 2025 6:55 am, edited 1 time in total.
Re: Sort and improve readability of init
To wrap this up, here is what I see as the output of this thread:
1) A sorted init of any kind will remain stable as long as all changes are carried out manually using the current MXFB menu items except the [config] entry:
2) Anyone wishing to have the sorted init that I started in OP but still use the handy [config] entry can simply add a line to the submenu in 1) to launch Melber's restore script such as the one I posted above .
3) A different sorting pattern would call for a rewrite of the restore script. I mention that b/c I have not had time to return to my initial effort but want to go through the "MISC" category one of these days and add at least a link to an explanation of the individual lines.
1) A sorted init of any kind will remain stable as long as all changes are carried out manually using the current MXFB menu items except the [config] entry:
Code: Select all
[submenu] (Configure)
[exec] (Apps) {exo-open ~/.fluxbox/apps}
[exec] (Init) {exo-open ~/.fluxbox/init}
[exec] (Keys) {exo-open ~/.fluxbox/keys}
[submenu] (Menus)
[exec] (Main) {exo-open ~/.fluxbox/menu-mx}
[exec] (Appearance) {exo-open ~/.fluxbox/submenus/appearance}
[exec] (Settings) {exo-open ~/.fluxbox/submenus/settings}
[exec] (Out of sight) {exo-open ~/.fluxbox/submenus/out-of-sight}
[end]
[exec] (Overlay) {exo-open ~/.fluxbox/overlay}
[exec] (Startup) {featherpad ~/.fluxbox/startup}
[exec] (Styles) {thunar ~/.fluxbox/styles/}
[config] (Window)
[workspaces] (Workspaces)
[end]
3) A different sorting pattern would call for a rewrite of the restore script. I mention that b/c I have not had time to return to my initial effort but want to go through the "MISC" category one of these days and add at least a link to an explanation of the individual lines.
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
Wrote a hopefully more robust script.
It reads each line of the current init file and sorts into categories according to keywords.
Items with no match end up in the Miscellaneous category.
If you don't want to ovewrite the init file, change
to another filename or path.
It reads each line of the current init file and sorts into categories according to keywords.
Items with no match end up in the Miscellaneous category.
If you don't want to ovewrite the init file, change
Code: Select all
target_location=$HOME/.fluxbox/init
Code: Select all
#!/bin/bash
#script to sort fluxbox init file
#version 2502-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 = *window* ]]; then
window_items+=($item)
elif [[ $item = *titlebar* ]]; then
window_items+=($item)
elif [[ $item = *toolbar* ]]; 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 = *File* ]]; then
config_items+=($item)
elif [[ $item = *Overlay* ]]; then
config_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 "\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
Nice upgrade, thanks; will test this weekend.
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
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?
Code: Select all
#### HELP: https://fluxboxwiki.github.io/category/howtos/en/Editing_the_init_file.html ####
### WINDOW ###
session.screen0.tabs.intitlebar: true
session.screen0.window.focus.alpha: 255
session.screen0.window.unfocus.alpha: 255
session.screen0.titlebar.left: Stick
session.screen0.titlebar.right: Minimize Maximize Close
session.screen0.windowMenu: ~/.fluxbox/submenus/windowmenu
session.screen0.showwindowposition: false
session.screen0.windowPlacement: RowMinOverlapPlacement
-----
session.screen0.focusNewWindows: true
session.screen0.fullMaximization: false
session.screen0.defaultDeco: NORMAL
session.screen0.clickRaises: true
session.screen0.autoRaise: true
session.autoRaiseDelay: 250
### WORKSPACE ###
session.screen0.workspacewarpingverticaloffset: 1
session.screen0.workspacewarpingvertical: false
session.screen0.workspaceNames: W-1,W-2,W-3,
session.screen0.workspacewarping: true
session.screen0.workspacewarpinghorizontal: true
session.screen0.workspacewarpinghorizontaloffset: 1
session.screen0.workspaces: 2
### TOOLBAR ###
session.screen0.toolbar.visible: false
session.screen0.toolbar.height: 30
session.screen0.toolbar.onhead: 1
session.screen0.toolbar.alpha: 252
session.screen0.toolbar.autoHide: false
session.screen0.toolbar.tools: workspacename, iconbar, clock
session.screen0.toolbar.widthPercent: 66
session.screen0.toolbar.layer: Normal
session.screen0.toolbar.maxOver: false
session.screen0.toolbar.placement: TopCenter
session.screen0.toolbar.autoRaise: false
session.screen0.strftimeFormat: %I:%M %b %d
-----
session.screen0.systray.pinLeft:
session.screen0.systray.pinRight:
### SLIT ###
session.screen0.slit.layer: Desktop
session.screen0.slit.onhead: 0
session.screen0.slit.autoRaise: true
session.screen0.slit.maxOver: true
session.screen0.slit.acceptKdeDockapps: true
session.screen0.slit.alpha: 255
session.screen0.slit.placement: BottomCenter
session.screen0.slit.autoHide: false
session.slitlistFile: ~/.fluxbox/slitlist
### TABS ###
session.screen0.tab.placement: TopLeft
session.screen0.tab.width: 64
session.screen0.tabs.usePixmap: true
session.screen0.tabs.maxOver: false
session.screen0.tabFocusModel: ClickToTabFocus
session.tabsAttachArea: Window
session.tabPadding: 0
### ICONBAR ###
session.screen0.iconbar.iconWidth: 128
session.screen0.iconbar.mode: {static groups}
session.screen0.iconbar.iconifiedPattern: Left
session.screen0.iconbar.iconTextPadding: 10
session.screen0.iconbar.usePixmap: true
session.screen0.iconbar.alignment: Relative
### MENU ###
session.screen0.menu.alpha: 255
session.screen0.menuDelay: 200
session.menuFile: ~/.fluxbox/menu-mx
session.menuSearch: itemstart
-----
session.screen0.clientMenu.usePixmap: true
### CONFIG FILES ###
session.styleFile: /home/jb/.fluxbox/styles/MX-ease-Dark
session.keyFile: ~/.fluxbox/keys
session.appsFile: ~/.fluxbox/apps
session.styleOverlay: ~/.fluxbox/overlay
### MISCELLANEOUS ###
session.screen0.struts.1: 0,0,0,0
session.screen0.opaqueMove: true
session.screen0.maxDisableResize: false
session.screen0.noFocusWhileTypingDelay: 0
session.screen0.opaqueResize: false
session.screen0.allowRemoteActions: true
session.screen0.edgeResizeSnapThreshold: 0
session.screen0.focusSameHead: false
session.screen0.tooltipDelay: 500
session.screen0.opaqueResizeDelay: 50
session.screen0.maxDisableMove: false
session.screen0.edgeSnapThreshold: 10
session.screen0.colPlacementDirection: TopToBottom
session.screen0.rootCommand: ~/.fehbg -l
session.screen0.struts: 0,0,0,0
session.screen0.rowPlacementDirection: LeftToRight
session.screen0.focusModel: ClickFocus
session.screen0.maxIgnoreIncrement: true
session.cacheLife: 5
session.doubleClickInterval: 250
session.configVersion: 13
session.forcePseudoTransparency: true
session.colorsPerChannel: 4
session.ignoreBorder: false
session.cacheMax: 200
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
Something similar to this addition (?)
Something similar to this addition (?)
Code: Select all
elif [[ $item = *systray.pin* ]]; then
toolbar_items+=($item)