[Solved] Development with an eye towards making a Mint utility

About programming and getting involved with Linux Mint development
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Post Reply
EdInPa
Level 1
Level 1
Posts: 21
Joined: Fri Jan 08, 2021 2:27 pm

[Solved] Development with an eye towards making a Mint utility

Post by EdInPa »

I've got some questions related to how best to approach a utility program that I would do as a hobby project, but which I'd like to do carefully enough that it would be of suitable quality to be used more broadly, integrating nicely with Linux Mint, and perhaps (aspirationally!) become a component of the system. So understand: I am not looking for anyone on the Mint side to approve my doing this; I will do it anyway, but I'd like to have a go at making something of a much higher quality than my previous hobby projects have been. That being said, I do think its functionality would address a gap in Mint, but perhaps of only marginal value. I intend to use an existing Mint project's structure as a model / framework.

What it is specifically doesn't matter right now. It will provide graphical settings to update configuration files and will have some service control functionality. Part settings and part operational control and status display. The service itself is provided by an existing package, but it doesn't have a friendly UI.

1) Python or Vala? Is Vala the future direction for Mint? is it worth learning? I'm no expert but using python would be much easier... C or C++ are right out.

2) User interface. GTK, obviously. My previous GTK projects have hand-coded the UIs, for two reasons: Glade was hard to wrangle, and I was more comfortable with the model of UI objects in wxFormBuilder than those instantiated with GTK's builder. Are hand-coded UIs seen as unmaintainable? It's hard to imagine they would be worse than directly editing voluminous and verbose XML, yet I've only seen UI files in the Mint repos. Some of the UI will be dynamic (data driven, not pre-defined at coding time.)

3) Xapp. If my program doesn't use any of the desktop integrations in the xapp library, it sort of doesn't need to be an xapp, right? Can I call it an xapp (since it works across the different desktops)? Is there anything that makes it an xapp besides using one of those specific integrations from that particular library?

4) Xapp. I read the Mint developer guide section on xapps, and it still eludes me exactly how to create a python xapp. Exactly how should my python environment or code be set up? Missing something obvious, I'm sure.

Enlightenment appreciated!
Last edited by EdInPa on Thu Mar 21, 2024 12:59 pm, edited 1 time in total.
User avatar
xenopeek
Level 25
Level 25
Posts: 29615
Joined: Wed Jul 06, 2011 3:58 am

Re: Development with an eye towards making a Mint utility

Post by xenopeek »

1) If the choice is between Python and Vala I'd go with Python for a utility program. Most of the Mint tools and utilities are written in Python — Software Manager, Update Manager, File Renamer, Hypnotix, Jargonaut, Notes, Warpinator and so on. So many contributors have experience with Python. Cinnamon, Nemo and the Xapps are mostly C with some JavaScript. Only the Slick Greeter and Timeshift are written in Vala.

2) Use GTK 3. Glade is used by the Linux Mint developers but beyond that I don't know for this question.

3) I don't think you should call it an Xapp until it officially becomes part of the Xapps project, and yes then it should be using the Xapp library. I checked Jargonaut, the newest Xapp (under heavy development), and all it uses from the Xapp library right now is DarkModeManager and StatusIcon which may make sense for your app as well:
https://github.com/linuxmint/jargonaut/ ... aut.py#L76
https://github.com/linuxmint/jargonaut/ ... ut.py#L111

4) IDK either but you can check how Jargonaut does it; https://github.com/search?q=repo%3Alinu ... &type=code. Looks to be as short as:

Code: Select all

import gi
gi.require_version('XApp', '1.0')
from gi.repository import XApp
And add the gir1.2-xapp-1.0 dependency to the debian/control file.

General tip: use the meson build system as it's less of a headache than makefiles.
Image
JosephM
Level 6
Level 6
Posts: 1463
Joined: Sun May 26, 2013 6:25 pm

Re: Development with an eye towards making a Mint utility

Post by JosephM »

For 2) hand coding or using Glade doesn't really matter. Glade is mostly used as a convenience and is not necessary.
When I give opinions, they are my own. Not necessarily those of any other Linux Mint developer or the Linux Mint project as a whole.
EdInPa
Level 1
Level 1
Posts: 21
Joined: Fri Jan 08, 2021 2:27 pm

