Skip to main content

Development Environment Setup

· 3 min read
Max Kaido
Architect

Opinionated guide on how to setup the development environment on a laptop.

This guide covers the complete development environment setup used in our projects.

Window Manager (i3)

Our development environment uses i3 window manager with several enhancements:

Core Components

  • i3-gaps: Tiling window manager with gaps support
  • i3blocks: Status bar for i3
  • i3lock-fancy: Beautiful screen locker
  • polybar: Advanced status bar
  • rofi: Application launcher and window switcher
  • picom: Compositor for transparency effects
  • dunst: Notification daemon
  • nitrogen: Wallpaper manager

Key Features

  • Dynamic workspaces
  • Gaps between windows
  • Smart borders
  • Scratchpad support
  • Multi-monitor support
  • Custom keybindings
  • Floating window rules
  • Automatic startup applications

Common Keybindings

  • $mod+Enter: Open terminal
  • $mod+d: Application launcher (rofi)
  • $mod+Tab: Window switcher
  • $mod+Shift+q: Close window
  • $mod+[1-0]: Switch workspace
  • $mod+Shift+[1-0]: Move window to workspace
  • $mod+f: Fullscreen
  • $mod+v/h: Split vertically/horizontally
  • $mod+r: Resize mode
  • $mod+Shift+space: Toggle floating
  • Print: Screenshot menu

Terminal Environment

Shell (Zsh)

Our setup uses Zsh with various enhancements:

Core Features

  • Modular configuration
  • Advanced completion system
  • Syntax highlighting
  • Command suggestions
  • History management
  • Directory jumping
  • Git integration

Key Plugins

  • zsh-syntax-highlighting: Syntax highlighting for commands
  • zsh-autosuggestions: Fish-like command suggestions
  • starship: Cross-shell prompt
  • fzf: Fuzzy finder
  • autojump: Smart directory jumping
  • direnv: Directory-based environments
  • mcfly: Smart command history search
  • atuin: Shell history sync
  • zoxide: Smarter cd command

Terminal Emulator

  • Alacritty: GPU-accelerated terminal emulator
  • tmux: Terminal multiplexer

Development Tools

Version Control

  • git: Distributed version control
  • Advanced git aliases and functions
  • Integrated git completions

Package Managers

  • nvm: Node.js version manager
  • pyenv: Python version manager
  • cargo: Rust package manager
  • pip: Python package manager

Text Processing

  • ripgrep: Fast grep alternative
  • fd-find: Fast find alternative
  • bat: Cat clone with syntax highlighting
  • exa: Modern ls alternative
  • jq: JSON processor

System Monitoring

  • htop: Interactive process viewer
  • neofetch: System information tool
  • sysstat: System performance tools

Productivity Tools

Screenshots and Media

  • maim: Screenshot utility
  • slop: Selection operator
  • xclip: Clipboard manager
  • playerctl: Media player controller
  • pavucontrol: Audio control
  • brightnessctl: Brightness control

System Utilities

  • arandr: XRandR GUI
  • redshift: Blue light filter
  • unclutter: Hide idle mouse cursor
  • xautolock: Automatic screen locker

Configuration Management

All configurations are managed through Ansible playbooks:

Playbook Structure

ansible/
├── playbooks/
│ └── laptop_setup.yml # Main laptop setup playbook
└── files/
├── i3/ # i3 configurations
├── polybar/ # Polybar configurations
├── dunst/ # Notification configurations
├── picom/ # Compositor configurations
├── rofi/ # Application launcher configurations
└── zsh/ # Shell configurations

Running the Setup

# Install everything on a laptop
ansible-playbook -i inventories/production/inventory.ini playbooks/laptop_setup.yml --limit laptops

Customization

Adding New Tools

  1. Add package to laptop_setup.yml
  2. Create configuration in ansible/files/
  3. Add configuration copy task to playbook
  4. Update documentation

Modifying Configurations

  1. Edit files in ansible/files/
  2. Run playbook with --tags config
  3. Test changes
  4. Commit and push

Troubleshooting

Common Issues

i3 Issues

  • Black screen: Check picom service
  • No status bar: Check polybar service
  • No notifications: Check dunst service

Shell Issues

  • Slow startup: Check plugin loading order
  • Completion issues: Rebuild completion cache
  • History issues: Check history file permissions

Debugging Tools

  • i3 debug log: ~/.i3/i3log
  • Polybar log: polybar -l debug
  • Zsh startup profiling: zsh -i -c exit

Best Practices

Window Management

  • Use workspaces for different contexts
  • Utilize scratchpad for temporary windows
  • Set up automatic window rules

Shell Usage

  • Use fuzzy finding (fzf) for navigation
  • Leverage directory jumping (autojump/zoxide)
  • Utilize command history effectively

Development Workflow

  • Use tmux for session management
  • Set up project-specific direnv
  • Configure editor integration

Security Considerations

System Security

  • Automatic screen locking
  • Secure clipboard handling
  • Protected configuration files

Development Security

  • SSH key management
  • GPG key integration
  • Secure environment variables

Performance Optimization

Shell Performance

  • Lazy loading of heavy tools
  • Efficient completion system
  • Minimal startup scripts

System Performance

  • Compositor optimization
  • Efficient process management
  • Resource monitoring

Updates and Maintenance

Regular Updates

# Update system packages
sudo apt update && sudo apt upgrade

# Update development tools
rustup update
pyenv update
nvm install --lts

# Update configurations
ansible-playbook laptop_setup.yml --tags config

Backup Strategy

  • Configuration backup
  • Shell history backup
  • Custom scripts backup