Skip to content

defname/i3blocks-scripts

Repository files navigation

i3blocks Custom Status Line

This repository contains a collection of custom scripts and configurations for i3blocks, designed to generate a dynamic and informative status line for the i3 window manager.

Table of Contents

Features

This i3blocks setup provides the following status line blocks:

  • Volume: Displays current audio volume and mute status with appropriate icons and color coding.
  • Battery: Shows battery level, charging status, and uses color to indicate charge level (red for low, yellow for medium, green for high).
  • Time: Displays the current date and time.
  • WLAN: Indicates active Wi-Fi connection and displays the SSID.
  • Ethernet: Shows if an Ethernet connection is active.
  • Updates: (Arch Linux specific) Displays the number of pending system updates.
  • Active Window: Shows the title of the currently active window, truncated if too long.
  • Caps Lock: Indicates if Caps Lock is active.
  • Display Brightness: Shows the current screen brightness percentage.

Screenshot

Screenshot of the status line

Installation

Dependencies

Ensure you have the following tools and fonts installed on your system for all blocks to function correctly:

  • i3blocks: The main status line program.
  • xdotool: For active_window.sh.
  • amixer: For volume.sh (part of alsa-utils on many systems).
  • xbacklight: For display_brightness.sh.
  • checkupdates: For checkforupdates.sh (Arch Linux specific, part of pacman-contrib).
  • iwgetid: For wlan_connection.sh (part of wireless_tools).
  • iwctl: For iwd_wlan_connection.sh (if using iwd for Wi-Fi).
  • Font Awesome 5 Free: Used for various icons.
  • statusline-icons.ttf: Custom font for additional icons.

Setup

  1. Clone the repository:
    git clone https://github.com/yourusername/i3blocks.git
    cd i3blocks
  2. Copy configuration: Copy the i3blocks.config file to your i3 configuration directory. A common location is ~/.config/i3/ or ~/.config/i3blocks/.
    mkdir -p ~/.config/i3blocks/
    cp i3blocks.config ~/.config/i3blocks/
  3. Copy scripts: Copy the scripts/ directory to ~/.config/i3blocks/.
    cp -r scripts ~/.config/i3blocks/
  4. Make scripts executable: Ensure all scripts in ~/.config/i3blocks/scripts/ are executable.
    chmod +x ~/.config/i3blocks/scripts/*.sh
  5. Install custom font: Install statusline-icons.ttf to your system's font directory (e.g., ~/.local/share/fonts/ or /usr/local/share/fonts/) and update your font cache.
    mkdir -p ~/.local/share/fonts/
    cp statusline-icons.ttf ~/.local/share/fonts/
    fc-cache -fv

Configuration

i3blocks.config

The main configuration file for i3blocks. It defines the order, interval, and commands for each block.

  • Global Properties: The [general] section sets default interval, color, and separator_block_width for all blocks.
  • Block-specific Properties: Each [block_name] section overrides global properties and defines the command to execute.
  • Pango Markup: Most blocks use markup=pango to enable rich text formatting, including custom fonts and colors.

Note: The battery2.sh and iwd_wlan_connection.sh scripts are present but not currently used in the provided i3blocks.config. You can integrate them if needed.

Custom Scripts

The scripts/ directory contains the bash scripts executed by i3blocks.

  • helpers.sh: Contains reusable functions, such as get_color_for_percentage, to maintain consistency across scripts.
  • Individual scripts (e.g., volume.sh, battery.sh): Fetch system information and format it for i3blocks output, often using Pango markup for icons and colors.

Color Gradient Generation

The generate_color_gradient.py Python script can be used to generate a gradient of hex colors. This can be useful for creating custom color schemes for your status line.

python3 generate_color_gradient.py <start_hex_color> <end_hex_color> <steps>

Example:

python3 generate_color_gradient.py "#FF0000" "#0000FF" 10

Icons

This setup utilizes:

  • Font Awesome 5 Free: For a wide range of common icons.
  • statusline-icons.ttf: A custom font providing additional specific icons.

Ensure both are correctly installed and accessible by your system.

Statusline Icons Font Information

The statusline-icons.ttf font was generated using IcoMoon (as indicated by selection.json in the icons/ directory). The statusline-icons.README file in the root directory incorrectly states Fontello.com as the generator.

This font includes icons from the following open-source iconic fonts (as listed in the original statusline-icons.README):

Additionally, some icons may originate from Flaticon, specifically from:

Usage with i3wm

To integrate i3blocks with your i3 window manager, add the following line to your ~/.config/i3/config file:

bar {
    status_command i3blocks -c ~/.config/i3blocks/i3blocks.config
    # Other bar configurations...
}

After modifying your i3 config, reload i3 (usually Mod+Shift+R).

Contributing

Feel free to fork this repository, make improvements, and submit pull requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Custom modules for i3blocks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published