How to develop desktop app with UI for linux Mint?

About programming and getting involved with Linux Mint development
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
HardRock
Level 1
Level 1
Posts: 4
Joined: Fri Jun 25, 2021 7:22 am

How to develop desktop app with UI for linux Mint?

Post by HardRock »

Hello, help me please understand where should I start?

I have an experience in web development and desktop development with c# for windows.

I want to port one of my project from windows to Linux.
It is desktop application that interacting with system and using windows user32.dll API.

Should I use java on linux for UI and main app logic or is there other better options?
What is usually used for applications with GUI for linux?

I looked in c# .net core, but it seems to be far from best solution.
Electron looks interesting but I am not sure if it is capable of interacting with system, for example get list of opened applications, see their titles etc.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: How to develop desktop app with UI for linux Mint?

Post by rene »

C# or more to the point, .NET, is a not a great choice on Linux indeed nor would, I say, any of the others you name be. Generally really, but certainly specifically on Mint I would advise Python and in this case with the GTK framework.

Python can be approximately as OOP as you want it to be so could presumably work for a relatively straightforward port of your C# code. It's easy to get started with Python and GTK: https://python-gtk-3-tutorial.readthedo ... ction.html. Of course, if you'd first want/need more general Python exposure you'd first use a more general Python source.

Qt might by the way in essence be the better and certainly more Windows-y GUI framework and its Python binding (it's natively C++) is these days also very first-class; https://www.qt.io/qt-for-python. Many of Mint's own apps are Python/GTK though so specifically here that would fit better.
HardRock
Level 1
Level 1
Posts: 4
Joined: Fri Jun 25, 2021 7:22 am

Re: How to develop desktop app with UI for linux Mint?

Post by HardRock »

Thank you, I find out that GTK could be used with javascript, it might be a thing for a start, but it also could mean that it is time to learn Python :)

There is now other common options for linux except c++ and java ?
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: How to develop desktop app with UI for linux Mint?

Post by rene »

Java is not really common on Linux and certainly not anymore; many distributions don't even out of the box install a JRE anymore. Java is still going strong-ish really only in the larger web-backend sphere and even there it's being replaced by Python.

JavaScript is not common for "real" applications. There's definitely a few examples using e.g. Elektron as you mentioned, but by and large JavaScript is and remains a web-scripting language. The GNOME and Cinnamon shell can be interfaced with directly from JavaScript -- but frankly this has by and large been considered a mistake to begin with by many...

The still by far most common language on Linux is plain old C; it can be said to be the native programming language on any form of UNIX because/and was originally the result of the development of UNIX. If you e.g. type man open into a terminal for the documentation of the kernel interface ("syscall") open() you are presented said documentation in a C context.

C++ is most certainly used and definitely in the Qt and full-blown KDE sections of the Linux-scape but has frankly also never really been a first-class citizen on Linux. That though at a level where one could decide to not care: C++ is a sensible choice for application-development -- and personally I'm of the opinion that in any case an object-oriented oriented language is a better choice for GUI-programming than mucking about with pre-processor boilerplate as in C/GTK (even if said opinion does not seem to translate to me in fact using C++/Qt).

Rust has been gaining in popularity fast and is the really only language that might eventually stand a chance of supplanting C. GUI-toolkit bindings are starting to be first-class.

However and as said, it's been for some time now that Python can be considered the best choice. It's quite mature -- as to the Python 2/3 differences that still plague web-based documentation to this day a bit too mature even... -- and has an enormously wide-reaching set of modules/packages available out there, many of them high quality. GUI bindings are very mature, you can easily interface/extend it with C or any other code, and it comfortably adjusts itself to either procedural or object-orientation.

Specifically on Mint and to take Mint's Update Manager as one of its most important/defining applications as an example: see /usr/lib/linuxmint/mintUpdate/mintUpdate.py: Python/GTK as most Mint-specific tools; if nothing else, makes for nice example code. So unless you'd actually go down to C (and with a reason for such) I find Python to be really the only language worth suggesting; on current-day Linux but doubly so on current-day Linux Mint.
HardRock
Level 1
Level 1
Posts: 4
Joined: Fri Jun 25, 2021 7:22 am

Re: How to develop desktop app with UI for linux Mint?

Post by HardRock »

