Customize Your Linux i3 Window Manager
In this article
Yes, you can fully customize your Linux i3 window manager by editing its configuration file to change keybindings, appearance, workspace behavior, and startup programs. This guide walks you through modifying the i3 config to personalize your desktop experience without relying on GUI tools.
What You'll Need
- A Linux system with i3 window manager installed
- Terminal access with a text editor (like nano, vim, or gedit)
- Basic knowledge of terminal commands and file paths
- Optional: a status bar like i3blocks or i3status, and a compositor like picom for visual effects
Step-by-Step
- Open a terminal and locate the i3 configuration file. It is usually found at
~/.config/i3/configor~/.i3/config. If it doesn’t exist, create it by copying the default:mkdir -p ~/.config/i3 && cp /etc/i3/config ~/.config/i3/config. - Open the config file in your preferred text editor. For example:
vim ~/.config/i3/configorgedit ~/.config/i3/config. - Change the default modifier key. i3 uses the Windows key (Mod4) by default, but you can switch to Alt (Mod1). Find the line starting with
set $modand change it toset $mod Mod1if you prefer Alt. - Modify keybindings for launching applications. Add or edit lines like
bindsym $mod+Return exec alacrittyto open your terminal of choice. Replacealacrittywithgnome-terminalorxfce4-terminalas needed. - Configure workspaces. By default, i3 names workspaces 1–10. You can rename them by adding:
workspace 1 output HDMI-1or label them with icons:set $ws1 "1: ", then use$ws1in workspace assignments. - Assign applications to specific workspaces. Add rules like
assign [class="Firefox"] $ws1so Firefox always opens on workspace 1. Usexpropto find window class names: runxprop | grep WM_CLASS, then click the window. - Change focus behavior. Edit the focus wrapping setting with
focus_wrapping disableto stop cycling between workspaces, or set it toworkspaceto wrap only within one output. - Adjust window gaps (if using i3-gaps). Add
gaps inner 10andgaps outer 5to create spacing between windows. Note: standard i3 does not support gaps; you need the i3-gaps fork. - Set startup programs. Add lines under
# Start applicationssuch asexec --no-startup-id nm-appletfor network management orexec --no-startup-id picom --daemonfor compositing effects. - Customize the status bar. Edit the
barblock in the config. Changestatus_command i3statustoi3blocksif using i3blocks. You can also modify font, colors, and position:position top,font pango:monospace 10. - Reload the configuration. After saving changes, press
$mod+Shift+Rto reload i3 without logging out. If errors occur, i3 will display a warning. - Test all changes. Open new terminals, switch workspaces, and verify apps launch and assign correctly. Fix syntax errors if reload fails.
Common Mistakes
Forgetting to reload the config after editing is the most frequent error. Always use$mod+Shift+R to apply changes. Another common issue is incorrect syntax—i3 is strict about spaces and missing semicolons. For example, bindsym $mod+Shift+Q kill must not have extra spaces around +. Misidentifying window classes also causes assignment failures; always use xprop to confirm class names. Using unsupported features like gaps without installing i3-gaps leads to ignored settings. Finally, editing the wrong config file (e.g., /etc/i3/config instead of the user copy) means changes won’t persist after updates.
Tips
Keep a backup of your working config before making major changes. Use comments (#) to label sections like "Keybindings" or "Startup Apps" for easier navigation. Test one change at a time to isolate issues. Use $mod+Shift+E to exit i3 gracefully if the session becomes unresponsive. Consider using a script to manage multiple config versions. For visual polish, pair picom with fade and shadow effects. Use font icons like Font Awesome or Nerd Fonts in workspace labels for a cleaner look. Document your keybindings in a cheat sheet for quick reference.
Troubleshooting
If i3 fails to reload after editing, it will show an error message with the line number. Open the config and check for typos, especially in keybindings or missing quotes. If the bar disappears, verify the status command path—some systems require full paths like/usr/bin/i3status. If applications don’t start on login, ensure exec lines use --no-startup-id to avoid duplicate launches. If workspace assignments fail, confirm the window class with xprop and check for case sensitivity. If gaps don’t appear, ensure you’re running i3-gaps, not standard i3. If you’re locked out due to a broken config, switch to a TTY (Ctrl+Alt+F2), log in, and fix the file manually. As a last resort, regenerate the config from default using the copy command in Step 1.
Frequently Asked Questions
Can I use a GUI to edit i3 config?
No, i3 does not include a GUI configuration tool. All customization is done by editing the text-based config file directly.How do I change the wallpaper?
i3 does not set wallpapers by default. Use a command likefeh --bg-scale /path/to/image.jpg in your config with exec --no-startup-id to set a wallpaper on startup.
Why are my keybindings not working?
Check for syntax errors, ensure the modifier key is correct, and verify no other application is intercepting the key combination. Reload the config after changes.Can I have multiple monitors with different workspaces?
Yes. i3 supports per-output workspaces. Useworkspace 1 output DP-1 to assign workspace 1 to a specific monitor.
How do I restart i3 safely?
Use$mod+Shift+R to reload the config. To exit entirely, use $mod+Shift+E and confirm logout.