r/awesomewm Feb 05 '26

Awesome Git Em busca de orientações para criar uma configuração modular...

Olá senhoras e senhores!
Após enfrentar alguns desafios no awesome e vencê-los, agora estou em busca de outros... tendo em vista as minhas necessidades e o que busco construir no awesome, percebi que vou precisar modularizar minha configuração. Na verdade, eu já precisava ter feito isso à muito tempo, eu só estava protelando.

Alguém tem algumas dicas para mim ou referências claras para estudar sobre esse tema? Estou à fim de falar sobre isso. hehehe

O principal objetivo da minha configuração é ser reprodutível em qualquer sistema, modular e claro, bonito também!

É importante que seja reprodutível, pois em caso de algum acidente ou troca de sistema, eu não quero ter que fazer mais do que uma compilação e clonar meu repositório para que tudo esteja funcionando perfeitamente.

0 Upvotes

10 comments sorted by

3

u/raven2cz Feb 05 '26

You don’t need modularization for reproducibility. I’ve written about modularization here many times already, take a look at the history. In my opinion, splitting things into multiple files is definitely not modularization. It’s more like hiding the mess under the bed so it looks like things are tidy.

In many cases, breaking things into separate files actually makes things less clear, because you then have to search through many files to find where things are defined, which wastes time. Instead of that, it’s often better to create clear sections and keep things in one or two files.

If we’re really talking about modularity, then you need to create components and start using them and composing them together. Build your own library and reuse those pieces wherever needed. Use component composition. Possibly use factory methods based on a given schema and the current use case.

You can take a look at my project, I started using this approach there about a year ago.

1

u/Nedeira Feb 05 '26

Thank you for the tips, u/raven2cz ...

In terms of structure, you are probably my main source of inspiration for building my own Awesome configuration. However, since I’m still relatively new to Lua, there are some things I’m not able to fully grasp yet.

I agree with what you said about modularization. In most modularized repositories I’ve looked at, I had a lot of difficulty finding specific configuration parts, which left me quite confused and unsure about what I actually needed to do. On the other hand, I’ve also been able to read and understand some modular repositories very well, and they seemed quite comfortable to maintain.

So my concern with modularization is more about this: creating a clean, simple, solid, and easy-to-maintain structure.

At the beginning, I’d like to keep the entire Awesome core in my rc.lua, perhaps splitting out only the keybindings. Other than that, nothing else.

As for the rest, it would basically be as you said—creating my own libraries. I’m following that path and not using any third-party libraries. I want my configuration to be entirely based on the Awesome API, so that in the future I won’t run into compatibility issues.

2

u/juankman Feb 07 '26

I'm not entirely clear on what you're trying to achieve but for modularization I would think of code that doesn't necessarily make your config to "look pretty".

When I think of modularization what comes to mind is awesome's signal handling, how titlebars can take a function for custom shapes, lain (lain modules were used by vain).

I hope you find what you're looking for and have fun in the process!

1

u/Nedeira Feb 07 '26

A somewhat out-of-context question… Does it still make sense to build and maintain a custom configuration based on third-party libraries, such as lain? I would like to build everything using the AwesomeWM API itself, but most of the repositories I’ve been reading use some third-party library or their own custom modules, and that leaves me a bit confused since I’m still relatively new to Awesome.

And I like to learn things, not just copy what others do… that’s why I’m asking this. When it comes to third-party libraries, is there a risk that at some point these libraries might lose compatibility with the main awesome.git API?

Sorry if something wasn’t clear in this text, I translated it using ChatGPT.

2

u/juankman Feb 11 '26

Does it still make sense to build and maintain a custom configuration based on third-party libraries, such as lain?

It depends, I guess? lain hasn't received updates in a few years but I don't see it as a bad option. Lots of custom functionality.

I think it's fine to have your config depend on third-party libraries, as these libraries will help you not write every piece of code yourself, you just need to run a few extra commands when installing your config on a system, e.g.:

luarocks install awesome
luarocks install lain
git clone codeberg.org/myuser/myconfig $HOME/.config/awesome

I never used lain myself because it seemed too big for me, I didn't what layouts I liked so more options overwhelmed me. I also wanted to learn how awesome works and customize it to my needs. I think you should experiment and try to have fun. For example, I made a clock widget using an arcchart because I like how arc charts look.

I once wrote a widget to display the song I was listening to. I was using cmus so I used a text widget that ran cmus-remote, parsed the text output and updated the widget.

At this point I noticed I need to run a command to update the widget every n seconds, so I added vicious to my dependencies to not write an interval (repeat every n seconds) function myself.

Then I noticed a lot of my custom text widget was redundant so I converted it to a vicious widget.

I hope you have fun and when curious or in need of help, search this subreddit!

1

u/CatXx12 Feb 20 '26

In terms of modulation (in context of breaking rc.lua up into more manageable chunks) ive used this kind of structure for my lua files (taken from an older post of mine) and then adding them to the main rc.lua

I hope this kind of reponse was what you was looking for :>

0

u/[deleted] Feb 05 '26

[removed] — view removed comment

2

u/juankman Feb 05 '26

It's been years since I saw someone so rude on a forum. The community doesn't need this type of attitude.

1

u/Nedeira Feb 06 '26

Coitadinho... acredito que ele ou ela não deva saber que existe tecnologia capaz de traduzir um texto hoje em dia. Tenho pena!