How to Customize Sidebar Sections (Home, Pinned, Disks) in Superfile
You can customize the sidebar sections in Superfile by editing the sidebar_sections array in your config.toml file to include, exclude, or reorder the "home", "pinned", and "disks" entries.
Superfile is a terminal-based file manager that renders its left-hand sidebar from a configurable list of sections. To customize sidebar sections in Superfile, you edit the sidebar_sections array in your configuration file to control which of the three built-in sections appear and in what order.
Locating Your Configuration File
Superfile loads its settings from a TOML configuration file at startup. The default location is:
- Linux/macOS:
~/.config/superfile/config.toml - Windows:
%APPDATA%\superfile\config.toml
If this file does not exist, create it manually or allow Superfile to generate a default configuration on first run.
Valid Sidebar Section Identifiers
The sidebar recognizes three specific section identifiers defined as constants in src/pkg/utils/consts.go:
home– Your user's home directorypinned– Directories you have marked as favorites within Superfiledisks– Available system disks and mounted volumes
These strings map to internal logic in src/internal/ui/sidebar/directory_utils.go, where the appendSection function collects the appropriate directories for each enabled section.
Customizing Section Visibility and Order
The sidebar_sections field in your config.toml accepts a TOML array of strings. You can remove entries to hide sections, rearrange them to change the display order, or use a subset of the available options.
Show All Sections (Default)
# ~/.config/superfile/config.toml
sidebar_sections = ["home", "pinned", "disks"]
Hide the Disks Section
# Show only home and pinned directories
sidebar_sections = ["home", "pinned"]
Reorder Sections
# Show pinned first, then home, excluding disks
sidebar_sections = ["pinned", "home"]
After saving changes to config.toml, restart Superfile to apply the new sidebar configuration. The LoadConfigFile function in src/internal/common/load_config.go reads these values only at initialization.
Technical Implementation Details
When Superfile initializes, the configuration loader populates the SidebarSections field of the ConfigType struct defined in src/internal/common/config_type.go. According to the Superfile source code, this slice is then accessed by the sidebar model in src/internal/ui/sidebar/sidebar.go via common.Config.SidebarSections.
The sidebar renderer iterates over this slice and calls appendSection for each entry to build the directory tree. Because the implementation treats sidebar_sections as a standard slice, any valid combination or permutation of the three constants will render correctly.
Programmatic Customization
For developers extending Superfile or users building plugins, you can modify the sidebar sections at runtime via the internal API:
import "github.com/yorukot/superfile/src/internal/common"
func customizeSidebar() {
// Example: Show only pinned and home sections
common.Config.SidebarSections = []string{"pinned", "home"}
// Note: Changes take effect immediately in the UI, but to persist
// across restarts you must write back to the config file
}
This approach modifies the in-memory configuration maintained by the common package. While the runtime change reflects immediately in the sidebar model, persistent customization requires updating the TOML file on disk.
Summary
- Edit the
sidebar_sectionsarray in~/.config/superfile/config.tomlto control sidebar layout - Valid entries are
"home","pinned", and"disks"as defined insrc/pkg/utils/consts.go - Remove entries to hide sections entirely, or reorder them to change display priority
- Configuration is processed at startup by
LoadConfigFileinsrc/internal/common/load_config.go - Runtime modification is possible via
common.Config.SidebarSectionsfor advanced use cases
Frequently Asked Questions
Where does Superfile store the sidebar section configuration?
Superfile stores the sidebar_sections setting in the main configuration TOML file, typically located at ~/.config/superfile/config.toml on Unix systems or %APPDATA%\superfile\config.toml on Windows. This path is processed by the config loader at application startup.
Can I create custom sidebar sections beyond home, pinned, and disks?
No. The current implementation in src/pkg/utils/consts.go hardcodes the three valid section identifiers (home, pinned, disks), and the renderer in src/internal/ui/sidebar/directory_utils.go only implements directory collection logic for these specific types. Adding custom sections would require modifying the source code.
Why aren't my sidebar changes appearing after editing config.toml?
Superfile reads the configuration file once during initialization through the LoadConfigFile function. Unlike some settings that might hot-reload, sidebar_sections is processed at startup to build the initial sidebar model in src/internal/ui/sidebar/sidebar.go. You must restart Superfile for changes to take effect.
Is it possible to customize sidebar sections programmatically without editing the config file?
Yes. You can modify common.Config.SidebarSections at runtime using the Superfile internal API, as demonstrated in the src/internal/common package. However, these changes persist only for the current session unless you implement additional logic to write back to the TOML configuration file.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →