Skip to content

Modular status bar for dwm written in c.

License

Notifications You must be signed in to change notification settings

myhat2you/dwmblocks

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dwmblocks

dwmblocks is a modular and customizable status bar for DWM (Dynamic Window Manager). It provides real-time system information using simple shell scripts. Each block in the status bar is independent, allowing for easy customization and flexibility. With dwmblocks, you can add, remove, or modify blocks to display different information or trigger updates using signals.

This version of dwmblocks is inspired by Luke Smith's dwmblocks, which emphasizes minimalism and efficiency. Most of the scripts I use are directly inspired by, or adapted from, Luke Smith's dotfiles. You can find my customized versions of these scripts in my dotfiles repository under ~/.local/bin/statusbar.

Modifying Blocks

The status bar is composed of individual blocks that output text generated by shell commands or scripts. To add or remove blocks, edit the blocks.def.h file, where each block is defined by the following:

  • The command to be executed.
  • The interval in seconds at which the block should update.
  • A signal number that can be used to update the block on demand.

This approach makes dwmblocks very efficient, as blocks can be updated manually without requiring frequent polling.

Signaling Changes

Unlike many status bars that update all blocks at set intervals, dwmblocks can be signaled to update specific blocks only when needed. This reduces CPU usage by avoiding unnecessary updates. For instance, to update the volume block (which has a signal number of 10), you can run:

pkill -RTMIN+10 dwmblocks

Or use:

kill -44 $(pidof dwmblocks)

This sends signal 44 (signal 10 + 34) to update the volume block instantly. Each block in the status bar can have a unique signal number for targeted updates.

Clickable Modules

The statuscmd patch allows for clickable interactions with the status bar. With this patch, you can assign actions to left, middle, and right mouse clicks on individual blocks. This enhances usability by enabling you to open applications or perform actions directly from the status bar.

For example, left-clicking on the clock block opens a calendar, and right-clicking on the news block syncs your RSS feed with Newsboat. The $BUTTON variable within the scripts detects which mouse button was clicked and responds accordingly.

For clickable functionality to work, the appropriate patch must also be applied to dwm. See statuscmd patch for more details. Credit for these patches goes to Daniel Bylinka.

Compatibility

This version of dwmblocks is also compatible with the status2d patch, which allows for colored status text.

Statusbar Scripts

The following table lists the scripts I use in my status bar, which are located in ~/.local/bin/statusbar in my dotfiles repository. These scripts are mostly inspired by Luke Smith’s dotfiles.

Each script displays specific system information and, in many cases, supports clickable functionality for additional actions.

Statusbar

Script Display Left Click Middle Click Right Click
sb-clock Date and time Notifies Calendar N/A Opens Calcurse
sb-music MPD song title N/A N/A N/A
sb-volume System volume N/A N/A N/A
sb-record Recording icon N/A N/A N/A
sb-memory RAM usage Lists programs using RAM N/A N/A
sb-cpu CPU usage Lists programs using CPU N/A N/A
sb-disk Disk usage Lists drives & partitions N/A N/A
sb-news Number of feeds Opens newsboat Sync newsboat Help notification
sb-mailbox Number of emails Opens neomutt Sync mail Help notification
sb-updates Number of updates Lists packages Sync updates Help notification
sb-internet Local IP address Shows network info N/A Copies public IP
sb-battery Battery percentage N/A N/A N/A

About

Modular status bar for dwm written in c.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 89.2%
  • Makefile 10.8%