[ANSWERED]Detect GTK; QT, etc. lazarus / 1-Linux ---------------------------------------------------------------------- CM630 · 2025-09-01 07:56 Does it make sense, and is it useful to detect if the app runs on GTK (2;3;4) or KDE or maybe some other GUI kit? For example, it occurs that the TSaveDialogue in Mint Cinnamon works differently in Windows and MacOS, so it needs some additional handling. But maybe if I run the app on a QT Linux it will not work as expected? ---------------------------------------------------------------------- dbannon · 2025-09-01 11:03 Do you mean like this - Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i         Stg := rsAbout + #10 + rsAboutVer + ' ' + Version_String;                  // version is in cli unit.        {$ifdef LCLCOCOA} Stg := Stg + ', 64bit Cocoa'; {$endif}        {$ifdef LCLQT5}   Stg := Stg + ', QT5';       {$endif}        {$ifdef LCLQT6}   Stg := Stg + ', QT6';       {$endif}        {$ifdef LCLGTK3}  Stg := Stg + ', GTK3';        {$endif}        {$ifdef LCLGTK2}  Stg := Stg + ', GTK2';        {$endif} Davo ---------------------------------------------------------------------- CM630 · 2025-09-01 15:39 It seems I have never needed the answer before, but is the code in  {$ifdef xxxx}  yyyyy;        {$endif} included in the compiled binaries? If I build the app in GTK2, is there a chance that it will always show "GTK2"? ---------------------------------------------------------------------- dbannon · 2025-09-01 23:36 If you build in the conventional way, using Lazarus, yes. I guess it might be possible to make a build environment that does not define , eg LCLGTK2 but it would be hard work. And very silly. Davo ---------------------------------------------------------------------- CM630 · 2025-09-02 06:57 If I have some uncompilable code in the {$ifdef} section for a different OS, the app is compiled. So this is not what I am looking for; I need to detect the GUI kit during runtime. ---------------------------------------------------------------------- zeljko · 2025-09-02 07:24 But dbannon already give you a hint how to find out what ws are you running on. Try with LCLPlatformDef unit and use GetBuildLCLWidgetType, maybe that's what you want, but IMO if you need to call ws specific stuff you should go with LCLxx ws defines. eg   {$ifdef lclgtk2} call this code {$else} call {endif} ---------------------------------------------------------------------- marcov · 2025-09-02 09:58 The primary version of the widgetset is hard linked in, a GTK2 compiled LCL binary won't suddenly use GTK3 as the change in the major version indicates an incompatible interface. Parse /proc/self/maps to identify all shared libs you are linked against. At least that will give you additional version numbers. (like gtk2-x-y-z). Detecting non linked features like KDE or Gnome is different. It might also be that the changes made can't be easily verified. E.g.the distro's GTK2 might be compiled with different options or even additional code enabling or disabling features ---------------------------------------------------------------------- CM630 · 2025-09-02 12:23 So if I understand you correctly, if I build the app for GTK3, it will somehow manage to work on a Linux relying on a QT kit? And actually detecting the GUI kit of the OS makes no sense? ---------------------------------------------------------------------- zeljko · 2025-09-02 12:59 No, if you build your app for gtk3 then it will use gtk3 library. ---------------------------------------------------------------------- marcov · 2025-09-02 13:03 Quote from: CM630 on September 02, 2025, 02:23:21 pmSo if I understand you correctly, if I build the app for GTK3, it will somehow manage to work on a Linux relying on a QT kit? It will work on a system that has GTK3 installed. What the desktop uses doesn't matter. QuoteAnd actually detecting the GUI kit of the OS makes no sense? It does for special cases (like modified versions, as Ubuntu did for a while), and minor versioning details. But that is all ad-hoc, there is no systembehind it. ---------------------------------------------------------------------- Fred vS · 2025-09-02 18:21 Quote from: CM630 on September 02, 2025, 02:23:21 pmSo if I understand you correctly, if I build the app for GTK3, it will somehow manage to work on a Linux relying on a QT kit? And actually detecting the GUI kit of the OS makes no sense? If you want to avoid all these problems, develop your application with a widget that uses the graphical server directly, without dependencies, such as fpGUI or MSEgui. Voila, voila, I leave... ---------------------------------------------------------------------- CM630 · 2025-09-03 05:27 Quote from: marcov on September 02, 2025, 03:03:45 pm... It will work on a system that has GTK3 installed. What the desktop uses doesn't matter. ... Things got clearer now. The notorious Linux 250 kB app with 500 GB dependencies. Quote from: Fred vS on September 02, 2025, 08:21:18 pm... If you want to avoid all these problems, develop your application with a widget that uses the graphical server directly, without dependencies, such as fpGUI or MSEgui. ... Sounds reasonable. But fpGUI - last update 2014; MSEgui - last update 2018... seem like abandoned projects. ---------------------------------------------------------------------- Thausand · 2025-09-03 05:38 Quote from: CM630 on September 03, 2025, 07:27:39 amSounds reasonable. But fpGUI - last update 2014; MSEgui - last update 2018... seem like abandoned projects. This funny say in sad way. fpGUI update june 2025, MSE 15 hours. When something good (enough) then no release need. Not understand occupation with version number/release. Real work make in main or branch. ---------------------------------------------------------------------- CM630 · 2025-09-03 08:06 https://fpgui.sourceforge.net : Quote2015-09-02---- https://wiki.freepascal.org/fpGUI : QuoteLatest release v1.4.1 (2015-09-02):---- https://en.wikipedia.org/wiki/FpGUI : QuoteStable release   v1.4.1 / September 2, 2015; 10 years ago---- https://github.com/graemeg/fpGUI/tags :  Quoteon Sep 3, 2015  b0a9f3d  zip  tar.gz I do not understand, are you ironic, or am I missing something. ---------------------------------------------------------------------- Fred vS · 2025-09-03 08:25 Quote from: CM630 on September 03, 2025, 07:27:39 amQuote from: Fred vS on September 02, 2025, 08:21:18 pm... If you want to avoid all these problems, develop your application with a widget that uses the graphical server directly, without dependencies, such as fpGUI or MSEgui. ... Sounds reasonable. But fpGUI - last update 2014; MSEgui - last update 2018... seem like abandoned projects. ???? Last commit of fpGUI: Commits on Jun 9, 2025 . https://github.com/graemeg/fpGUI/commits/develop/ Last commit of MSEide-MSEgui: Commits on Sep 2, 2025. https://github.com/mse-org/mseide-msegui/commits/main/ ---------------------------------------------------------------------- Thausand · 2025-09-03 08:34 Quote from: CM630 on September 03, 2025, 10:06:28 am... I do not understand, are you ironic, or am I missing something. Is not my ironic write but you write with have focus wiki and release version which not true work but only time-moment. Development is make in repository (main or develop branch). Then Information you write is wrong and is in way funny and sad. fpGUI and MSE have no dependentcy and have custom code for drawing and work. When work then why update with make new release/version ? Example, fpGUI instruction tell for need special branch repository (for long time). See answer Fred with better English (sorry for mine) ---------------------------------------------------------------------- Fred vS · 2025-09-03 09:01 Quote from: CM630 on September 03, 2025, 10:06:28 amhttps://fpgui.sourceforge.net : Quote2015-09-02---- https://wiki.freepascal.org/fpGUI : QuoteLatest release v1.4.1 (2015-09-02):---- https://en.wikipedia.org/wiki/FpGUI : QuoteStable release   v1.4.1 / September 2, 2015; 10 years ago---- https://github.com/graemeg/fpGUI/tags :  Quoteon Sep 3, 2015  b0a9f3d  zip  tar.gz I do not understand, are you ironic, or am I missing something. I think you are missing something. The fpGUI source are here: https://github.com/graemeg/fpGUI And the MSEide-MSEgui source there:  https://github.com/mse- org/mseide-msegui