Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Amir Mullagaliev
Amir Mullagaliev

Posted on • Edited on

     

Open-Source Development is Amazing!

Table of Contents

Introduction

This blog post is aboutRelease 0.3. I would like to start with a little introduction, explaining how hard was to find a good issue. For the lastRelease 0.2 I had spent all my time on hugeJavaFX project, I wasn't satisfied at all, for the reason that I had to find and close two issues within days. This time I was almost caught by the same problem, but by the end I served it as good as I could. Let me walk you through the time-line.

First Bad Issue

At the beginning, I have found anissue, where I was supposed to moveApp Icon fromDock toTray formacOS users. It sounds really simple. However,project is written inGo which I had never used before. If you are a reader that is familiar with my blogs, you definitely know how often I learn new programming-languages. Going forward, I decided to learnGo lang from scratch.

Let me quickly explain what's this project about. This isSimple, free and efficient ad-blocker and privacy guard for Windows, macOS and Linux.

systray - First Attempt

Fortunately,Go is really simple to learn, so let's proceed to my attempts moving the icon fromDock toTray.

For the first attempt I tried to implement usingsystray library that is written inObjective-C. It helps manipulate the macOS system UI and move application fromDock toTray. I've written the code, using documentation within 2 hours, was so happy. However, I've got an issue related to the other library calledwails which helps implement UI also written inObjective-C. Eventually, building the project failed, for the reason that these two libraries conflict because they use the same namings. I had to move forward and try different library/method.

trayhost - Second Attempt

Basically, this library works the same way assystray, and I had the same issue.

Any other library to do this works the same way, so I was stacked.

How I tried to fix it?

I forkedsystray project and changed the naming that caused the conflict. Imported my fork, asGo allows to import directly using git-url.
Unfortunately, it didn't work at all...

You may check my fork and see the changes:Click me :D

Objective-C - Third Attempt

This time I tried to write my code, usingObjective-C andGo lang. After some time, I came up with the solution, but I got this error:

r0      0x0r1      0x0r2      0x0r3      0x0r4      0x18fef62cbr5      0x16d28db00r6      0x6er7      0x0r8      0x1e844b5b5be91e5ar9      0x1e844b5a36c1ee5ar10     0x200r11     0xbr12     0x0r13     0x1ff800r14     0x7fbr15     0xd3c1205ar16     0x148r17     0x202129928r18     0x0r19     0x6r20     0x16d28f000r21     0x1003r22     0x16d28f0e0r23     0x2r24     0x0r25     0x16d28ecc0r26     0x1f9a37000r27     0x828r28     0x140001021c0r29     0x16d28da70lr      0x18ff3ac20sp      0x16d28da50pc      0x18ff02a60fault   0x18ff02a60
Enter fullscreen modeExit fullscreen mode

The error message indicates that you are attempting to initialize an NSWindow instance outside the main thread, which is not allowed in macOS applications. It was a huge problem, as I couldn't do it in the main thread, for the reason the rest of functionality wouldn't work.

Conclusion ofFirst Bad Issue

Maintainer and I had a small talk where I'd been explaining everything. Eventually, he agreed that is impossible to implement with current project structure... I didn't finish it, and don't have PR :c

Help Each Other!

Open-source community is brilliant because people tend to help each other. I had only a week to finish, so I asked my friendTheo for help. He sent me couple of the repos that he worked on, and I decided to work on them.

MatterMost

MatterMost is an open source platform for secure collaboration across the entire software development lifecycle. It's pretty popular platform and has tons of issues, huge documentation as for users as for developers. It wasn't hard to contribute to this project.

Issue

This time I have taken something that matches my current skill level, and I don't shoot my foot. It was simpleissue found in early mentionedmattermost.

Purpose of The Issue

The purpose of that issue is to fix linter errors for one of the files. I set up the project, and started working on it.

First thing first, I had to run linter and see all the errors. I checked the lines where it occurred, and fixed them all pretty quickly. Eventually, opened aPR.

Back To CLI

I really liked working on CLI tools because it's fun to me. For the secondPR I found a project calledlumen.Lumen isan instant AI Git Commit message, Git changes summary from the CLI. I really enjoyed working on this project! Unfortunately, the don't have that many issues, but I was lucky enough to get assigned. In addition, this tool is written inRust, so I had to refresh my knowledge.

Issue Description

I found an issueAdd STDIN support for explain command.

What does it mean?

This tool has an optionexplain which is invoked this way:

lumen explain <sha>
Enter fullscreen modeExit fullscreen mode

This command explains everything about certain commit, what it changed and why. Example:

Explain DEMO

Pretty useful tool, huh?

My implementation should allow to add functionality to this command:

echo"HEAD" | lumen explain -
Enter fullscreen modeExit fullscreen mode

So it takesSTDIN value from echo, in my exampleHEAD, and replaces- with thatHEAD value.

Implementation

I realized how to implement it. Created condition to check if- instead ofsha.

ifsha=="-"{// Pass `-` as an indicator to read from stdinGitEntity::Commit(Commit::new_from_stdin()?)}else{GitEntity::Commit(Commit::new(sha)?)}
Enter fullscreen modeExit fullscreen mode

Result

After changing 5 files, I came up with the result:

Image description

Now it has two options:

lumen explain <sha>
Enter fullscreen modeExit fullscreen mode

and

echo"<sha>" | lumen explain -
Enter fullscreen modeExit fullscreen mode

Both of these options are working, my implementation added new functionality, and saved previously implemented! Here's myPR.

Conclusion

Last couple of weeks weren't simple, but was fun. I learnt new languageGo. Connected withOpen-Source community which helped me to find one of the repos that I contributed to!

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Seneca Computer Programming & Analysis student
  • Location
    Ontario, Toronto
  • Joined

More fromAmir Mullagaliev

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp