How to add patches to dwm

0

1

I do not understand how to add patches to dwm, I am running Ubuntu and I do have git installed. Am I just supposed to copy/paste the .diff file into a new file in the directory and do git apply pertag.diff ? Please be very explicit as it is I am hopelessly lost.

Zachary Alfakir

Posted 2013-10-12T19:47:27.217

Reputation: 33

Answers

1

Yes, that's pretty much it. Suckless.org provides instructions on applying patches to DWM, and the procedure is pretty simple. I'll add a few more details, though. I'm assuming that you're building dwm from source, since you'll need to do this in order to install patches.

  1. Save the patch somewhere in your source directory, and run git apply pertag.diff.

  2. If the patch added any new files, run git add <name of new file> to add them to the repository. If no new files were added, ignore that. Once you've added any new files, run git commit -a to commit the changes.

  3. Rebuild dwm. If you're building dwm as root, run make clean install from the top folder of dwm's source tree (e.g., if you downloaded the source into /build/dwm, run the command in that folder). It's the folder with the makefile. If you are building/installing dwm as a non-root user, just run make from the source folder.

  4. If you already have your system set up to use dwm, either through installing it as root or building it as a normal user and pointing to your user's copy, you shouldn't have to redo any configuration. Just restart dwm and the patch should be working.


A few more details. Technically, you don't need to commit any changes to the git repository, but I always do this because I maintain my copy of dwm in it's own repository, and pull in patches, developers' changes, etc. into it and merge them when necessary.

Some useful tips:

  1. If you want to see what the patch does before applying it, download it and run git apply --stat pertag.diff. This will show you what files the patch will change.

  2. If you want to test out the patch, apply it using git apply as I described above but don't commit the changes. Test out the changes (restart/rebuild dwm, use the new feature, etc.), then, if you want to roll back the changes, run git apply -R pertag.diff.

John Bensin

Posted 2013-10-12T19:47:27.217

Reputation: 1 355

I'm copying and pasting the this code into a file called pertag.diff and doing git apply but it outputs fatal: corrupt patch at line 181 I am using dwm-6.0 on Ubuntu 12.04 LTS. Is there any sort of fix for this?

– Zachary Alfakir – 2013-10-13T03:15:36.683

@ZacharyAlfakir Where did you download the patch from? The error means exactly what it says; the patch is corrupt, so the file must have an error in it, either because it was designed incorrectly from the start or because you downloaded a corrupted/broken version of the file. – John Bensin – 2013-10-13T03:17:39.520

I copied/pasted from this link

– Zachary Alfakir – 2013-10-13T03:21:15.397

@ZacharyAlfakir Why not just right-click on the link and "Save File As..." (or the equivalent in your web browser)? I suggest you try the dwm mailing list.

– John Bensin – 2013-10-13T04:10:17.720

I have tried other patches and it seems that every patch I try says that the very last line is corrupt. – Zachary Alfakir – 2013-10-13T13:17:30.533

@ZacharyAlfakir Did you ask on the dwm mailing list I linked to? If you ask there, and provide exactly what you did to set up your dwm system, your version number, etc., they may be able to help you. I'm able to apply patches to my dwm installation perfectly fine, so I can't reproduce your problem. – John Bensin – 2013-10-13T14:16:15.367