{"id":20339896,"url":"https://github.com/uditkarode/polybar-dwm","last_synced_at":"2025-09-11T08:35:43.857Z","repository":{"id":52879509,"uuid":"339336174","full_name":"uditkarode/polybar-dwm","owner":"uditkarode","description":null,"archived":false,"fork":false,"pushed_at":"2021-04-15T10:44:46.000Z","size":7906,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-19T02:26:24.398Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uditkarode.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-16T08:49:22.000Z","updated_at":"2023-11-27T06:37:48.000Z","dependencies_parsed_at":"2022-08-23T12:31:21.320Z","dependency_job_id":null,"html_url":"https://github.com/uditkarode/polybar-dwm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/uditkarode/polybar-dwm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uditkarode%2Fpolybar-dwm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uditkarode%2Fpolybar-dwm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uditkarode%2Fpolybar-dwm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uditkarode%2Fpolybar-dwm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uditkarode","download_url":"https://codeload.github.com/uditkarode/polybar-dwm/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uditkarode%2Fpolybar-dwm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274602274,"owners_count":25315199,"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","status":"online","status_checked_at":"2025-09-11T02:00:13.660Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-14T21:18:54.788Z","updated_at":"2025-09-11T08:35:43.822Z","avatar_url":"https://github.com/uditkarode.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# polybar-dwm-module\n![DWM\nModule](https://github.com/mihirlad55/polybar-dwm-module/blob/master/dwm-module.png)\n\n**polybar-dwm-module** is a fork of\n[polybar](https://github.com/polybar/polybar) which implements a dwm module.\n\n\n## Requirements\n* dwm with the [IPC patch](https://github.com/mihirlad55/dwm-ipc) applied\n* [dwmipcpp](https://github.com/mihirlad55/dwmipcpp) C++ client library for\n  communicating with dwm (included as a submodule).\n* [jsoncpp](https://github.com/open-source-parsers/jsoncpp) for polybar and\n  dwmipcpp (required by module).\n\nThe [dwm-anybar patch](https://github.com/mihirlad55/dwm-anybar) is optionally\nrecommended for a better experience. This patch allows dwm to manage polybar and\nfixes some weird quirks that you may experience without it.\n\n\n## The DWM Module\nThe dwm module currently supports the following:\n- Labels:\n    * Display dwm tags\n        - Separator label between tags\n    * Display the current layout\n    * Display the currently focused window title (per monitor)\n    * Display label when focused window is floating\n- Click Handlers:\n    * Tags:\n        - Left-click tag to view tag\n        - Right-click tag to toggle view on tag\n        - Scroll tags to view different tags (with wrapping, reverse scroll, and\n          empty tag scroll)\n    * Layout:\n        - Left-click to set `secondary-layout` (specified in config)\n        - Right-click to set previous layout\n        - Scroll to cycle through layouts (with wrapping and reverse scroll)\n- Different formatting for different tag states:\n    * Focused: selected tag on selected monitor\n    * Unfocused: selected tag on unselected monitor\n    * Visible: unselected, but occupied tag on any monitor\n    * Urgent: Tag with window that has the urgent hint set\n    * Empty: Unselected and unoccupied tags\n- The combined power of polybar\n\n\n## How to Install\nFirst, apply all the patches you want on dwm, saving the IPC patch for last.\n\nOptionally, apply the [dwm-anybar\npatch](https://github.com/mihirlad55/dwm-anybar) and make sure your `config.h`\ncontains the following\n```\nstatic const int showbar            = 1;        /* 0 means no bar */\nstatic const int topbar             = 1;        /* 0 means bottom bar */\nstatic const int usealtbar          = 1;        /* 1 means use non-dwm status bar */\nstatic const char *altbarclass = \"Polybar\";     /* Alternate bar class name */\nstatic const char *altbarcmd  = \"$HOME/bar.sh\"; /* Alternate bar launch command */\n```\nIf your polybar is to be displayed on the bottom of the monitor, set `topbar`\nto `0`.\n\nNext, apply the [IPC patch](https://github.com/mihirlad55/dwm-ipc). There will\nlikely be merge conflicts. The IPC patch is mostly additive, so in most conflict\ncases, you will be keeping both changes.\n\nAfter applying all your patches, make sure you compile and install dwm\n```\n$ sudo make install\n```\n\nMake sure you have `jsoncpp` installed, and any other requirements from\n[polybar](https://github.com/polybar/polybar).\n\nArch linux users can install the\n[`polybar-dwm-module`](https://aur.archlinux.org/packages/polybar-dwm-module/)\npackage from the AUR.\n\nOtherwise you can clone, make, and install polybar yourself. Follow the on\nscreen prompts in the `build.sh` script and enable any additional features you\nwant.\n```\n$ git clone https://github.com/mihirlad55/polybar-dwm-module\n$ cd polybar-dwm-module\n$ ./build.sh -d\n```\n\nConfigure the bar!  You can view `/usr/share/doc/polybar/config` for a sample config that\nincludes the supported settings for the dwm module.\n\n**IF YOU APPLIED THE ANYBAR PATCH**, make sure you have\n`override-redirect = false` in your polybar config.\n\n**IF YOU DID NOT APPLY THE ANYBAR PATCH**, make sure you have\n`override-redirect = true` in your polybar config. You will have to set the bar\nheight in your dwm's `config.h` to match polybar's height and make sure\n`showbar` is set to `1` in your `config.h`. Also make sure `topbar` is set to\nthe correct value based on if your polybar is a bottom/top bar.\n\n## Launching Polybar\nThere are multiple ways to launch polybar. Whatever way you decide to use, make\nsure polybar launches a few seconds after dwm, else dwm's socket will not be\ninitialized and the module will fail:\n\n### Anybar Method\nThe `altbarcmd` variable can be set to the bar launch script. When you apply the\nanybar patch, make sure `spawnbar()` occurs in the `setup()` function after\n`setupepoll()` and this will ensure that the bar is launched after dwm is ready.\nAlso make sure that the script checks for running bars before launching more,\nelse if dwm is restarted, duplicate bars will be launched.\n\n### Hacky Delay Method\nIn your `.xsession` script or whatever script launches at startup, add something\nlike the following:\n```\n$(sleep 4s \u0026\u0026 \"$HOME/launch-polybar.sh\") \u0026\n```\nThis will start your polybar script after a 4 second delay which should give dwm\nenough time to initialize before polybar tries to connect to dwm. If this\ndoesn't work, try a longer delay.\n\n### Autostart Method\nApply the [autostart patch](https://dwm.suckless.org/patches/autostart/). In\nyour `autostart_blocking.sh`, add your command to launch polybar.\n\n\n## Sample Module Configuration\n```ini\n...\n\nmodules-left = ... dwm ...\n\n...\n\n[module/dwm]\ntype = internal/dwm\nformat = \u003clabel-tags\u003e \u003clabel-layout\u003e \u003clabel-floating\u003e \u003clabel-title\u003e\n; Path to dwm socket (default: /tmp/dwm.sock)\n; socket-path = /tmp/dwm.sock\n\n; Left-click to view tag, right-click to toggle tag view\nenable-tags-click = false\n; Scroll to cycle between available tags\nenable-tags-scroll = false\n; If true and enable-tags-scroll = true, scrolling will view all tags regardless if occupied\ntags-scroll-empty = false\n; If true and enable-tags-scroll = true, scrolling will cycle through tags backwards\ntags-scroll-reverse = false\n; If true and enable-tags-scroll = true, wrap active tag when scrolling\ntags-scroll-wrap = false\n; Left-click to set secondary layout, right-click to switch to previous layout\nenable-layout-click = false\n; Scroll to cycle between available layouts\nenable-layout-scroll = false\n; Wrap when scrolling and reaching beginning/end of layouts\nlayout-scroll-wrap = false\n; Reverse scroll direction\nlayout-scroll-reverse = false\n\n; If enable-layout-click = true, clicking the layout symbol will switch to this layout\nsecondary-layout-symbol = [M]\n\n; Separator in between shown tags\n; label-separator = |\n\n; Title of currently focused window\n; Available tokens:\n;   %title%\nlabel-title = %title%\nlabel-title-padding = 2\nlabel-title-foreground = ${colors.primary}\nlabel-title-maxlen = 30\n\n; Symbol of current layout\n; Available tokens:\n;   %symbol%\nlabel-layout = %symbol%\nlabel-layout-padding = 2\nlabel-layout-foreground = #000\nlabel-layout-background = ${colors.primary}\n\n; Text to show when currently focused window is floating\nlabel-floating = F\n\n; States: focused, unfocused, visible, urgent, empty\n; Available tokens:\n;   %name%\n\n; focused = Selected tag on focused monitor\nlabel-focused = %name%\nlabel-focused-background = ${colors.background-alt}\nlabel-focused-underline= ${colors.primary}\nlabel-focused-padding = 2\n\n; unfocused = Unselected tag on unselected monitor\nlabel-unfocused = %name%\nlabel-unfocused-padding = 2\n\n; visible = Unselected tag, but occupied tag on any monitor\nlabel-visible = %name%\nlabel-visible-background = ${self.label-focused-background}\nlabel-visible-underline = ${self.label-focused-underline}\nlabel-visible-padding = ${self.label-focused-padding}\n\n; urgent = Unselected tag with window that has urgency hint set\nlabel-urgent = %name%\nlabel-urgent-background = ${colors.alert}\nlabel-urgent-padding = 2\n\n; empty = Unselected and unoccupied tag\n; This can be set to an empty string to hide empty tags\nlabel-empty = %name%\nlabel-empty-background = ${colors.primary}\nlabel-empty-padding = 2\n```\n\nYou can also take a look at my\n[personal](https://github.com/mihirlad55/dotfiles/blob/arch-dwm/.config/polybar/config#L99)\nbar configuration which is more representative of the screenshot above.\n\n\n## License\nPolybar is licensed under the MIT license. [See LICENSE for more\ninformation](https://github.com/polybar/polybar/blob/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuditkarode%2Fpolybar-dwm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuditkarode%2Fpolybar-dwm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuditkarode%2Fpolybar-dwm/lists"}