Skip to content
kb100 edited this page Dec 29, 2018 · 9 revisions

General

What is a blocklet?

A blocklet is the configuration of a single block, part of the status line. This repository is dedicated to collecting the vast work of the i3blocks community in creating these blocklets.

Can I share a blocklet that I've written?

Absolutely! See the guidelines on blocklet contributions.

What if there is already a similar blocklet to mine in the repo?

Still okay! There are many different ways to write the same blocklet. Some people don't want certain dependencies. Some people like one look and feel over another. Some people want bells and whistles. Some people want minimalism. If you think your blocklet is different enough, submit it.

Can I request a blocklet that doesn't exist yet?

Yes, create an issue on the issues page with your request. Please include [Request] in the title of the issue. Contributors will discuss the request and if you are lucky the request may be implemented.

A blocklet doesn't work or I've found a bug, how can I best report it?

Create an issue on the issues page. Make sure to include as much information as possible. If a blocklet is showing no output or wrong output, also make sure to try running it from the command line and to post any interesting results.

Blocklets refer to $SCRIPT_DIR, what does that mean? How can I use it?

$SCRIPT_DIR is a generic stand-in for the location of the current script. For example, if a blocklet recommends the config

[example]                                                                          
command=$SCRIPT_DIR/example.ext                                                    
interval=5                                                                         

and you cloned i3blocks-contrib into ~/i3blocks-contrib you might put

[example]                                                                          
command=~/i3blocks-contrib/example/example.ext                                            
interval=5                                                                         

Alternatively, you can pass $SCRIPT_DIR as an environmental variable to i3blocks from your i3 config.
E.g. if you keep all the scripts you use in ~/blocklets, then in your i3 config you could put

bar {                                                                              
        status_command SCRIPT_DIR=~/blocklets i3blocks                              
}                                                                                  

Then anywhere in your i3blocks config you can refer to $SCRIPT_DIR.
If you keep all the scripts in a flat hierarchy, then you could use

[example]                                                                          
command=$SCRIPT_DIR/example.ext                                                    
interval=5                                                                         

Or if you leave each blocklet in its own directory you could use

[example]                                                                          
command=$SCRIPT_DIR/example/example.ext                                            
interval=5

Technical

A block I wrote freezes my bar (usually on clicking), but works from the command line

Most likely you incorrectly spawned a long-running process. The bar does not update until your process and all its children have terminated. If you want to spawn a process "in the background", use i3-msg exec -q yourscript, which spawns and disowns the process.

My persistent blocklet works on the command line, but doesn't work in my bar

Commands like grep and sed do tricky buffering that may produce different behavior when run from the command line versus when called from i3blocks. In many cases this is useful but for persistent blocks using grep or sed, not flushing stdout immediately means your bar doesn't update. To fix this issue, use stdbuf -oL to prevent this kind of output buffering. See the bandwidth blocklet for an example in action.


Take a look at i3blocks' FAQ for more often confusing details.