by roundabout, Monday, 17 March 2025, 15:03:38 (1742223818), pushed by roundabout, Monday, 17 March 2025, 15:03:52 (1742223832)
Author identity: vlad <vlad.muntoiu@gmail.com>
1018f7e78c3a39cc23af57d78270d828a2792d79
.idea/workspace.xml
@@ -4,7 +4,10 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="b2c629ea-d173-4caf-b306-cbeaee617270" name="Changes" comment="Add to About" />
<list default="true" id="b2c629ea-d173-4caf-b306-cbeaee617270" name="Changes" comment="Update">
<change afterPath="$PROJECT_DIR$/articles/GTK 4 makes no sense.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@@ -22,23 +25,23 @@
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"Python.generate.executor": "Run",
"Python.main.executor": "Debug",
"RunOnceActivity.ShowReadmeOnStart": "true",
"RunOnceActivity.git.unshallow": "true",
"git-widget-placeholder": "master",
"last_opened_file_path": "/home/vlad/blog",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"nodejs_package_manager_path": "npm",
"settings.editor.selected.configurable": "com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable",
"vue.rearranger.settings.migration": "true"
<component name="PropertiesComponent">{
"keyToString": {
"Python.generate.executor": "Run",
"Python.main.executor": "Debug",
"RunOnceActivity.ShowReadmeOnStart": "true",
"RunOnceActivity.git.unshallow": "true",
"git-widget-placeholder": "master",
"last_opened_file_path": "/home/vlad/charta",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"nodejs_package_manager_path": "npm",
"settings.editor.selected.configurable": "com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable",
"vue.rearranger.settings.migration": "true"
}
}]]></component>
}</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/static/photos/izvor" />
@@ -81,8 +84,8 @@
<component name="SharedIndexes">
<attachedChunks>
<set>
<option value="bundled-js-predefined-d6986cc7102b-deb605915726-JavaScript-PY-243.22562.180" />
<option value="bundled-python-sdk-85c76a3b01b3-9a18a617cbe4-com.jetbrains.pycharm.pro.sharedIndexes.bundled-PY-243.22562.180" />
<option value="bundled-js-predefined-d6986cc7102b-1632447f56bf-JavaScript-PY-243.25659.43" />
<option value="bundled-python-sdk-181015f7ab06-4df51de95216-com.jetbrains.pycharm.pro.sharedIndexes.bundled-PY-243.25659.43" />
</set>
</attachedChunks>
</component>
@@ -112,6 +115,16 @@
<workItem from="1734782959114" duration="2022000" />
<workItem from="1735979177444" duration="746000" />
<workItem from="1735979929153" duration="2308000" />
<workItem from="1738518461359" duration="5460000" />
<workItem from="1738524073469" duration="1880000" />
<workItem from="1738927132169" duration="9000" />
<workItem from="1741110669259" duration="3115000" />
<workItem from="1741183079833" duration="1141000" />
<workItem from="1741186960931" duration="35000" />
<workItem from="1741192512831" duration="749000" />
<workItem from="1741261837546" duration="740000" />
<workItem from="1741339164286" duration="1201000" />
<workItem from="1742222443173" duration="1255000" />
</task>
<task id="LOCAL-00001" summary="Blog">
<option name="closed" value="true" />
@@ -361,7 +374,15 @@
<option name="project" value="LOCAL" />
<updated>1735982089613</updated>
</task>
<option name="localTasksCounter" value="32" />
<task id="LOCAL-00032" summary="Update">
<option name="closed" value="true" />
<created>1738522657024</created>
<option name="number" value="00032" />
<option name="presentableId" value="LOCAL-00032" />
<option name="project" value="LOCAL" />
<updated>1738522657024</updated>
</task>
<option name="localTasksCounter" value="33" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@@ -379,7 +400,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="Extra bullet point" />
<MESSAGE value="Remove None" />
<MESSAGE value="Update article" />
<MESSAGE value="Add ampoule docs" />
@@ -404,10 +424,11 @@
<MESSAGE value="More articles" />
<MESSAGE value="Add some Izvor screenshots" />
<MESSAGE value="Add to About" />
<option name="LAST_COMMIT_MESSAGE" value="Add to About" />
<MESSAGE value="Update" />
<option name="LAST_COMMIT_MESSAGE" value="Update" />
</component>
<component name="com.intellij.coverage.CoverageDataManagerImpl">
<SUITE FILE_PATH="coverage/blog$generate.coverage" NAME="generate Coverage Results" MODIFIED="1735982188194" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
<SUITE FILE_PATH="coverage/blog$generate.coverage" NAME="generate Coverage Results" MODIFIED="1741110703252" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
<SUITE FILE_PATH="coverage/blog$main.coverage" NAME="main Coverage Results" MODIFIED="1734783549604" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
</component>
</project>
articles/GTK 4 makes no sense.md
@@ -0,0 +1,112 @@
---
title: GTK 4 makes no sense
topics: ["gtk", "software", "opinion", "gnu/linux", "python", "c", "c++"]
DATE: 2025-03-04
---
I recently started to write a GTK 3 library, but then I realised it will be
obsolete in 5 years at most, and I thought GTK 4 isn't that bad, so I decided to
port it to GTK 4. Turns out I was wrong.
GNOME's hate for other desktops
-------------------------------
GTK 4 clearly is made to reflect GNOME's vision of the future of desktops.
Future versions will even require a "platform library", meaning your app will
have to be tied to either GNOME, Elementary or whatever. In GNOME's vision,
there won't be any generic apps.
GNOME should understand that I don't want to design anything, or make my app
feel like an Apple product. Rather, I value more the users' comfort when using
the app, which is increased when the app looks like the rest of the system and
can be themed to fit the user's preferences or needs.
I've seen suspiciously few apps that use GTK 4 and not libAdwaita (and "adwaita"
means "the only one" in Sanskrit, a fitting name for GNOME's design). Also,
Cinnamon/Linux Mint, MATE, Xfce and other GTK desktops have not shared *plans*
for a migration when GTK 4 has been out for 4 years already. This is a clear
indication they're unsatisfied with GNOME, and GNOME is hostile to them.
* [GNOME closing an issue about menus, saying it's a discussion, but it's not](https://gitlab.gnome.org/GNOME/gtk/-/issues/2922)
The new "menus"
---------------
GTK 4 removed the traditional menus, because GNOME doesn't need them, as their
apps are too basic (even thought of a [division app marketed as a coffee tool](https://flathub.org/apps/com.konstantintutsch.Caffeine))?.
They are now expecting powerful app developers to replace their menus with
"menus" implemented with a popover. Some shortcomings of this approach:
### The submenu handling
By default, sub"menus" aren't handled like they were before, where hovering its
parent would open the sub"menu", making it easy to browse through the options.
Now, you have to click the parent, which will slide the sub"menu" into view,
replacing the parent, and then, should you want to go back, you have to click
a back arrow. I guess this is probably intended for phones, where it could be
useful indeed as the screen is small you can't hover, but it should have been
a global preference in `gsettings`, not something the app developer has to
choose.
Even though you can opt for the classic "menu" behaviour, it's not the default,
making apps like Inkscape use a wrong design. Having this at the DE level would
make it so much easier for the user, the app developer, and the distributor.
Additionally, there are many other problems.
### The menu construction
Now, to construct "menus", you have to use a `GMenu` object. Among other things,
this means your "menu" items can no longer be accessed as widgets. Instead, the
"menu" is declaratively constructed from a tree-like structure. This is a good
idea, but it has some flaws; every "menu" item must now be bound to a `GAction`,
which must have a string ID. Now instead of just managing your variables, you
have two namespaces to manage. When many items are similar to each other or even
dynamic (think zoom levels, move targets in a file manager, or a list of drives),
it's a pain to have to think of a unique ID for each one.
Why isn't there just a way to bind a "menu" item to a (lambda) function? This
would make it so much easier to manage, and more flexible.
No more containers
------------------
GTK 4 removed containers and all related APIs with them. Now, everything is
inconsistent, and you can't even have a signal when children are added or
removed. Instead, if you want some other widget to sync with the children of a
container, you have to subclass that container and override its add/remove
methods so they emit custom signals. If the specific type isn't under your
control, good luck.
Lots of functions, including `Gtk::Box::pack_start`, `Gtk::Box::pack_end`, and
others, were renamed to `append` and `prepend` for no reason. Also, you can no
longer get a vector of children from a container, you have to iterate over them
manually.
No Glade
--------
Glade was a great tool and it's a shame to see it go. Cambalache exists, but
it's got its own problems, especially that the conversion from its own file to
a `.ui` file is one-way.
The alternative isn't a design tool, I don't want to design anything, but just
to declare the layout and the signals, which the GtkBuilder still does well,
writing XML by hand is just cumbersome though.
The good parts
--------------
I did decide to use GTK 4 because it has many benefits if you don't use it with
libAdwaita:
* Cell renderers have been deprecated, making everything use the same widget
model.
* CSS syntax has been updated to newer standards.
* Drag and drop now makes much more sense.
* No more padding properties which duplicated CSS's job.
* Widgets are initially shown; you don't need to manually `show()` them.
* `GtkFileChooserNative` would allow the system's file browser to be used in all
apps; more distribution support is needed though.
* All widgets now receive all events.