Closed mirukuma closed 3 years ago
I don't have access to a macOS so I can't debug, but you're saying that all shortcuts work except Cmd+Q? Is it bound to a system action by default?
All shortcuts are not working, and it's usually bound to Quit. Also, we found that Cmd+Q works when the AppMenu is focused like below.
Oh but your Window
and Application
are not linked, are they? You probably need to use new Gtk.ApplicationWindow(app)
instead of new Gtk.Window()
.
hmm... Using Gtk.ApplicationWindow(app)
instead like below didn't solve the problem...
const gi = require('node-gtk');
const Gtk = gi.require('Gtk', '3.0');
const Gio = gi.require('Gio', '2.0');
Gtk.init();
gi.startLoop();
const app = new Gtk.Application();
app.register();
const quit = Gio.SimpleAction.new('quit', null);
app.setAccelsForAction('app.quit', ['<Primary>Q']);
quit.connect('activate', process.exit);
app.addAction(quit);
const win = new Gtk.ApplicationWindow(app);
win.on('destroy', process.exit);
win.showAll();
Gtk.main();
Do you have a C or python example of what you're trying to do? GTK documentation will be a better resource for this.
Compared to Python code, we found using Gtk.ApplicationWindow.new(app)
instead of new Gtk.ApplicationWindow(app)
can solve the problem. Thanks for your help!
Cool :)
We found that the code below is unable to close applications with
Cmd+Q
on macOS Big Sur 11.4. We haven't been able to determine why it's not working, but at leastsetAccelsForAction
seems to be working correctly. (For example, if you set it to<Primary>+K
, it will also switch the menu bar display.)