i3blocks
i3blocks is a flexible status line generator
for the i3 window manager, commonly used in Linux
environments. It allows users to customize the status bar in
their i3 desktop setup by displaying various system
information, such as CPU usage, memory consumption, battery
status, network connectivity, and more.
Key Features of i3blocks:
- Modular Design: i3blocks uses a modular approach, enabling users to create individual scripts (blocks) that fetch specific information. Each block can be configured to show different data.
- Customizability: Users can easily customize the appearance and functionality of each block, including colors, icons, and update intervals.
- Lightweight: i3blocks is designed to be lightweight and efficient, making it a suitable choice for minimalistic setups.
- Easy Integration: It integrates seamlessly with the i3 window manager, providing a status bar that updates dynamically as system states change.
- Script-Based: Each block can be a simple shell script, allowing users to leverage existing command-line tools and scripts to gather the desired information.
Docs:
Basic Setup
To use i3blocks, you typically set it up in your i3
configuration file ~/.config/i3/config to run
as the status bar. Here’s a simple example of how it might
look in an i3 config:
bar {
status_command i3blocks
}
Example Blocks
You can create custom blocks by writing shell scripts. For instance, to show the current date and time:
#!/bin/bash
date '+%Y-%m-%d %H:%M:%S'Collection of scripts:
- https://github.com/vivien/i3blocks-contrib
- i3bar input protocol: https://i3wm.org/docs/i3bar-protocol.html#_click_events
$BLOCK_BUTTON is not a standard or common
Linux environment variable. Instead, it is typically used in
specific contexts, especially in the realm of status bars or
desktop environments that support clickable blocks of
information.
Common Usage:
- i3blocks: In the context of i3blocks, a
popular status bar for the i3 window manager,
$BLOCK_BUTTONis used to capture mouse button clicks on the status bar blocks. Each button click (left, middle, right) can trigger different commands or actions defined in the script.
Mouse Button Values: The value of
$BLOCK_BUTTON corresponds to the mouse button
clicked:
1for the left mouse button2for the middle mouse button3for the right mouse button
Configuration
The main configuration file for i3blocks is typically
located at ~/.config/i3blocks/config. In this
file, you can define blocks, their update intervals, and
their appearance.
Conclusion
i3blocks is a powerful tool for users of the i3 window manager who want to customize their status bar. Its modular and script-based design allows for extensive personalization, making it a preferred choice for those who enjoy a tailored desktop environment.
Links that helped me
- https://kumarcode.com/Colorful-i3/
- https://unix.stackexchange.com/questions/583409/i3blocks-script-coloring
- https://stackoverflow.com/questions/25958430/while-using-printf-how-to-escape-special-characters-in-shell-script
- https://stackoverflow.com/questions/5947742/how-to-change-the-output-color-of-echo-in-linux