Skip to content
TheChatArchiveThe Chat Archive
gpt-4o-mini-2024-07-18· OpenAIAi2 WildChat-4.8M (AI2)

setup for sway archlinux using nvim, foot and swaybg to make fastfetch as background image

  1. User

    setup for sway archlinux using nvim, foot and swaybg to make fastfetch as background image

  2. Assistant

    To set up Sway on Arch Linux using Neovim, the Foot terminal, and Swaybg with FastFetch for a background image, follow these steps.

    Requirements

    • Arch Linux installed.
    • Sway (Wayland compositor).
    • Neovim (Text Editor).
    • Foot (Terminal emulator).
    • FastFetch (for gathering and displaying system information).

    Step 1: Install Required Packages

    Make sure you have sway, neovim, foot, and fastfetch installed. You can install them using pacman or an AUR helper like yay.

    sudo pacman -S sway neovim foot fastfetch swaybg
    

    If you're using an AUR helper like yay, you can add:

    yay -S fastfetch
    

    Step 2: Configure Sway

    Create a configuration file for Sway. This usually goes in ~/.config/sway/config.

    mkdir -p ~/.config/sway
    nano ~/.config/sway/config
    

    Here’s a minimal configuration file to get started:

    # Specify the Wayland display server
    set $mod Mod4  # This is usually the super (Windows) key
    
    # Background using swaybg and FastFetch
    exec swaybg -i /path/to/your/background/image.png -m fill  # Replace with your image path and method
    
    # Start FastFetch
    exec_always --no-startup-id fastfetch
    
    # Define key bindings
    bindsym $mod+Return exec foot  # Open Foot terminal
    bindsym $mod+d exec dmenu_run  # Use dmenu for application launcher
    bindsym $mod+Shift+e kill  # Exit Sway
    
    # Other Sway configurations...
    

    Step 3: Generate the Background Image with FastFetch

    You can use FastFetch to generate a background image. It typically outputs to the terminal, but you can redirect it to an image file. Here is a method to create a background image using FastFetch in a script:

    1. Create a script called generate_bg.sh.
    touch ~/generate_bg.sh
    chmod +x ~/generate_bg.sh
    
    1. Add the following script to generate an image:
    #!/bin/bash
    
    # Create output directory if it doesn't exist
    output_dir="$HOME/.config/sway/backgrounds"
    mkdir -p "$output_dir"
    
    # Generate background using FastFetch
    fastfetch --image <your-image-path> -o "$output_dir/fastfetch.png"  # Specify the desired image path
    
    # Set this file as the background
    swaybg -i "$output_dir/fastfetch.png" -m fill &
    
    

    Step 4: Run the Script on Sway Startup

    Modify your Sway config to run this script:

    exec_always --no-startup-id ~/generate_bg.sh
    

    Step 5: Launch Sway

    Log out from your current session and switch to a Wayland session with Sway. You can generally choose Sway from your login manager.

    Step 6: Test Functionality

    • Open Foot terminal by pressing Mod + Enter.
    • Run commands in Neovim by executing nvim in your terminal.
    • You should see FastFetch running as a background image.

    Summary

    This guide provided a way to set up Sway with Neovim and Foot, using FastFetch for a dynamic background image. You can customize the FastFetch parameters and the Sway configuration as needed for your preferences. Make sure to adapt the image paths and options based on your own setups. Enjoy your new environment!