Thank you for such informative and detailed answer :D
I will try Python with GTK )
User avatar
Drugwash
Level 5
Level 5
Posts: 733
Joined: Fri Jun 07, 2019 6:40 am
Location: Ploieşti, RO
Contact:

Re: How to develop desktop app with UI for linux Mint?

Post by Drugwash »

You can use Glade to build the GUI if it's too complex to be built manually. You'd only have to connect the widgets signals to their respective callbacks.
Axel358
Level 1
Level 1
Posts: 34
Joined: Sun Oct 11, 2020 3:24 pm
Location: Cuba

Re: How to develop desktop app with UI for linux Mint?

Post by Axel358 »

I don't know know how common Vala is on Mint but i find it quite nice, it compiles to C and has a syntax similar to Java/C#. There are some cool GTK apps written on it out there
User avatar
Termy
Level 12
Level 12
Posts: 4248
Joined: Mon Sep 04, 2017 8:49 pm
Location: UK
Contact:

Re: How to develop desktop app with UI for linux Mint?

Post by Termy »

If you're looking for lower-level stuff, you can of course use GTK with C, and presumably other GUI toolkits, but your best bet is GTK or Qt. GTK is very well documented and often used with C, which isn't too surprising, as it's written in C. GTK is a cross-platform toolkit, so it'll probably help you in your Windows environments. If it's higher level languages you want, and for more general purposes, I recommend Python; it's going to be a HUGE time-saver, more reliable, easier, and more accessible by other developers. Python seems to be the foremost language used with Linux Mint's own GUI programs, so that's a good place to start, if you want to help them out.

I don't like Python, personally, as I prefer PERL, but I admit it's a pain to find good PERL documentation for GTK, plus I can't stand GUI development in general — I'm more of a terminal fan, hence I write programs for terminals. I'm not a low-level programmer, and have only dabbled with low-languages, so I'm not very good at translating GTK's C documentation, unfortunately. PERL is obviously getting on a bit, but it's still a perfectly valid language, and, contrary to popular uninformed belief, it's not dead. I think Python for sure will be your best bet, unless you wanna utilize your C# knowledge. Of course, C# is not C or C++, but there are many similarities. Linux Mint does have a history of using PERL scripts, possibly even some GUI-based ones.

For portability, I recommend GTK 3. 4 seems too new right now, and not many distributions are yet adopting it, AFAIK, but hopefully someone else can confirm this, as I'm a little out of the Linux loop, these days.

You might want to get into Rust. I believe it has GTK support, as most languages do. Rust is a big thing, these days, and it seems really good. You probably know about Rust, though. I spent a few days learning about Rust, and I must admit I was generally impressed. I hate some of the syntax and approaches, an opinion which seems shared among others, but it seems very promising.

I would avoid Electron, because it's infamous in Linux (at least) for being slow as HECK. With your web development background, however, it might be something to play with to get your foot in the door, or maybe you'd have a lot of success with it.
I'm also Terminalforlife on GitHub.
JosephM
Level 6
Level 6
Posts: 1459
Joined: Sun May 26, 2013 6:25 pm

Re: How to develop desktop app with UI for linux Mint?

Post by JosephM »

Axel358 wrote: Sun Aug 07, 2022 12:41 pm I don't know know how common Vala is on Mint but i find it quite nice, it compiles to C and has a syntax similar to Java/C#. There are some cool GTK apps written on it out there
Off the top of my head, slick-greeter is the only thing I know of that is using Vala on Mint. I've messed with it some and it probably would be quite comfortable for you coming from C#. It don't think it gets a lot of development anymore but you can find some good examples of using it with Gtk on the elementaryOS repo. It's the main language they use. I'm also pretty sure there is a good "Getting started" floating around somewhere on the web for gtk/vala.
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.
User avatar
AndyMH
Level 21
Level 21
Posts: 13728
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: How to develop desktop app with UI for linux Mint?

Post by AndyMH »

Termy wrote: Sun Aug 07, 2022 12:48 pm I don't like Python
Likewise, to quote from a friend:
A language that marks the end of a logic construct such as an IF or LOOP by how many spaces the lines are indented? Give me a break.
So I would probably suggest C++ and with QT, I believe the toolkits for QT are easier to use than GTK (QT creator)?

I'm an oddball, I like pascal and develop applications using the lazarus IDE (cross platform). For windows, delphi would be the professional choice - not cheap. Easy to construct GUI applications, fully OOP. Major downside - GTK2 in linux, GTK3 has been coming 'real soon now' for years, but you can use QT.