Re: Development with an eye towards making a Mint utility

Post by EdInPa »

JosephM, I conflated two concerns in my question, and I apologize for that.

Builder vs subclass: builder loads the UI data (created with Glade or alternative) into a builder UI object. The model that WxFormBuilder uses is to make a direct subclass of Window (or the like) and you sub-class that to add event procedures. The latter seems more intuitive to me than working with a builder object. (Perhaps that's because I started doing UIs with WxFormBuilder.) The latter approach also rules out working with Glade, and forces direct coding of the GTK calls that create the UI. (WxFormBuilder actually does make a project file (like a UI file), which is what it reads back in, but it generates the target code from it itself rather than relying on the application to process it at runtime.)

Hand coding vs Glade: To read the internet, Glade has had one foot on the banana peel for years, even though few satisfactory alternatives have arisen. Many seem to insist that hand-entering the XML of the UI file is the best we can do. Perhaps with GTK4 that's the case.

So the options:
- Create the user interface programmatically (the non-builder option) by writing UI creation code. This is what I was wondering if it was seen as unmaintainable, or unacceptable to the Mint development community.
- Create the user interface using a UI file, with the UI file created by directly typing XML.
- Create the user interface using a UI file, which I would create with Glade.
(Assuming I didn't go too far afield, a manually created UI file might be open-able by another developer in Glade, facilitating future maintenance.)

Mint tools all seem to have UI files, but I can't tell if Glade is used to create them, so perhaps that's part the answer to my question...
User avatar
xenopeek
Level 25
Level 25
Posts: 29615
Joined: Wed Jul 06, 2011 3:58 am

Re: Development with an eye towards making a Mint utility

Post by xenopeek »

EdInPa wrote: Tue Mar 12, 2024 8:33 am Mint tools all seem to have UI files, but I can't tell if Glade is used to create them
You can. If you open a UI file at the top it says it was generated with Glade. For Update Manager for example here https://github.com/linuxmint/mintupdate ... te/main.ui:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
  […]
I haven't found a UI file that doesn't say it was made with Glade.

I'm not a UI programmer so I'll butt out on answering what is maintainable or not.
Image
dave0808
Level 5
Level 5
Posts: 987
Joined: Sat May 16, 2015 1:02 pm

Re: Development with an eye towards making a Mint utility

Post by dave0808 »

I think that to learn the language and the various libraries it's better to code it all up manually. Maybe it's just me, but I get a better feel for the language by actually using it, even if it's long-winded and not the way I would do things later.

Longer term, for bigger projects, and ease of maintenance, a GUI builder can save a lot of time. Especially a good one. To be able to see the effect of changing a property immediately just lends itself to a more rapid development cycle.

I would not use XML if I had to edit it by hand. There's absolutely no advantage to be gained by it.

Given that the Mint developers use Glade for most (if not all) of the Python apps, then to me that would suggest the best way to do it for any other potential Mint application, even if you go the manual route initially.
EdInPa
Level 1
Level 1
Posts: 21
Joined: Fri Jan 08, 2021 2:27 pm

Re: Development with an eye towards making a Mint utility

Post by EdInPa »

Thanks, xenopeek, my eye passed right over that line! Doh!
JosephM
Level 6
Level 6
Posts: 1463
Joined: Sun May 26, 2013 6:25 pm

Re: Development with an eye towards making a Mint utility

Post by JosephM »

I would go with write the interface programmatically or use Glade. Either of those options should be fine. Glade really is just about convenience.
When I give opinions, they are my own. Not necessarily those of any other Linux Mint developer or the Linux Mint project as a whole.
dave0808
Level 5
Level 5
Posts: 987
Joined: Sat May 16, 2015 1:02 pm

Re: Development with an eye towards making a Mint utility

Post by dave0808 »

I've not used Glade so was looking into it a little more. A lot of links are now dead, and the Gnome project page states that Glade is no longer maintained. So this may be a factor for the OP when considering future projects.
EdInPa
Level 1
Level 1
Posts: 21
Joined: Fri Jan 08, 2021 2:27 pm

Re: Development with an eye towards making a Mint utility

Post by EdInPa »

Thank you all for your thoughts. Glade and python it is!
Post Reply

Return to “Programming & Development”