Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Customize Linux Desktop with i3: A Practical Guide

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Customizing your Linux desktop with i3 gives you full control over window layout, keyboard shortcuts, and visual elements, turning your workspace into a personalized, efficient environment. This guide will walk you through the essentials of i3 customization, including configuration, appearance, and layout adjustments. With i3, you gain a lightweight, fast, and highly customizable tiling window manager that can adapt to your workflow and aesthetic preferences.

What You'll Need

  • i3 installed on your Linux system
  • Access to a terminal
  • Basic knowledge of Linux command line
  • A text editor (like vim, nano, or gedit)
  • A working internet connection to reference documentation or themes

Step-by-Step

  1. Locate the i3 configuration file
    The main configuration file is typically ~/.config/i3/config or ~/.i3/config. Use a terminal command like ls ~/.config/i3 or check ~/.i3 to find it. If the file doesn't exist, i3 will generate a default one the first time you run it.
  2. Open the configuration file
    Use your preferred text editor to open it. For example: vim ~/.config/i3/config or nano ~/.config/i3/config. Familiarize yourself with the structure of the file before making any changes.
  3. Customize workspace names
    Look for lines like workspace 1. You can rename them to something meaningful like workspace 1 output DVI-D or workspace 1 name Web. This helps you organize applications spatially across multiple monitors or logical groups.
  4. Change keyboard shortcuts
    i3 uses keybindings defined with the bindsym command. For example, to change the workspace switch keybinding from Mod+1 to Mod+Shift+1, modify the line bindsym $mod+1 workspace number 1 to bindsym $mod+Shift+1 workspace number 1. Be careful to preserve the $mod variable, commonly set to the Windows key.
  5. Adjust window layout
    Add lines like default_orientation horizontal or default_orientation vertical to control how windows are arranged by default. You can also define layout-specific rules for certain applications using the for_window directive, such as for_window [class="Firefox"] layout tabbed.
  6. Customize appearance
    i3 does not handle themes directly, but you can use external tools like i3bar or i3status to customize status bars and colors. Add lines like bar { status_command i3status } and adjust colors using the colors section. For more advanced theming, tools like polybar or eww can be used to create fully customizable status bars and widgets.
  7. Restart i3
    After saving your changes, restart i3 by pressing Mod+Shift+R, or by running i3-msg restart in a terminal. Always restart after configuration changes to see if they take effect.
  8. Test and refine
    Use your new keybindings and workspace names to ensure everything works as expected. If something doesn't, compare your config to a default i3 configuration file or consult the i3 documentation. Testing small changes one at a time helps isolate issues.
  9. Automate application launching
    Use the exec directive to start applications automatically on startup. For example, exec firefox opens Firefox when you log in. You can also use this to launch your preferred terminal, music player, or code editor at startup.
  10. Customize window behavior
    i3 allows you to define custom behaviors for specific windows or applications using the for_window directive. For example, for_window [class="Gimp"] floating enable makes GIMP always float instead of tiling. This is useful for applications that don’t work well in tiling layouts.
  11. Use external tools for advanced customization
    Tools like polybar, eww, and compton can be used to enhance i3’s functionality. For example, polybar allows you to create fully customizable status bars that display system information like battery, network, and CPU usage. eww is a more modern alternative that supports widgets and animations.
  12. Explore i3 configuration generators
    If you’re new to i3 configuration, tools like i3-config-wizard or i3-manager can help you generate a basic configuration. These tools provide a simple GUI to customize keybindings, workspaces, and other settings without needing to write code manually.

Common Mistakes

  • Not backing up the original configuration before making changes
  • Using incorrect syntax (e.g., missing a semicolon or using the wrong command)
  • Changing keybindings without testing them in a terminal first
  • Modifying the wrong configuration file (e.g., editing a system-wide config instead of a user-specific one)
  • Overcomplicating the configuration with too many custom rules

Tips

  • Use exec to launch applications automatically on startup. For example: exec firefox.
  • Use workspace and move commands to organize windows into logical groups.
  • Explore i3 modules like polybar or eww for advanced status bars and widgets.
  • Use online configuration generators to find and test common i3 setups before applying them manually.
  • Keep a backup of your configuration file before making major changes.

Troubleshooting

If your i3 setup doesn't work after making changes, follow these steps:

  • Check for syntax errors in your config file using a linter or by running i3 -f ~/.config/i3/config -t to test it.
  • Revert to a previously working configuration by restoring a backup.
  • Ensure you are editing the correct configuration file by running i3 --version and i3-msg -t get_config to verify the active file.
  • Look for error messages in the terminal or in the i3 log file (usually in ~/.i3/log).
  • Try to isolate changes by commenting out lines in the config file and restarting i3 to see if the issue persists.

Frequently Asked Questions

How do I restore my original i3 configuration?

Copy a backup of your original config file back into the ~/.config/i3 directory and restart i3.

Can I use a GUI to customize i3?

Yes, tools like i3-config-wizard or i3-manager offer simple GUIs to generate or modify i3 configurations.

How do I apply a theme to i3?

i3 itself has limited theming support, but you can use tools like polybar or eww to create themed status bars and widgets.

What if my keybindings don't work?

Ensure you're using the correct Mod key (usually the Windows key), and check for typos in the bindsym commands.

How can I learn more about i3 configuration?

Refer to the official i3 documentation at i3wm.org, or explore community-driven resources like the i3 GitHub page or forums.