6 ms·
Writing Tiny Desktop Apps in C and GTK3 (2022)
- nopelynopington 2y agoNice post but the images don't load for me
- pjmlp 2y agoYep they are broken for me as well.
- hk1337 2y agoIt appears to be using some sort of encrypted file uploading service that has gone offline. https://github.com/petabyt/eggnog https://github.com/petabyt/eggnog https://eggnog.theres.life https://eggnog.theres.life
- ranger_danger 2y agoFWIW I wouldn't call XOR... encryption
- stcg 2y ago"XOR" as encryption probably refers to one-time-pad encryption, which is a very secure encryption strategy if done well, albeit often impractical. (Note: I'm not saying anything about this specific code, which I have not looked at) https://en.m.wikipedia.org/wiki/One-time_pad https://en.m.wikipedia.org/wiki/One-time_pad
- plowjockey 2y agoTrivial examples of Gtk+ apps seem to be legion but to find a decent tutorial that works its way through a moderately complex and usable app seem to be scarce. In particular I haven't found a decent example of using the GTKBuilder class and complete documentation of the XML properties seems almost nonexistent. Aside from that, instead of writing a GNOME app in C, isn't Vala or GJS the preferred language now?
- imtringued 2y agoI wanted to try and follow this blog, but write the app in Vala and I haven't figured out how to use gtk4 with meson yet. I personally want to build a nautilus extension, but that seems very far off considering the sorry state of their documentation.
- l72 2y agoI have written an app in Vala + gtk4, using meson + ninja as the build system. It is pretty straight forward. https://github.com/line72/campcounselor/ https://github.com/line72/campcounselor/
- senkora 2y agoGObjectIntrospection is very good, so GTK has usable bindings to essentially every language. I would recommend looking at the GNOME apps and picking one that is written in the language that you want to use.
- ryandrake 2y ago> Trivial examples of Gtk+ apps seem to be legion but to find a decent tutorial that works its way through a moderately complex and usable app seem to be scarce. The same is true for a lot of languages and frameworks: Programming education, and tutorials on the Internet, start with Hello World and stop at some very small, trivial application with the complexity of about 1-4 source files. Final class: How to write a notepad-like application, or a TODO list with check boxes. There are a lot of resources that get you started but very little about how you'd approach what would turn into a medium-sized or large application, with hundreds of source files and many third party dependencies.
- cxr 2y agoThe author complains about Electron, but even setting aside programmers who choose it only because NPM is all they know, there are legitimate grievances to be had about desktop vendors' lack of coalescing around a common set of APIs. Apple isn't going to follow (or cooperate) with anybody, and that's fine. Frankly, I find it really, really dumb that everyone doesn't just implement Cocoa already, even if only in order to provide a lowest common denominator. (Don't try to sell me on the virtues of Qt. Enough already. Qt fans seem to be afflicted with real problems concerning the ability to come to grips with the shortcomings of Qt.)
- happy_dog1 2y agoFunny...I was just coming here to talk about Qt :) To be fair, as you say, Qt definitely has shortcomings and some things I don't like. If you're trying to minimize your disk space footprint, it's hard to get anything under 50MB with Qt. The difficulty of navigating the licensing for a closed-source app is (while often exaggerated) quite real, especially for someone using Qt for the first time. And while I understand why they did it, it's often annoying to have to use the Qt equivalents of standard library types (e.g., don't use std::string...use QString! don't use int64_t...use qint64! etc.) The problem is there really just isn't a perfect library or tool for building desktop apps, and writing your own would be...a lot of work. I share the linked post's distaste for Electron, which without a lot of work tends to result in horribly bloated software (often very nice look and feel, but bloated just the same). GTK sounds nice in principle, but you very quickly find yourself missing all of the functionality built into Qt. So Qt often for me ends up being like what someone once said about democracy: it's the worst system EXCEPT for all the other alternatives we've tried from time to time...all of which are worse.
- rubymamis 2y agoJust wanted to let you know it's not all gray in Qt land. The open-source Qt is licensed under LGPL. It's not really a mystery. I've built a proprietary app[1] on top of that, and as I explained in my blog post[2], the LGPL allows you to statically link your executable as long as you provide the object files and allow users to relink your app with a different version of Qt. There's also a lot you can do to drastically limit your binary size. I wrote a little about it on my blog post but haven't experimented that much with it yet. Things like: 1. Compiling Qt from source with only the specific modules needed and using static linking. 2. Use the -optimize-size flag and Link Time Optamization flag -ltcg. 3. Running strip on the resulting executable to remove unused symbols. 4. Use UPX to compress the executable. BTW, Qt can look very native, if you know how to use it properly (I wish to make it more commoditized!), for example, something I'm cooking at the moment: Windows: https://imgur.com/8lT0u24 https://imgur.com/8lT0u24 macOS: https://imgur.com/a/GKWSDaK https://imgur.com/a/GKWSDaK [1] https://get-notes.com https://get-notes.com [2] https://rubymamistvalove.com/block-editor#10-qt-license https://rubymamistvalove.com/block-editor#10-qt-license
- openrisk 2y ago> You'd better not dare write your desktop application in HTML. What has this world come to??? Ok thats clear. But then ten sentences later: > Of course, you aren't going to write your UI in C, only an idiot would do that. Instead, you want to write it in some kind of markup language. Now, let me think of some markup language that is universally known and has at least some pretence to be about laying out information on a screen... Thats right, html. The thing with UI frameworks in the 21st century of flying cars, AGI and rapidly approaching Singularity, is that its a stagnating mess. There should be a nice, standardized, cross-platform, easy to get started and progressively expandable way to build high quality visual apps. For some elusive reason, we cant have good things.
- Santosh83 2y agoNothing elusive. The reason is major vendors are not cooperating for even a common baseline standard. Its not impossible. They do it with Whatwg, but when it comes to native apps everyone and his dog head off in their own NIH incompatible direction. Just goes to show that social & economic problems are harder than flying cars and the singularity.
- abnercoimbre 2y ago> Just goes to show that social & economic problems are harder Does that mean SMTP and related email protocols succeeded simply because they were really early in the Internet game?
- PittleyDunkin 2y ago> Now, let me think of some markup language that is universally known and has at least some pretence to be about laying out information on a screen... Thats right, html. Sure, if you have low standards for UI. Ultimately making decent UI experiences cross-platform is impossible without some sort of catering to each platform that HTML/JS largely has no access to. React-native has made some headway here, as have electron + native bindings. But neither are really capable at this point of reproducing apps that clearly excel at leveraging platform-native frameworks.
- 2y ago
- deleted 2y ago[deleted]
- 4b11b4 2y agoI do like this, but the browser is... for browsing _interfaces_