How do you deal with multiple patches?

I have been using DWM for a couple of weeks now. Just wondering about patches.

I managed to install a patch, and think I get the concept now. However, it becomes messy when trying to add a second patch and when there are error messages. For some of them I tried to apply the patch manually but these are endless lines of codes and at the end it didn’t work neither. I feel like dwm is really for people who know C, else I am mostly blindly patching stuff.

Especially if I apply a broken patch to dwm (without knowing a priori). I am only using patches from the suckless.org site but many of these seem to give error messages even on blank dwm config.

So my question is of a more general nature, how do you deal with multiple patches? Do you really apply these manually? I was thinking of getting the top bar transparent, and adding gaps. And perhaps add a system tray.

Yes, or at least willing to learn C.
There are some automating tools, but it’s not recommended for obvious reasons…it sucks MORE :rofl:

Here’s one example for auto stuff…

1 Like

Watched the flexipatch but feel like it defeats the purpose of really digging into dwm and try to go suckless with couple of minimal patches.

I want to learn coding for a long time, but books are just lying on the shelf :wink:

I think python might be more useful for me because I can use scripts to solve real life problems. Wish there would be a dwm written in python. Or perhaps need to give qtile another chance.

Exactly. If you’re going to use dwm, learn C. All customisation for dwm is done by changing the source code and compiling it. Without knowing C, you’re hopelessly lost.

Whenever I patch my dwm, I try to understand what the code does and I copy and paste it in manually, instead of using the patch command.

The C programming language is very minimalist and simple. By simple, I don’t mean “comfortable to use,” or, “easy to write huge, complex applications in it”, but rather “very easy to understand in its entirety”. Take K&R and spend a month with it, doing all the exercises in it.

1 Like

For shorter code snippets I can do it and mostly think I understand but longer patches too difficult for me, or at least would need time to debug and understand the code that was written by someone else. Do you think C is also good entry language for C++? You mentioned a while ago it’s different but might be better to learn coding. Not 100% sure though.

I like the concept of applying new learned coding skills to modify my desktop, that at least would get me past basics from books. Always get stuck in the first couple of chapters then motivation drops.

Yes and no. Mostly no.

Modern C++ is very different from modern C. Although you can use the same programming style in modern C++ as in C, it is certainly not recommended to do that. C++ requires different programming paradigms, it is a much higher level language. Doing stuff in C++ the C way can create rather unsafe programs, with memory leaks, buffer overflows, etc…

C++ is a massive, bloated language. It compiles to very efficient binary code (just as C does), that’s true, but the language itself is just a bloated mess. I don’t think there is anyone alive who knows the entirety of C++. It is much more difficult to learn C++, it takes years of practice, but it’s also much easier to write complex programs in C++, because of some higher level features that C++ has.

C is very simple, elegant, easy to learn, slightly cumbersome to program in, and you have to pay attention to low-level stuff, like memory management. If you are not careful, you can easily make memory leaks, buffers that overflow, etc…

2 Likes

Kresimir-fun

1 Like

Well, it is. There are million ways to do the same thing in C++, and while some are better than others, there is no definite one that is how it should be done. The language design progressed throughout the years like this: “this is cool, let’s add it to the language!”. It has more bells and whistles than anyone alive could even imagine.

In a book about C++, the entire C language is just a footnote.

999999 of those ways to do same thing is BLOAT :rofl:

honka_animated-128px-20

It’s even worse than that… 80% of it is the wrong way to do it (though this is how most people are doing it), 10% is dubious, but could be the best (nobody knows), and over the other 10% C++ gurus are arguing what is the best way.

2 Likes

You are essentially forced to rewrite the software if you use dwm. A configuration file saves the users from learning the language in which it is written. But it is not the case with dwm.

Easiest Solution: Checkout chadwm and see if it includes the patches you want.

Best Solution: Learn C and get yourself familiar with the code base of dwm.

Smart Solution: nimdow is a window manager written in Nim. It is supposed to be a “replacement” for dwm. Maybe this will suck less.

1 Like

You don’t need to know C to be able to add many patches to dwm.

It’s a good idea to use git to patch. It is a good idea to commit every time you have added a patch. This allows you to git revert to a given commit.

Here is a patch flow that makes it easy:

All patches must be added on clean code.

We have our master branch from suckless. We don’t touch it.
When we have to change the source code or something else, we create a new branch with clean code from the master branch.

below you can see how it might look.

master
my-dwm
my-config
pertag
systry
fullscreen compilation
full-gaps
attachbottom
swallow
scratch-pads

You make a git checkout for the branch you want to make changes to or patch.
You make your patch with git apply -3 or git apply --reject or dry run with git apply --check.

You then make a git checkout to your own personal fork. In my case it is called my-dwm.

Then you do:
git rebase pertag
git rebase systray
git rebase all the patches you want.

There are a few patches that don’t go together very well. And they are the ones who change the status bar. But it can be done. There is help and advice on reddit about what to do to make them fit together.

I don’t add any patches manually. There are some of the patches that have a bug in them. There I open the file and change the error.

The error that can be is that git comes up with an error message that says something about bloops or something like that.

When it is such an error, it is the format of the git patch itself that is wrong. It can be changed by opening the file.

That being said, suckless website is totally impractical. And there are many of the patches that are old and buggy.