Repository navigation
Answered by
badcel
Sep 5, 2026
Replies: 1 comment
|
Hi, thanks for bringing this up! There is one bug here in GirCore. The call to I opened bug #1601 for the constructor issue so the next GirCore release will contain the bugfix. I made a similar sample to your code which output "execute program here" if you press enter in a given window with a shortcutcontroller though: using System;
using Gtk;
var application = Adw.Application.New("org.gir.core", Gio.ApplicationFlags.FlagsNone);
application.OnActivate += (sender, args) =>
{
var execwithroot = CallbackAction.New((widget, args) =>
{
Console.WriteLine("Execute a program here");
return true;
});
var d = ShortcutController.New();
var c = KeyvalTrigger.New(Gdk.Constants.KEY_Return, 0);
var aa = Shortcut.New(c, execwithroot);
d.AddShortcut(aa);
var label = Gtk.Label.New("Hello world");
var window = Gtk.ApplicationWindow.New((Adw.Application) sender);
window.Title = "Window";
window.SetDefaultSize(300, 300);
window.SetChild(label);
window.AddController(d);
window.Show();
};
return application.RunWithSynchronizationContext(null);I hope this helps. |
0 replies
Answer selected by
Winver10
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Hi, thanks for bringing this up!
There is one bug here in GirCore. The call to
ShortcutTrigger.ParseString("<Enter>")should returnnullwhich it does not. It should returnnullbecause"<Enter>"is not a valid option (at least on my system). I don't know how to make this specific sample work as I'm not a GTK expert. Please check the GTK documentation or ask in the official support channels.I opened bug #1601 for the constructor issue so the next GirCore release will contain the bugfix.
I made a similar sample to your code which output "execute program here" if you press enter in a given window with a shortcutcontroller though: