Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

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.

share|improve this answer
    
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 Oct 13 '13 at 3:15
    
@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 Oct 13 '13 at 3:17
    
I copied/pasted from this link –  Zachary Alfakir Oct 13 '13 at 3:21
    
@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 Oct 13 '13 at 4:10
    
I have tried other patches and it seems that every patch I try says that the very last line is corrupt. –  Zachary Alfakir Oct 13 '13 at 13:17
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.