Register global hotkey lazarus / 32-Linux ---------------------------------------------------------------------- LemonParty · 2025-11-08 20:05 Is there a library to register global hotkeys in Linux? ---------------------------------------------------------------------- Thaddy · 2025-11-09 11:46 This differs per linux version. Qt has QxtGlobalShortcut X11 has some features for it. XGrabKey. You can use xdotool There is no single solution I am aware of and I am having trouble with WayLand(again) ---------------------------------------------------------------------- regs · 2025-12-28 10:09 I was making one for X11 and without Wayland support of course, as it still doesn't have this functionality. https://github.com/regs01/LazGlobalHotKey And if you are leoburn5 on Github you might check and confirm fixes for Windows. ---------------------------------------------------------------------- Thaddy · 2025-12-28 10:21 I made one in the related thread for X this year. Does not work well with Gnome, though. That seems to have its own mind about hotkey management. Works good with Xfce. Plain X-windows and also uses GTK2. In Qt6 it is very easy and works on Wayland. It is my intention to move to Qt permanently, given the status of GTK2 development and support. Lazarus should drop GTK2 as default. Note that moving to Qt does not solve the general problem that it differs per distribution: Wayland expects a distribution to write its own keyboard management. Wayland itself does not have any. ---------------------------------------------------------------------- Tony Stone · 2025-12-30 23:58 https://github.com/sysrpl/Codebot.Cross/blob/877a4c3992f25ebe2fa0f0b48 6a16fd761823514/source/codebot_controls/codebot.input.hotkeys.pas#L53 I use this ---------------------------------------------------------------------- regs · 2025-12-31 02:35 Quote from: Thaddy on December 28, 2025, 11:21:00 amLazarus should drop GTK2 as default. Strongly disagree. GTK2 is a powerhorse. Let alone poor high DPI support in Qt6 itself. And not everyone using Qt environments. ---------------------------------------------------------------------- Thaddy · 2025-12-31 09:20 GTK2 is already dropped by most distro's in case you are living underground or on mars. There is no support for it either. ---------------------------------------------------------------------- El Salvador · 2025-12-31 11:44 Quote from: Thaddy on November 09, 2025, 12:46:46 pmQt has QxtGlobalShortcut In QT*, I'm using QNativeEventFilter and XGrabKey(). Simpler and more immediate. But no Wayland. https://github.com/salvadorbs/AsuiteComps/b lob/main/library/platform/unix/Hotkeys.Manager.Platform.pas ---------------------------------------------------------------------- regs · 2026-01-11 02:50 Quote from: Thaddy on December 31, 2025, 10:20:12 amGTK2 is already dropped by most distro's in case you are living underground or on mars. There is no support for it either. I don't know a single distro that has it dropped. But I presume there might be some from Red Hat for obvious reasons, but no more. Any way, until GTK have proper scaling and theming GTK2 is only way for GTK DEs. And I don't like mix, it doesn't look good. Also GTK3/4 by nature has issues with X11 protocols, like KeyPress events and XTestFakeKeyEvent. That is crucial for accessibility and input assistance. So GTK2 still should be here. May be eventually after moving to GTK4 GTK3 could be dropped, but not GTK2. ---------------------------------------------------------------------- Thaddy · 2026-01-11 06:30 @regs Examples: https://artixlinux.org/news.php https://gtk.org https://www.phoronix.com/news/RHEL-10-No-GTK2 https://lists.debian.org/debian-devel/2026/01/msg00090.html Gtk no longer supports it themselves. And that is the reason most distro's have dropped it or will drop it: It is abandonware. https://chat.deepseek.com/share/t4i8q26fsnucytwv7t for a discussion A summary from Copilot says the same: What this means for Lazarus / FPC developers GTK2 is now: - **Unmaintained upstream** - **Being removed from major distros** - **A security risk** - **A packaging burden** For Lazarus specifically, this means: - GTK2 widgetset will become increasingly difficult to ship. - GTK3 and Qt5/Qt6 are the only viable long‑term targets. - Wayland‑based desktops will further complicate GTK2 use. The latter point is already a real issue! I am actively migrating to Qt6 with the remark that I only recently realized I was being an ostrich with my head in the ground myself. Gone are the Wayland problems. It really isn't a good idea to develop against the gtk2 widgetset for new software. Myself, I was also late to realize that, basically when I had to install GTK2 from Universe on Ubuntu and the notes from the Debian developers. ---------------------------------------------------------------------- robert rozee · 2026-01-21 22:50 Quote from: Thaddy on January 11, 2026, 07:30:07 am[...] Gtk no longer supports it themselves. And that is the reason most distro's have dropped it or will drop it: It is abandonware. [...] abandonware... or bug-free and feature complete? i can think of many examples of software that has remained static for many years simply because it is totally functional and usable, without need for any further 'tinkering'. could GTK2 not be one such piece of software - that works adequately, interfaces with X11 without any significant issue, and would not benefit from further development work? as for the need to interface with Wayland, from where i sit Wayland seems to be still at the 'experimental' stage, has numerous incompatibilities, and well short of being 'production ready'. when will Wayland be production ready - who knows? it could be another decade. "most distro's have dropped it or will drop it": this is a tricky assertion, that would be true even if only ONE distro had 'dropped' GTK2 and at the same time it was certain that at an indeterminate future time GTK2 would be surpassed (or functionally incorporated) within GTK3/4/etc. your statement is a bit like those advertisements we so often see reading: "Buy Now. Up To 90% Off In-Store Today" wow, a 90% discount, surely that is an absolute bargain?! but wait a minute, the statement could still hold true even if the store had just a single item (such as an empty paper bag) with 90% off and NO other items with more than 90% off. a rewriting of the statement is "nothing in store will be discounted by MORE than 90%" - a far less attractive proposition to lure the customer in. likewise, your assertion that "most distro's have dropped it [GTK2] or will drop it" is equivalent to saying "eventually GTK2 will be replaced by something else, although that happening may be years (or even decades) away". in a sane world, i could see a 'selector' helper being devised, that hooks up a GUI application at run-time with either of GTK2, GTK3/4/etc, or Qt5/6/etc, the choice being dependent on what interface the GUI application tries to access. cheers, rob   :-) ---------------------------------------------------------------------- cdbc · 2026-01-21 23:24 Hi I just read today on our PCLinuxOS forum, that "GTK2 is still in the repo, as long as it runs -- the slightest problem and it's out, 'cause we cannot recompile it anymore." The world might just be heading in the direction pointed out by Thaddy... Me personally, I'm with Qt4/5/6 for a long time now, but I've recently begun exploring "fpGUI" from Graeme's github... I must say it looks very promising and I like it \o/\ö/\o/ Just my "Nickel's Worth" Regards Benny ---------------------------------------------------------------------- Thaddy · 2026-01-22 05:28 @robert rozee Did you check the positions taken by the major distro's? I did. GTK2 is at the most available but always marked as deprecated. As cdbc concluded, also his favourite distro pclinux has that policy. As has Debian, Ubuntu, Fedora... Rather naïve to ignore what the real world does. It is abandon ware. ---------------------------------------------------------------------- zeljko · 2026-01-24 23:00 Quote from: Thaddy on January 11, 2026, 07:30:07 am@regs Examples: https://artixlinux.org/news.php https://gtk.org https://www.phoronix.com/news/RHEL-10-No-GTK2 https://lists.debian.org/debian-devel/2026/01/msg00090.html Gtk no longer supports it themselves. And that is the reason most distro's have dropped it or will drop it: It is abandonware. https://chat.deepseek.com/share/t4i8q26fsnucytwv7t for a discussion A summary from Copilot says the same: What this means for Lazarus / FPC developers GTK2 is now: - **Unmaintained upstream** - **Being removed from major distros** - **A security risk** - **A packaging burden** For Lazarus specifically, this means: - GTK2 widgetset will become increasingly difficult to ship. - GTK3 and Qt5/Qt6 are the only viable long‑term targets. - Wayland‑based desktops will further complicate GTK2 use. The latter point is already a real issue! I am actively migrating to Qt6 with the remark that I only recently realized I was being an ostrich with my head in the ground myself. Gone are the Wayland problems. It really isn't a good idea to develop against the gtk2 widgetset for new software. Myself, I was also late to realize that, basically when I had to install GTK2 from Universe on Ubuntu and the notes from the Debian developers. That's pretty correct way. Qt6 is the way to go (Qt5 does not have wayland updates anymore, so good for x11 only), but Qt6 is activelly developed for wayland. Also, yes, gtk3 supports both, yet unfinished, but not useable for heavy and complex apps, especially on wayland. Haven't tried gtk4 yet on wayland, and gtk4 changed api a lot, even some classes dissappeared, so really don't know if it ever will be added as ws on lazarus. Qt6 is the only ws on linux which will keep lazarus alive on linux in coming years. Check gtk2 in 5 yrs, even gtk3 won't be in new distros at that time. ---------------------------------------------------------------------- regs · 2026-03-12 13:06 Quote from: Thaddy on January 11, 2026, 07:30:07 am@regs There are tones of software made with GTK2. And not everyone switching to Wayland mess. RHEL isn't desktop oriented. And it's Red Hat after all. A corpo that is sabotaging and destroying everyone that isn't made by them. Barely anybody is going to remove libraries. It's just meant to be not preinstalled and  meant to to be used by main software out of box. But even if some will cut off everything that Red Hat want to destroy it doesn't mean everyone will. Linux/BSD world is about gets fragmented. Not everyone will follow Red Hat and Wayland. ---------------------------------------------------------------------- regs · 2026-03-12 14:16 Quote from: zeljko on January 25, 2026, 12:00:40 amThat's pretty correct way. Qt6 is the way to go (Qt5 does not have wayland updates anymore, so good for x11 only), but Qt6 is activelly developed for wayland. Also, yes, gtk3 supports both, yet unfinished, but not useable for heavy and complex apps, especially on wayland. Haven't tried gtk4 yet on wayland, and gtk4 changed api a lot, even some classes dissappeared, so really don't know if it ever will be added as ws on lazarus. Qt6 is the only ws on linux which will keep lazarus alive on linux in coming years. Check gtk2 in 5 yrs, even gtk3 won't be in new distros at that time. Qt6 and GTK4 are very bad with high DPI. They offer no direct pixel access, just blurry raster upscaling. Until they manage to do high DPI right way they are out of options. GTK2 is working and LCL has own scaling with proper recomposition. Well, there are minor issues with GTK2, but still better than blurred interface. Needless to say that if they drop X11, they are out of option again. Wayland is dysfunctional mess. Can't cover even half of X11 functionality. For me input assistance and accessibility are crucial. Wayland have no plans to offer anything here. Working with clipboard is another story. X11 is quite complicated here and has its problems, surely not as simple as Win32, but Wayland puts complexity into entirely different level and perspective. Speaking back of high DPI we really need to control it ourselves. LCL has rather good scaling capabilities. Qt6 still has a hack with environmental variable that can be applied with qputenv to disable that poor internal scaling. Right now we have both working. Right now both are working. First Qt6 is upscaling, then LCL is downscaling. ---------------------------------------------------------------------- Thaddy · 2026-03-12 15:20 Quote from: regs on March 12, 2026, 03:16:26 pmQt6 and GTK4 are very bad with high DPI. You obviously have no clue.  Better to either improve your knowledge or do not take part in this discussion. Qt6 and  GTK4 are specifically designed to support high dpi. I wonder if you even have a High DPI monitor to test your bold statement.