{"id":13577430,"url":"https://github.com/UtkarshVerma/dwmblocks-async","last_synced_at":"2025-04-05T11:32:45.917Z","repository":{"id":38222206,"uuid":"349685007","full_name":"UtkarshVerma/dwmblocks-async","owner":"UtkarshVerma","description":"An efficient, lean, and asynchronous status feed generator for dwm.","archived":false,"fork":false,"pushed_at":"2024-04-20T03:19:09.000Z","size":165,"stargazers_count":231,"open_issues_count":1,"forks_count":87,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-11-05T14:45:06.109Z","etag":null,"topics":["dwm","dwm-status","dwm-statusbar","suckless"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/UtkarshVerma.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"patreon":"UtkarshVerma","ko_fi":"UtkarshVerma","liberapay":"UtkarshVerma","custom":"https://paypal.me/UtkarshVermaI"}},"created_at":"2021-03-20T09:49:00.000Z","updated_at":"2024-10-23T22:27:44.000Z","dependencies_parsed_at":"2023-02-18T22:46:01.932Z","dependency_job_id":"52407fee-4cf2-416b-a9cc-98fe29095639","html_url":"https://github.com/UtkarshVerma/dwmblocks-async","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UtkarshVerma%2Fdwmblocks-async","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UtkarshVerma%2Fdwmblocks-async/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UtkarshVerma%2Fdwmblocks-async/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UtkarshVerma%2Fdwmblocks-async/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/UtkarshVerma","download_url":"https://codeload.github.com/UtkarshVerma/dwmblocks-async/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247331756,"owners_count":20921844,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dwm","dwm-status","dwm-statusbar","suckless"],"created_at":"2024-08-01T15:01:21.395Z","updated_at":"2025-04-05T11:32:45.626Z","avatar_url":"https://github.com/UtkarshVerma.png","language":"C","funding_links":["https://patreon.com/UtkarshVerma","https://ko-fi.com/UtkarshVerma","https://liberapay.com/UtkarshVerma","https://paypal.me/UtkarshVermaI"],"categories":["C"],"sub_categories":[],"readme":"# dwmblocks-async\n\nA [`dwm`](https://dwm.suckless.org) status bar that has a modular, async\ndesign, so it is always responsive. Imagine `i3blocks`, but for `dwm`.\n\n![A lean config of dwmblocks-async.](preview.png)\n\n## Features\n\n- [Modular](#modifying-the-blocks)\n- Lightweight\n- [Suckless](https://suckless.org/philosophy)\n- Blocks:\n  - [Clickable](#clickable-blocks)\n  - Loaded asynchronously\n  - [Updates can be externally triggered](#signalling-changes)\n- Compatible with `i3blocks` scripts\n\n\u003e Additionally, this build of `dwmblocks` is more optimized and fixes the\n\u003e flickering of the status bar when scrolling.\n\n## Why `dwmblocks`?\n\nIn `dwm`, you have to set the status bar through an infinite loop, like so:\n\n```sh\nwhile :; do\n    xsetroot -name \"$(date)\"\n    sleep 30\ndone\n```\n\nThis is inefficient when running multiple commands that need to be updated at\ndifferent frequencies. For example, to display an unread mail count and a clock\nin the status bar:\n\n```sh\nwhile :; do\n    xsetroot -name \"$(mailCount) $(date)\"\n    sleep 60\ndone\n```\n\nBoth are executed at the same rate, which is wasteful. Ideally, the mail\ncounter would be updated every thirty minutes, since there's a limit to the\nnumber of requests I can make using Gmail's APIs (as a free user).\n\n`dwmblocks` allows you to divide the status bar into multiple blocks, each of\nwhich can be updated at its own interval. This effectively addresses the\nprevious issue, because the commands in a block are only executed once within\nthat time frame.\n\n## Why `dwmblocks-async`?\n\nThe magic of `dwmblocks-async` is in the `async` part. Since vanilla\n`dwmblocks` executes the commands of each block sequentially, it leads to\nannoying freezes. In cases where one block takes several seconds to execute,\nlike in the mail and date blocks example from above, the delay is clearly\nvisible. Fire up a new instance of `dwmblocks` and you'll see!\n\nWith `dwmblocks-async`, the computer executes each block asynchronously\n(simultaneously).\n\n## Installation\n\nClone this repository, modify `config.h` appropriately, then compile the\nprogram:\n\n```sh\ngit clone https://github.com/UtkarshVerma/dwmblocks-async.git\ncd dwmblocks-async\nvi config.h\nsudo make install\n```\n\n## Usage\n\nTo set `dwmblocks-async` as your status bar, you need to run it as a background\nprocess on startup. One way is to add the following to `~/.xinitrc`:\n\n```sh\n# The binary of `dwmblocks-async` is named `dwmblocks`\ndwmblocks \u0026\n```\n\n### Modifying the blocks\n\nYou can define your status bar blocks in `config.h`:\n\n```c\n#define BLOCKS(X) \\\n    ...\n    X(\" \", \"wpctl get-volume @DEFAULT_AUDIO_SINK@ | cut -d' ' -f2\", 0, 5) \\\n    X(\"󰥔 \", \"date '+%H:%M:%S'\", 1, 1) \\\n    ...\n```\n\nEach block has the following properties:\n\n| Property        | Description                                                                                                                                        |\n| --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |\n| Icon            | An icon you wish to prepend to your block output.                                                                                                  |\n| Command         | The command you wish to execute in your block.                                                                                                     |\n| Update interval | Time in seconds, after which you want the block to update. If `0`, the block will never be updated.                                                |\n| Update signal   | Signal to be used for triggering the block. Must be a positive integer. If `0`, a signal won't be set up for the block and it will be unclickable. |\n\nApart from defining the blocks, features can be toggled through `config.h`:\n\n```c\n// String used to delimit block outputs in the status.\n#define DELIMITER \"  \"\n\n// Maximum number of Unicode characters that a block can output.\n#define MAX_BLOCK_OUTPUT_LENGTH 45\n\n// Control whether blocks are clickable.\n#define CLICKABLE_BLOCKS 1\n\n// Control whether a leading delimiter should be prepended to the status.\n#define LEADING_DELIMITER 0\n\n// Control whether a trailing delimiter should be appended to the status.\n#define TRAILING_DELIMITER 0\n```\n\n### Signalling changes\n\nMost status bars constantly rerun all scripts every few seconds. This is an\noption here, but a superior choice is to give your block a signal through which\nyou can indicate it to update on relevant event, rather than have it rerun\nidly.\n\nFor example, the volume block has the update signal `5` by default. I run\n`kill -39 $(pidof dwmblocks)` alongside my volume shortcuts in `dwm` to only\nupdate it when relevant. Just add `34` to your signal number! You could also\nrun `pkill -RTMIN+5 dwmblocks`, but it's slower.\n\nTo refresh all the blocks, run `kill -10 $(pidof dwmblocks)` or\n`pkill -SIGUSR1 dwmblocks`.\n\n\u003e All blocks must have different signal numbers!\n\n### Clickable blocks\n\nLike `i3blocks`, this build allows you to build in additional actions into your\nscripts in response to click events. You can check out\n[my status bar scripts](https://github.com/UtkarshVerma/dotfiles/tree/main/.local/bin/statusbar)\nas references for using the `$BLOCK_BUTTON` variable.\n\nTo use this feature, define the `CLICKABLE_BLOCKS` feature macro in your\n`config.h`:\n\n```c\n#define CLICKABLE_BLOCKS 1\n```\n\nApart from that, you need `dwm` to be patched with\n[statuscmd](https://dwm.suckless.org/patches/statuscmd/).\n\n## Credits\n\nThis work would not have been possible without\n[Luke's build of dwmblocks](https://github.com/LukeSmithxyz/dwmblocks) and\n[Daniel Bylinka's statuscmd patch](https://dwm.suckless.org/patches/statuscmd/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FUtkarshVerma%2Fdwmblocks-async","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FUtkarshVerma%2Fdwmblocks-async","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FUtkarshVerma%2Fdwmblocks-async/lists"}