Xfce Wiki

Sub domains
 

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
contribute:dev:coding:example [2020/08/29 20:07]
alexxcons USe MR on gitlab instead of patches on bz
contribute:dev:coding:example [2022/03/28 11:12] (current)
alexxcons [Building from source]
Line 9: Line 9:
 First things first, Xfce’s modular architecture feature several components, some are part of its core and some are optional apps or panel plugins. Take some time to read their description. You might wonder what the heck is a window manager? or I never heard of freedesktop.org or d-bus, are they edible?. Search for them, I can’t possibly explain everything there is to know about Linux desktops in a single blog post. First things first, Xfce’s modular architecture feature several components, some are part of its core and some are optional apps or panel plugins. Take some time to read their description. You might wonder what the heck is a window manager? or I never heard of freedesktop.org or d-bus, are they edible?. Search for them, I can’t possibly explain everything there is to know about Linux desktops in a single blog post.
  
-In my opinion the best way to get started with code is to scratch your own itch, you know, deal with that annoying bug or a behavior that could be improved. The rule of thumb is to browse Xfce’s Bugzilla and look for that bug or report it in case no one noticed the problem until now. Then go to Xfce’s repository browser, clone the repository for the component you are about to hack, fix the problem and attach patch to the bug report. That’s easy for me to say, isn’t it? I’m going to prove you it is not that hard, let’s go step by step.+In my opinion the best way to get started with code is to scratch your own itch, you know, deal with that annoying bug or a behavior that could be improved. The rule of thumb is to browse Xfce’s GitLab and look for that bug or report it in case no one noticed the problem until now. Then go to Xfce’s repository browser, clone the repository for the component you are about to hack, fix the problem and send merge request. That’s easy for me to say, isn’t it? I’m going to prove you it is not that hard, let’s go step by step.
  
 ===== Building from source ===== ===== Building from source =====
Line 15: Line 15:
 Suppose we are interested in hacking xfce4-appfinder, the first thing we need to do is to build and be able to run that component: Suppose we are interested in hacking xfce4-appfinder, the first thing we need to do is to build and be able to run that component:
  
-<code>git clone git://git.xfce.org/xfce/xfce4-appfinder+<code>git clone https://gitlab.xfce.org/xfce/xfce4-appfinder
 cd xfce4-appfinder cd xfce4-appfinder
 ./autogen.sh --prefix=/usr --enable-debug ./autogen.sh --prefix=/usr --enable-debug
Line 39: Line 39:
 Now to make things interesting let’s fix a bug, but this time I need you to clone and build [[https://git.xfce.org/apps/mousepad/|Mousepad]], Xfce’s text editor. The steps are very much the same, except that Mousepad does not run in background which makes things easier. Go on, clone and build it. Hopefully you have successfully built Mousepad by now, if not read carefully error messages spilled on the terminal, if you can’t figure them out searching those messages on the web could be helpful. If you tried really hard and nothing worked, ask for guidance at #xfce-dev, stay online and be patient, try one more time if no one replies after one day. Now to make things interesting let’s fix a bug, but this time I need you to clone and build [[https://git.xfce.org/apps/mousepad/|Mousepad]], Xfce’s text editor. The steps are very much the same, except that Mousepad does not run in background which makes things easier. Go on, clone and build it. Hopefully you have successfully built Mousepad by now, if not read carefully error messages spilled on the terminal, if you can’t figure them out searching those messages on the web could be helpful. If you tried really hard and nothing worked, ask for guidance at #xfce-dev, stay online and be patient, try one more time if no one replies after one day.
  
-Now you are able to execute Mousepad with ''mousepad/mousepad'' from the source folder, we are ready to smash a real bug. Obviously I wouldn’t be so reckless to let a bug live just for beginners fix it and never push the fix, the bug I have in mind was fixed centuries ago (2014), actually it was one of my first contributed patches. With the magic of git, we can travel back to mousepad-0.3.0 (gtk2!) and smash that bug once again. Before we go back, clean the source folder with ''make distclean'', now you are good to run ''git checkout mousepad-0.3.0''. Git will complain that “you are in ‘detached HEAD’ state”, you might know what that means, otherwise ignore it for now and remember to learn git later, because you know, having a detached head is not comfortable at all ;)+Now you are able to execute Mousepad with ''mousepad/mousepad'' from the source folder, we are ready to smash a real bug. Obviously I wouldn’t be so reckless to let a bug live just for beginners fix it and never push the fix, the bug I have in mind was fixed centuries ago (2014), actually it was one of my first contributed patches (when merge requests weren't a thing yet). With the magic of git, we can travel back to mousepad-0.3.0 (gtk2!) and smash that bug once again. Before we go back, clean the source folder with ''make distclean'', now you are good to run ''git checkout mousepad-0.3.0''. Git will complain that “you are in ‘detached HEAD’ state”, you might know what that means, otherwise ignore it for now and remember to learn git later, because you know, having a detached head is not comfortable at all ;)
  
 Once again configure and build Mousepad (''./autogen.sh && make'') and fix the bug… Oh, but I haven’t even told what is broken :) Allow me: execute Mousepad, type “hello world”, save the file somewhere and close Mousepad. Now run Mousepad again and open that file, type some gibberish and choose File -> Revert, it will ask for confirmation, press “Revert” and it says it failed to revert even though it worked. Weird, isn’t it? Once again configure and build Mousepad (''./autogen.sh && make'') and fix the bug… Oh, but I haven’t even told what is broken :) Allow me: execute Mousepad, type “hello world”, save the file somewhere and close Mousepad. Now run Mousepad again and open that file, type some gibberish and choose File -> Revert, it will ask for confirmation, press “Revert” and it says it failed to revert even though it worked. Weird, isn’t it?
Line 53: Line 53:
 === Sharing Code === === Sharing Code ===
  
-Now you know how to build components and smash bugs, browse [[https://gitlab.xfce.org/|the isssues reported on Gitlab]] and try to fix something that looks easy. If you have an idea on how to fix or some code that seems to work but you are not so sure, don’t be afraid to ask at #xfce-dev. Once you have a good enough solution, follow [[https://docs.xfce.org/contribute/dev/git/start#gitlab_forks_and_merge_requests|these steps]] in order to create a merge request. Wait a few days, if you get no answer, poke us at #xfce-dev or use the Xfce4-dev mailing list. After some merge requests, you may [[https://docs.xfce.org/contribute/dev/get-a-contributor-account|ask commit rights]] and join the dev club, yay!+Now you know how to build components and smash bugs, browse [[https://gitlab.xfce.org/|the isssues reported on Gitlab]] and try to fix something that looks easy. If you have an idea on how to fix some code that seems to work but you are not so sure, don’t be afraid to ask at #xfce-dev. Once you have a good enough solution, follow [[https://docs.xfce.org/contribute/dev/git/start#gitlab_forks_and_merge_requests|these steps]] in order to create a merge request. Wait a few days, if you get no answer, poke us at #xfce-dev or use the Xfce4-dev mailing list. After some merge requests, you may [[https://docs.xfce.org/contribute/dev/get-a-contributor-account|ask commit rights]] and join the dev club, yay!
  
 This page is just an extract of AndreLDM's blog. You may want to read the full [[https://andreldm.com/2018/12/03/xfce-contributor-guide.html|Ultimate Contributor's Guide to Xfce]]. This page is just an extract of AndreLDM's blog. You may want to read the full [[https://andreldm.com/2018/12/03/xfce-contributor-guide.html|Ultimate Contributor's Guide to Xfce]].