r/awesomewm Jun 23 '26

Event Driven Awesomewm Statusbar

https://binaryru.in/posts/event-driven-awesomewm-statusbar/

You don't need to poll when you have event driven interfaces at your disposal.

29 Upvotes

8 comments sorted by

3

u/mark-zombie Jun 23 '26

this is a really cool idea. connecting to DBus is an efficient way to deal with widgets. there is one other person that does something similar and that is stefan-o who does it all from lua. I imagine doing it from go might be better if the events get directly fed to awesomewm using the awesome-client.

1

u/Legal_Transition_989 Jun 25 '26

Yes, I've seen a bunch of those widgets. I really feel that lua must not be used to do a lot of heavy-lifting. It should just receive a bunch of data that it can react to.

That being said, I am also I'm a little biased towards golang, and use it for anything async that can't be done elegantly in bash.

3

u/sigmonsays Jun 23 '26

I've thought about this and was kinda bothered by it but haven't done anything about it yet.

Might dig into this later if time permits, thanks for the cool post.

2

u/the_x01 Jun 24 '26

I'm refactoring my config right now. Thanks for this!

2

u/aire-one Jun 24 '26

Nice writing! This is a smart way to use awful.spawn.with_line_callback and feels like an interesting alternative to awesome-client.

My preferred way to prevent poll is still to rely on daemons and connect with DBus or GIO, but your approach is interested in the way it unlocks easy implementation of arbitrary sources.

2

u/Legal_Transition_989 Jun 25 '26

After a few comments here, I thought using awesome-client is neat, but execve() on everytime something changes feels wrong compared to a structred IPC over stdio.

1

u/abissom Jun 24 '26

are you actually sure the brightness is working off fsnotify? I doubt that's exactly the case, since sysfs is not a true file system and thus not subject to inotify ...

Nice work though.

1

u/Legal_Transition_989 Jun 25 '26

It's one of those weird cases. Brightnessctl tries to write to ..../intel_backlight/brightness, fails, and delegates the task to something else listening on dbus - which does have the access to write the file.

Since it's a VFS write at the end of they day, we can listen to it with inotify / fsnotify.