Gamjectfolder, a first Gtk-Gnome app (from bash to flatpak)

A couple of years ago, back in 2016, actually soon it will be three years, I decided to start trying to make games using Open Source software on Linux. Now, in 2019, I have released two games, ARO and Roiny Froity. And while making ARO, the first one, I created folder structures again and again, for prototype, alpha, beta… Always the same task. Make a folder, then subfolders for this and that whatever, needed a folder for this and another for that… I ended up creating a bash script to just call the script and create the folders for me. Learned how to make that simple bash script and there it was, I could make the folder structure by typing a single command in the terminal:

Early bash scripts
Folder Automation script crop

Not happy enough, I thought I would be better with a simple app that would do the job without needing to use the Terminal, but never started that task until I met Godot. Playing around with Godot Layout system, it seemed somewhat familiar with what I had seen in Glade. Never had used Glade before, just played around with the widgets, but never had gone farther from open Glade, play with widgets and close Glade. Godot Layout system looks a bit alike the Gtk Layout system, so after playing around with Godot and making a simple Game Menu Scene with its layout system I thought I could try to make a simple GTK app designing the interface with Glade.

So which language to choose? Using Unity3d for those two first games, I had learnt a bit of C#, not enough though, I still have a lot of C# to learn, though C# seemed not so convenient for app development targeting Gtk. Therefore, I had to find a programming language, easy enough to learn fast, and with some degree of good Gtk integration. I chose Python.

Why Python? Well, Godot’s GDScript is a bit Pythonesque, so it seemed a good way to get into GTK app development and also into Godot GDScript game development. It seemed like killing two birds with one stone.

I started the development with VSCode as it was the “IDE” I had been using in tandem with Unity3d, and found familiar with. Designed the interface in Glade, and started the coding in VSCode:

Early development of Gamjectfolder with Python on VSCode

Once I got the thing working locally, I had to think how to distribute it. For running locally, just call python3 from terminal and passing the gamjectfolder.py file was enough:

Early Gamjectfolder running from Terminal inside VSCode

Yep, looks good… Now what? How to distribute it? .deb? .rpm? .snap? .flatpak? .tar.gz? …. way too many options, way too few time. That is why I decided to pick Flatpak, only one, just one. I don’t have time to learn how to pack in each and every distribution package format, neither I have time to keep updating each package for each distro every time I update the project. Being Gamjectfolder a simple project I was thinking about all the hassle were the project bigger.

I decided to go the Flatpak way because, first, I tried some Flatpak apps as well as some Snaps, and Snaps are so slow to launch that I can make myself a coffee or whatever while waiting for the software to show the window. No way. And second, Gnome Builder also integrates Flatpak package generation in an “easy” way.

So there I was, installing Builder, and testing once and again, and again, and again… a default Gnome-Python-GPL licensed with version control.. blah, blah, blah, blah… project. I did it so many times I lost count:

Gnome-builder new project setup. I repeated this a lot

All that, to end up with this:

First time I saw that I told myself, where are you getting into, at your age! … Are you damn nuts?!

All those, default files that Gnome-Builder creates when creating a new Python project. Nothing similar, by no means to what I had in VSCode. Lost again, not in translation though. But I had absolutely NO idea what all that meant. No word about Github yet either. If learning Python was a task, learning GTK signals, widgets, layout was another, then the new files that populated the project left me wondering if I would ever be able to release Gamjectfolder as any kind of package, whatever that would be.

Searching, searching, googling, googling, trying to find tutorials, checking out all those files, what needed, what not I ended up with this:

Gamjectfolder files inside Gnome-Builder

I still have now Idea on how to properly deal with Meson, though I got a hint reading the docs (cloned some Gnome repo to check files) and Q&A others already posted everywhere. And finally I could make some sort of “good looking” result out of that. I think it took me longer to get the project running in Gnome-Builder than in VSCode, as had to deal with all the XML, JSON, meson.build, IN files. Spent lots of time with them, though finally, I was able to get a Flatpak. It is “straightforward” from Gnome-Builder, straightforward once I knew how to straightforward the process, and just for this simple app. A bigger project will be a different song to be sung.

Gamjectfolder flatpaks v0.1.0 and v0.2.0, this one without version number in the name

No translation available; I did not dig into that one for this project, just left everything there as Gnome-Builder put it. That task is to be faced when I have better understanding on the others.

Then, I had another “brilliant” idea… why not release the source code through GitHub? That way, maybe someone can use it, modify to their needs, do whatever they want with it….

gamjectfolder GitHub repo

But, as with all related with Gamjectfolder, I also had NO idea on how to use GitHub. Yep, making a repo is easy, just click “New” green button at the top right in the repository list. After that… pffffff… What I did was just upload all project files to that GitHub repo, and done. Not quite, when doing so, I don’t know why, GitHub changed file permissions, and when I cloned the repo from another computer, and bring it up into Gnome Builder, nothing worked. No Run, no Build, no nothing. This is something I still have to check and solve. And, of course, I’m still learning the commit, push, pull.. thing, which means that there is still a lot to learn. A LOT!.

I think I could have done the whole process just with bash scripting, using the Terminal, but doing this was fun. Gamjectfolder is a simple tool I needed that was not available, at least not that I know. So just made it, and made it available to all, in case some one can get some use out of it. That would be nice.

I have to thank the people from IRC at #flatpak and #gnome-builder for pointing out the good directions when I asked, also all the websites I traveled through searching for the right answer (a right answer, there are plenty right ones in many cases).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s