I developed foxclone in pascal, I'm not the only one:
https://www.quora.com/What-are-some-pop ... -in-Pascal
but you will be in a minority.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
User avatar
Termy
Level 12
Level 12
Posts: 4248
Joined: Mon Sep 04, 2017 8:49 pm
Location: UK
Contact:

Re: How to develop desktop app with UI for linux Mint?

Post by Termy »

AndyMH wrote: Mon Aug 08, 2022 10:12 am [...]
Surprisingly, that's not why I don't like the language. I kind of like the formatting rules of Python, because it improves the chances of reading halfway sane code, unlike some of the mess I've seen in BASH and the like!

I don't like object-oriented programming, so I tend to avoid it, unless I'm doing certain things in PERL. Sometimes when I look at Python — which isn't often, admittedly — I do get uncomfortable trying to figure out the ends of nested statements and loops. I've dabbled with Python, but everything seems far too focused on OO, for my liking, which is why I probably won't bother with Raku (formerly PERL 6).
I'm also Terminalforlife on GitHub.
User avatar
AndyMH
Level 21
Level 21
Posts: 13728
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: How to develop desktop app with UI for linux Mint?

Post by AndyMH »

Back in the day when I first started programming (enthusiastic amateur) everything was procedural. For years I could not get my head around OOP, my brain would just not understand it. Then it suddenly clicked one night, I understood. For anything substantial I wouldn't consider anything else.

Back on the subject of GUI apps, for bash scripts you can use zenity or yad for a user interface.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
User avatar
Termy
Level 12
Level 12
Posts: 4248
Joined: Mon Sep 04, 2017 8:49 pm
Location: UK
Contact:

Re: How to develop desktop app with UI for linux Mint?

Post by Termy »

Another thing I forgot to mention, is that there's also Tk, but it's poorly implemented in Linux, due to theming.

To rephrase: Tk is very basic, incredibly old, and doesn't respect the user's theming. Tk seems to look alright-ish in Windows (last I looked), but that's about it, AFAIK. In any case, it's a good introduction. I remember my first GUI development fumble was Tk in Python, then I later tried Tk in PERL, only to have some success with GTK in PERL — still can't stand any of it, though. :lol:
AndyMH wrote: Tue Aug 09, 2022 9:29 am [...]
Yeah, it took me a long time to wrap my head around OOP, too; I blame my years with Shell, which was my first proper foray into programming.

I recommend Zenity and YAD too, but they can be a real nuisance, IMO, especially due to their limitations.
I'm also Terminalforlife on GitHub.
wittend
Level 1
Level 1
Posts: 13
Joined: Mon Aug 11, 2014 8:07 pm

Re: How to develop desktop app with UI for linux Mint?

Post by wittend »

As you can see, no two developers will ever give you the same answer.

I do a lot of user-facing development, and I use a variety of tools.
Cross-platform and true open source are my guiding objectives. For anything beyond one-off scripts, single platform code is just stupid.

I work exclusively on Linux/Unix, but my target users are almost all on other platforms.
Python and C++ are important tools for me, and I have always had reliable results using WxWidgets. It is very similar to QT. But in my opinion QT will never again be true cross-platform open source. WxWidgets is.
Many tools exist for either of these languages. I use Codelite/WxCrafter for C++. It is a very well maintained and supported IDE/Interface generator.
I use either VS Code + WxCrafter or wxGlade for Python.

I haven''t used Electron, but these days I'm seeing a lot nice stuff built this way.
I have used something (not too well known) called nw.js very successfully for cross platform Javascript (node.js)/Chrome UI's. It is an antecedent to Electron and has a much more node.js feel. I like it a lot and but it does not have a big following.

For my taste Python is a bit cumbersome but I'm interested in the newest optimizations (currently in 3.11 and above, I believe). It has a monstrous code base and many, many solutions. I have been using Python since about v 0.9, about when Guido was writing his master's thesis.

In theoretical terms, I really believe in using cross-platform Web UI rendering rather than using native api's directly - everything is so fast these days. But that is not always practical or expeditious. But when it comes to executing 'big code' there is only C/C++ under the hood for me. And eventually Rust, I suppose. But I think Rust came along a bit too late for me.

-- dave
Locked

Return to “Programming & Development”