mihirlad55 / polybar-dwm-module

A dwm module for polybar
MIT License
116 stars 15 forks source link

Polybar module disables if it starts earlier than dwm #17

Closed gitneeraj closed 4 years ago

gitneeraj commented 4 years ago

Describe the issue

I did follow the instructions in this repo to add Polybar to my dwm. So I applied all my patches to dwm first then anybar patch and finally IPC patch. Restarted my sys and I could see the polybar. It all worked fine.

But as soon as I made some more changes to my dwm's config.def.h(basically renamed my tags) and re-built my dwm, suddenly dwm's tags wont show up on Polybar. I could still see other modules even after system restart.

Expected behavior: Should show tags even after applying patches after IPC patch dwm_polybar_desktop

What actually happens dwm-no-tags

To Reproduce

DWM build - https://github.com/gitneeraj/dwm_polybar Polybar config - https://github.com/gitneeraj/dotfiles/blob/master/polybar/config

Environment:

Features: +alsa +curl +dwm +i3 +mpd +network(libnl) +pulseaudio +xkeyboard

X extensions: +randr (+monitors) +composite +xkb +xrm +xcursor

Build type: Release Compiler: /usr/bin/c++ Compiler flags: -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -Wall -Wextra -Wpedantic -O3 -DNDEBUG Linker flags: -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now

isyuck commented 4 years ago

i have a similar issue, a quick fix that worked for me was starting polybar after dwm when Xorg starts. my .xinitrc calls a script before dwm (running in background with &) that sleeps for a second, then starts polybar as per my usual config.

this is by no means a solution, though.

gitneeraj commented 4 years ago

Yes, at the moment even i am handling the same way.

mihirlad55 commented 4 years ago

If the problem is polybar starting too early, the ugly solution is just extending the delay before polybar starts. However, since there are many people who are reporting this issue, I may have a solution.

If dwm launches polybar after it is ready and initialized, then this issue shouldn't happen and there would be no need for hardcoded delays. Now the question is, does this type of patch already exist? If not, would this patch make most sense as:

I'm leaning towards a standalone patch, since this can be helpful in numerous situations and I'd rather not force people to use these other larger patches for this simple purpose.

I'll take a look to see if something like this already exists. If not, I might have something ready by the end of the day. I'll also update the README with "launching polybar" instructions.

mihirlad55 commented 4 years ago

So, I found this patch which seems to already do what I'm talking about: https://dwm.suckless.org/patches/autostart/

If you add your polybar start command in ~/.dwm/autostart.sh after applying the patch, it should fix this issue. Try that and let me know if it works.

mihirlad55 commented 4 years ago

See commit https://github.com/mihirlad55/dwm-anybar/commit/6a8285817494ebd8b12605baebd8d924820670e0

mihirlad55 commented 4 years ago

Since the autostart patch is a bit more than what would be necessary to simply launch a bar, I decided to add a quick update to dwm-anybar that allows you to specify the path to your bar launch script. This method of launching should ensure that the bar does not start too early. Let me know if this works for you. As of right now, three fixes for this issue are:

mihirlad55 commented 4 years ago

I've updated the README as well with instructions. See commit 89c530d

mihirlad55 commented 4 years ago

Let me know if you guys are satisfied with these solutions. If I don't hear back soon, I'll be closing this issue.